Csound Csound-dev Csound-tekno Search About

[Csnd] Porting a Python application from 5 to 6

Date2013-10-05 19:44
FromTobia Conforto
Subject[Csnd] Porting a Python application from 5 to 6
Hi all

Congratulations on the release of CSound 6!

I'm trying to port a Python app, Rationale, to it: http://rationale.sourceforge.net/

My long-term goal is to fork it and update it entirely, but for now it'd be great to just have it work with CSound 6 and start tweaking stuff.

But I'm a newbie to CSound's API and I've stumbled onto the first roadblock.
The playback module is subclassing the Python class csnd6.CppSound, which apparently is just a wrapper on some C++ class with the same name, of which I couldn't find any documentation.
Then it calls the following methods, in this order:

setCommand("csound -m0d -+rtaudio=portaudio -odac0 test.orc test.sco")
setOrchestra(orc_data)
setScore(sco_data)
exportForPerformance()
compile()

After calling the compile method (lowercase), the following log is printed by CSound:

BEGAN CppSound::compile()...
BEGAN CppSound::compile(6, 0x7fe63cd01090)...
instr ratdefault uses instrument number 1
instr ratratdefaulton uses instrument number 2
instr ratsf2default uses instrument number 3
instr ratratsf2defaulton uses instrument number 4
instr ratbeallendall uses instrument number 5
instr ratcounter uses instrument number 6
Macro definition for RATSTART
Macro definition for RATBASE
argc=1 Additional string ""
Usage: csound [-flags] orchfile scorefile
Legal flags are:
--help print long usage options
.
.
(long list of flags)
.
.
-Z Dither output
flag defaults: csound -s -otest -b1024 -B4096 -m0
Csound Command ERROR: too many arguments

I'm having trouble understanding what this error is about:

argc=1 Additional string ""

Csound Command ERROR: too many arguments

Especially since executing the same commandline from the terminal works perfectly fine:

csound -m0d -+rtaudio=portaudio -odac0 test.orc test.sco
.
.
0 errors in performance
closing device
92 2048 sample blks of 64-bit floats written to dac0

Does anybody have any idea?

I'm using Csound 6.00.1, double samples, OS X 10.6 package, installed on OS X 10.7

I can post the orchestra and score, if needed.

Tobia

Date2013-10-06 17:42
Fromfrancesco
Subject[Csnd] Re: Porting a Python application from 5 to 6
Hello Tobia,
just a little thing waiting for experts ...
with Csound6 You can do this way (example by Victor Lazzarini):

import csnd6

cs = csnd6.csoundCreate(None)
csnd6.csoundSetOption(cs,"-+rtaudio=alsa")
csnd6.csoundSetOption(cs,"-odac")
csnd6.csoundStart(cs)
perf = csnd6.CsoundPerformanceThread(cs)
perf.Play()

csnd6.csoundCompileOrc(cs, stringOrchestra)
csnd6.csoundReadScore(cs, stringScore)

perf.Stop()

To note:
using csoundSetOption You can set one parameter at time;
when csound is started (and eventually the performance thread) remains
active
and You can compile other orchestra and score code without stopping the
performance.

Maybe You can also look at CsoundAC by Gogins (included in the Csound
distribution).

Hope this helps.

ciao,
francesco.




--
View this message in context: http://csound.1045644.n5.nabble.com/Porting-a-Python-application-from-5-to-6-tp5728121p5728127.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-10-06 17:49
Fromfrancesco
Subject[Csnd] Re: Porting a Python application from 5 to 6
and ...
i guess that documentation for CppSound is in CsoundAC doc.
The error about csound command is due to the new way command
parameters are set (i think!); i.e. see the setOption in the previous
message.
Also make sure to don't use space in setOption arguments!

ciao,
francesco.




--
View this message in context: http://csound.1045644.n5.nabble.com/Porting-a-Python-application-from-5-to-6-tp5728121p5728128.html
Sent from the Csound - General mailing list archive at Nabble.com.