[Csnd] Get csound messages into Python with ctcsound
Date | 2018-12-15 08:31 |
From | Richard |
Subject | [Csnd] Get csound messages into Python with ctcsound |
It looks like this is possible. Are there any examples on how to do this? Richard 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 | 2018-12-15 10:11 |
From | Francois PINOT |
Subject | Re: [Csnd] Get csound messages into Python with ctcsound |
The Csound API has some functions for creating a buffer for Csound messages and for managing these messages. In ctcsound the corresponding methods are: createMessageBuffer firstMessage firstMessageAttr popFirstMessage messageCnt destroyMessageBuffer With these method you can develop your own system to yield Csound messages from Python. For example, supposing that cs is an instance of ctcsound.Csound: import time def flushMessages(cs, delay=0): s = "" if delay > 0: time.sleep(delay) for i in range(cs.messageCnt()): s += cs.firstMessage() cs.popFirstMessage() return s def printMessages(cs, delay=0): s = flushMessages(cs, delay) print(s) cs.createMessageBuffer(0) ... François Le sam. 15 déc. 2018 à 09:31, Richard <zappfinger@gmail.com> a écrit : It looks like this is possible. Are there any examples on how to do this? |
Date | 2018-12-15 11:56 |
From | Richard |
Subject | Re: [Csnd] Get csound messages into Python with ctcsound |
Nice! I changed it a bit def
printMessages(cs, delay=0):
s =
flushMessages(cs, delay)
if len(s)>0:print(s)
Richard
On 15/12/2018 11:11, Francois PINOT
wrote:
|