Csound Csound-dev Csound-tekno Search About

[Csnd] Tracking performance time within Python

Date2020-09-23 14:39
FromJason Hallen
Subject[Csnd] Tracking performance time within Python
Hi everyone,

I'm hoping you all can explain a basic concept of using Python/ctcsound to control live performance of Csound.  How can I track the time-based element of performance within Python?

Here's an example that illustrates my question.  I've got a Csound orchestra with algorithms that generate note events in real time, and I can change parameters in these algorithms live.  Csound tracks performance time internally, so it knows when to trigger the note events.  However, if I want to port these algorithms and interactivity over to Python/ctcsound, how can Python track the performance time?  Is it possible to tell Python, "In 1.3 seconds trigger this note in Csound"?  Does Python have an internal clock?  Or do I have to rely on Csound itself to send time information back to Python?

Sorry if this question sounds very uninformed and muddled!  I'll be embarking on some Csound/Python projects in the coming weeks and need to wrap my head around it.

Thanks!
Jason
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

Date2020-09-23 15:43
FromFrancois PINOT
SubjectRe: [Csnd] Tracking performance time within Python
You should have a look at scoreEvent, scoreEventAbsolute (https://csound.com/docs/ctcsound/ctcsound-API.html#ctcsound.Csound.scoreEvent) which are methods of the Csound class, or at the scoreEvent method of the CsoundPerformanceThread class (https://csound.com/docs/ctcsound/ctcsound-PT.html#ctcsound.CsoundPerformanceThread.scoreEvent).

Definitively you should rely on the Csound performance clock.

François

Le mer. 23 sept. 2020 à 15:39, Jason Hallen <hallenj@gmail.com> a écrit :
Hi everyone,

I'm hoping you all can explain a basic concept of using Python/ctcsound to control live performance of Csound.  How can I track the time-based element of performance within Python?

Here's an example that illustrates my question.  I've got a Csound orchestra with algorithms that generate note events in real time, and I can change parameters in these algorithms live.  Csound tracks performance time internally, so it knows when to trigger the note events.  However, if I want to port these algorithms and interactivity over to Python/ctcsound, how can Python track the performance time?  Is it possible to tell Python, "In 1.3 seconds trigger this note in Csound"?  Does Python have an internal clock?  Or do I have to rely on Csound itself to send time information back to Python?

Sorry if this question sounds very uninformed and muddled!  I'll be embarking on some Csound/Python projects in the coming weeks and need to wrap my head around it.

Thanks!
Jason
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
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