| For instance the following Python code:
import csnd
cs = csnd.Csound()
cs.Compile("string.csd", "-n")
cs.SetChannel("filename1", "haha")
cs.Perform()
============ string.csd: =========
instr 1
Sname chnget "filename1"
puts Sname, 1
endin
i1 0 1
============= interactive run =======
Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import csnd
>>> cs = csnd.Csound()
>>> cs.Compile("string.csd", "-n")
PortMIDI real time MIDI plugin for Csound
PortAudio real-time audio module for Csound
virtual_keyboard real time MIDI plugin for Csound
0dBFS level = 32768.0
Csound version 5.12 (double samples) Jun 9 2010
libsndfile-1.0.21
UnifiedCSD: string.csd
STARTING FILE
Creating options
Creating orchestra
Creating score
orchname: /var/folders/5P/5PSrqM3mGnCIxRlBhio0cE+++TM/-Tmp-//csound-
gtttlC.orc
scorename: /var/folders/5P/5PSrqM3mGnCIxRlBhio0cE+++TM/-Tmp-//csound-
hz4vNl.sco
rtaudio: PortAudio module enabled ... using callback interface
rtmidi: PortMIDI module enabled
orch compiler:
instr 1
Elapsed time at end of orchestra compile: real: 0.070s, CPU: 0.004s
sorting score ...
... done
Elapsed time at end of score sort: real: 0.152s, CPU: 0.023s
Csound version 5.12 (double samples) Jun 9 2010
0dBFS level = 32768.0
orch now loaded
audio buffered in 1024 sample-frame blocks
not writing to sound disk
SECTION 1:
0
>>> cs.SetChannel("filename1", "haha")
>>> cs.Perform()
new alloc for instr 1:
haha
B 0.000 ..100.000 T100.000 TT100.000 M: 0.0
Score finished in csoundPerform().
2
>>> exit()
inactive allocs returned to freespace
end of score. overall amps: 0.0
overall samples out of range: 0
0 errors in performance
Elapsed time at end of performance: real: 61.690s, CPU: 0.362s
no sound written to disk
==================
NB: there is nothing wrong with the API.
Victor
On 9 Oct 2010, at 00:05, Victor Lazzarini wrote:
> Where is the call to pass the filename to Csound?
>
> Victor
>
> On 8 Oct 2010, at 22:12, Art Hunkins wrote:
>
>> At least I *think* it's an API/communication problem, rather than a
>> Python/pygtk problem.
>>
>> Here's the situation: I'm getting users to click on a Journal entry
>> in Sugar
>> (python 2.6 - Sugar 0.84, FWIW), to identify a user-supplied
>> soundfile to
>> load into diskin2. It's close to working.
>>
>> The Python side:
>> This statement is in the main loop:
>> self.filename1 = "0" (or "" - they both work the same)
>>
>> In the method in question, the Journal selection process seems to be
>> working; the code ends with:
>> self.filename1 = jobject.file_path
>> print 'FileName = ', self.filename1
>> return self.filename1
>>
>> Through the print line, things seem to work; the following line is
>> printed
>> (in the log), with data (filename/path) one would expect:
>> FileName =
>> /home/liveuser/.sugar/default/data/9b3f3023-58f1-44ad-87c3-
>> c19d2a7561ae.ogg
>>
>> (BTW, this is Csound 5.10 with a recent libsndfile that accepts Ogg
>> Vorbis
>> files - of which the above is one.)
>>
>> At this point the filename does not appear to transfer via the API to
>> Csound. The Csound side (within an instrument definition):
>> Sname chnget "filename1"
>> puts Sname, 1
>> i1 strcmp Sname, "0"
>> if i1 == 0 goto cont2
>> Sname = "soundin.1"
>> goto cont2
>>
>> Problem result:
>> 1) puts prints a blank line.
>> 2) strcmp evaluates to "0", which is the "no file name to
>> communicate"
>> value.
>> 3) as a result, the default file, soundin1, is substituted. Here
>> there is
>> always a substitution.
>>
>> Bottom line: the (very long/complicated) filename seems not to be
>> passed.
>> Does anyone know why? (IOW, what am I doing wrong?)
>>
>> TIA for insight -
>>
>> Art Hunkins
>>
>>
>> ------------------------------------------------------------------------------
>> Beautiful is writing same markup. Internet Explorer 9 supports
>> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
>> Spend less time writing and rewriting code and more time creating
>> great
>> experiences on the web. Be a part of the beta today.
>> http://p.sf.net/sfu/beautyoftheweb
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
> Spend less time writing and rewriting code and more time creating
> great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net |