How does Ctcsound Work?
Date | 2016-04-09 19:56 |
From | Emmett Palaima |
Subject | How does Ctcsound Work? |
Hi, I'm interested in doing some work with ctcsound, I was looking at the github (https://github.com/fggp/ctcsound/blob/master/csoundSession.py) however and couldn't really find a clear explanation for how to start a performance thread or pass a variable via channels. I am still very new to python so if anyone could explain this and any other steps I need to take to get it working that would be a great help. Thanks!
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
|
Date | 2016-04-09 23:58 |
From | Francois PINOT |
Subject | Re: How does Ctcsound Work? |
The third recipe in the cookbook shows a simple example of using CsoundPerformanceThread: https://github.com/fggp/ctcsound/blob/master/cookbook/03-threading.ipynb 2016-04-09 20:56 GMT+02:00 Emmett Palaima <epalaima@berklee.edu>:
|
Date | 2016-04-10 20:34 |
From | Emmett Palaima |
Subject | Re: How does Ctcsound Work? |
Thanks! How does inputMessage() function work? It says it sends the score a string, so I'm wondering if there is something equivalent to cs.SetChannel() in the Python API where you give it the inputs of ("channelname", variable) and read it in csound via chnget, just to easily pass an integer or float value easily to a performance thread. Is that something inputMessage() does or is there another function? Thank you for your help, as a beginner trying to get better versed in some deeper level programming I really appreciate it. On Sat, Apr 9, 2016 at 6:58 PM, Francois PINOT <fggpinot@gmail.com> wrote:
|
Date | 2016-04-11 01:24 |
From | Emmett Palaima |
Subject | Re: How does Ctcsound Work? |
Hi, I actually figured it out on my own by diving into the ctcsound.py file. Took some trial and error to figure out how the syntax worked, but I'm now passing the information to my Csound thread via setControlChannel(). What does it mean in the ctcsound.py file when all of the defined functions are given an input of self and what is the difference between self and self.cs? I'd like to say thanks for providing this clean alternative to the Python API, which has been giving me a lot of inexplicable problems when I try to implement it on my Raspberry Pi. It had me stuck in a dead end on the project I've been working on and getting your ctcsound to work was a nice breakthrough. Also thanks for answering my questions as always! On Sun, Apr 10, 2016 at 3:34 PM, Emmett Palaima <epalaima@berklee.edu> wrote:
|
Date | 2016-04-11 09:43 |
From | Francois PINOT |
Subject | Re: How does Ctcsound Work? |
inputMessage() in CsoundPerformanceThread is a high level method allowing the user to send a score event to Csound as a string. It works on unix like systems which accept piping commands; that means it does not work on Windows. As you figured out, setControlChannel() is a good method for sending single values to Csound through software busses (channels).In OOP, the methods of an object have an implicit reference to the object which is expressed as a pointer named 'this' in C++, and as a first argument to the method declaration named 'self' in Python. This reference to the object allows the method to access the properties or the other methods of the object. So when you create a Csound instance with a command like myCsound = ctcsound.Csound(), myCsound is an object. Then when calling a method on this object like myCsound.setControlChannel("myChannel", myValue), the 'self' reference is automatically added to the argument list before 'myChannel' (Python knows it has to do so, because setControlChannel is a method of an object, not a simple function). self.cs is a property of the 'myCsound' object. This property contains the value of the C pointer created under the hood by the C API when a Csound instance is created (never forget that ctcsound is just a Python binding layer to the C Csound API). This C pointer is passed to CsoundPerformanceThread when you create a new thread so that it knows the Csound instance it has to work with: myCPT = ctcsound.CsoundPerformanceThread(myCsound.cs) 2016-04-11 2:24 GMT+02:00 Emmett Palaima <epalaima@berklee.edu>:
|