Csound Csound-dev Csound-tekno Search About

[Csnd] Csound with Python. Is it possible to...

Date2025-02-01 22:43
FromGabriele Battaglia <0000013f12e4daf0-dmarc-request@LISTSERV.HEANET.IE>
Subject[Csnd] Csound with Python. Is it possible to...
Hi.

Well I supose the best way to manage Csound from Python is to use ctcsound.


Can I create instrument using python variables instead of passing and 
entire string to the csound constructor?


And, while Csound is performing, is the flux blocked or the python 
script takes back the control before the performance is over?

Gabe.

-- 
Gabriele Battaglia (IZ4APU)
--... ...--  -.. .  .. --.. ....- .- .--. ..-  - ..-  . .
Sent from my Giant Desktop PC

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

Date2025-02-02 16:58
FromMichael Gogins
SubjectRe: [Csnd] Csound with Python. Is it possible to...
The ctcsound API for Csound is single-threaded, so it blocks until the performance is completed. 

However, a multithreaded performance can be done using CsoundPerformanceThread, see this documentation for how it works: https://github.com/csound/ctcsound/blob/master/cookbook/03-threading.ipynb.

You cannot directly program Csound instruments in Python. However, you can send in new instruments as text to be compiled at any time during a performance.

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Sat, Feb 1, 2025 at 10:43 PM Gabriele Battaglia <0000013f12e4daf0-dmarc-request@listserv.heanet.ie> wrote:
Hi.

Well I supose the best way to manage Csound from Python is to use ctcsound.


Can I create instrument using python variables instead of passing and
entire string to the csound constructor?


And, while Csound is performing, is the flux blocked or the python
script takes back the control before the performance is over?

Gabe.

--
Gabriele Battaglia (IZ4APU)
--... ...--  -.. .  .. --.. ....- .- .--. ..-  - ..-  . .
Sent from my Giant Desktop PC

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