Csound Csound-dev Csound-tekno Search About

[Csnd] Re: csound api (from python) - can I mix realtime events with a .csd generated on the fly?

Date2008-01-20 19:57
FromMichael Gogins
Subject[Csnd] Re: csound api (from python) - can I mix realtime events with a .csd generated on the fly?
From: "Cesare Marilungo" 
> I can build a string with my xml csd, pass it to csnd.setOrchestra and 
> then use exportForPerformance() and perform().
>
> Or I can use Compile(filename), use CsoundPerformanceThread() and Play() 
> it. With this solution I can also pass events in realtime with 
> InputMessage (called on the performanceThread pointer).
>
> But what if I want to do both?

As far as I know, you can use InputMessage in both cases.

That is to say, you can set the CSD using csnd.setCSD(), or the orchestra 
and score separately using csnd.setOrchestra() and csnd.setScore(), and then 
you can just call csnd.exportForPerformance() and csnd.compile(), and after 
that you can call CsoundPerformanceThread.Play() and InputMessage().

Compile(filename) assumes the orchestra exists primarily as a file on 
storage, whereas the csnd.compile() function assumes the orchestra exists 
primarily as text in memory inside the CppSound object, and that is why it 
must be exported first. Either function can be used with a CsoundPerformanceThread.

> Also, is it normal that when I pass events with InputMessage the event is 
> always generated at the time specified in the i statement - ignoring the 
> bpm setting specified with a t statement in my score file?

As far as I know, the time of the InputMessage event is immediate.

Hope this helps,
Mike