Hi again,
I’m reading through Yi/Kaufman’s ctcsoundAPIExamples cookbook to try to wrap my head around the different ways to control Csound in Python. While I’ve had some success at using ctcsound, I’m still struggling to get a mental model of how elements like the Csound
class, CsoundPerformanceThread
class, .perform()
, .performKsmps()
, and the various methods of compilation and score insertion work together.
Can you help me clarify my mental model? Here are a couple questions.
-
Can you break down how
.performKsmps()
actually works? I see that you can run it in awhile
loop to perform a score one k-frame at a time –while (c.performKsmps() == 0): pass
Does this mean that Python is telling Csound to perform the next k-frame each time Python passes through thewhile
loop? If so, how is the timing synchronized between Python’swhile
loop and the k-frames in Csound? -
Example 4 in the cookbook says “CsoundPerformanceThread has some convenient methods for handling events, but does not have features for doing regular processing at block boundaries. In general, use CsoundPerformanceThread when the only kinds of communication you are doing with Csound are through events, and not using channels.” Are using
CsoundPerformanceThread
and.performKsmps()
mutually exclusive? I’m working on a project where I’ll want to trigger real-time score events and also send control messages through channels. -
The ctcsoundAPIExamples cookbook seems to advocate for processing control channel signals with
.performKsmps()
. In the PySimpleGUI/Csound cookbook they change control channel values using.setControlChannel()
in the GUI event loop rather than awhile
loop executing.performKsmps()
. What are the important differences between these two approaches?
Hopefully this can be helpful to any other people trying to figure these things out. Thanks!
Jason