Csound Csound-dev Csound-tekno Search About

[Cs-dev] Fw: Csound API Question?

Date2010-10-10 22:55
From"Art Hunkins"
Subject[Cs-dev] Fw: Csound API Question?
Victor,

I tried one further test:

I copied a sound file, KayIntro.ogg, to the root directory of my Activity, 
and changed the appropriate line below to:
cs.SetChannel("filename1", "KayIntro.ogg")
I also tried:
cs.SetChannel("filename1", KayIntro.ogg)

The filename still didn't get through to chnget in Csound.

Art Hunkins

----- Original Message ----- 
From: "Art Hunkins" 
To: "Developer discussions" 
Sent: Sunday, October 10, 2010 5:30 PM
Subject: Re: [Cs-dev] Csound API Question?


> Victor,
>
> With this change (at your suggestion):
> def choose(self, widget):
>  chooser = ObjectChooser(self, what_filter=mime.GENERIC_TYPE_AUDIO)
>  result = chooser.run()
>  if result == gtk.RESPONSE_ACCEPT:
>    jobject = chooser.get_selected_object()
>    if jobject and jobject.file_path:
>      filename1 = jobject.file_path
>      print 'FileName = ', filename1
>      cs.SetChannel("filename1", "abba")
>
> The "FileName =" line prints a correct (ogg) filename. Obviously the 
> correct filename/path has been located.
>
> In my Csound instrument:
> Sname   chnget "filename1"
> puts Sname, 1
>
> puts still prints a blank, and my program continues to treat the returned 
> string as "0".
>
> Meanwhile, there error messages have disappeared:
>>> File "/usr/lib/python2.6/site-packages/csnd.py", line 1736, in
>>> SetChannel
>>> return _csnd.Csound_SetChannel(self, *args)
>>> NotImplementedError: Wrong number of arguments for overloaded function
>>> 'Csound_SetChannel'.
>>> Possible C/C++ prototypes are:
>>> SetChannel(Csound *,char const *,double)
>>> SetChannel(Csound *,char const *,char const *)
>
> Thanks again -
>
> Art Hunkins
>
> ----- Original Message ----- 
> From: "Victor Lazzarini" 
> To: "Art Hunkins" ; "Developer discussions" 
> 
> Sent: Sunday, October 10, 2010 5:08 AM
> Subject: Re: [Cs-dev] Csound API Question?
>
>
>>I think this means that one of the arguments is of the wrong type,
>> which means.
>> jobject.file_path. This line in your printed messages
>>
>> FileName =
>>
>> seems to indicate that it is not a string and the line
>>
>> print 'FileName = ', filename1
>>
>> is not printing it.
>>
>> Try, just to test it, placing a string (any) instead of that argument
>> and see if you get
>> a result.
>>
>> Victor
>>
>>> File "/usr/lib/python2.6/site-packages/csnd.py", line 1736, in
>>> SetChannel
>>> return _csnd.Csound_SetChannel(self, *args)
>>> NotImplementedError: Wrong number of arguments for overloaded function
>>> 'Csound_SetChannel'.
>>> Possible C/C++ prototypes are:
>>> SetChannel(Csound *,char const *,double)
>>> SetChannel(Csound *,char const *,char const *)
>>>
>>> I feel I've taken a step backwards. At the same time, I'm very
>>> grateful for
>>> your enlightenment (or for that of any other more technically astute
>>> Csounder than I).
>>>
>>> (I wonder if the filename is of the wrong type or some such, needing
>>> a cast
>>> of some sort?)
>>>
>>> Ever appreciative -
>>>
>>> Art Hunkins
>>>
>>> ----- Original Message -----
>>> From: "Victor Lazzarini" 
>>> To: "Developer discussions" 
>>> Sent: Friday, October 08, 2010 7:15 PM
>>> Subject: Re: [Cs-dev] Csound API Question?
>>>
>>>
>>>> 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
>>>> 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
>> 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

Date2010-10-11 08:16
FromOeyvind Brandtsegg
SubjectRe: [Cs-dev] Fw: Csound API Question?
I think there is something wrong with string chn channels,
so that you're unable to set the value of a string chn channel from the API.
Oeyvind

2010/10/10 Art Hunkins :
> Victor,
>
> I tried one further test:
>
> I copied a sound file, KayIntro.ogg, to the root directory of my Activity,
> and changed the appropriate line below to:
> cs.SetChannel("filename1", "KayIntro.ogg")
> I also tried:
> cs.SetChannel("filename1", KayIntro.ogg)
>
> The filename still didn't get through to chnget in Csound.
>
> Art Hunkins
>
> ----- Original Message -----
> From: "Art Hunkins" 
> To: "Developer discussions" 
> Sent: Sunday, October 10, 2010 5:30 PM
> Subject: Re: [Cs-dev] Csound API Question?
>
>
>> Victor,
>>
>> With this change (at your suggestion):
>> def choose(self, widget):
>>  chooser = ObjectChooser(self, what_filter=mime.GENERIC_TYPE_AUDIO)
>>  result = chooser.run()
>>  if result == gtk.RESPONSE_ACCEPT:
>>    jobject = chooser.get_selected_object()
>>    if jobject and jobject.file_path:
>>      filename1 = jobject.file_path
>>      print 'FileName = ', filename1
>>      cs.SetChannel("filename1", "abba")
>>
>> The "FileName =" line prints a correct (ogg) filename. Obviously the
>> correct filename/path has been located.
>>
>> In my Csound instrument:
>> Sname   chnget "filename1"
>> puts Sname, 1
>>
>> puts still prints a blank, and my program continues to treat the returned
>> string as "0".
>>
>> Meanwhile, there error messages have disappeared:
>>>> File "/usr/lib/python2.6/site-packages/csnd.py", line 1736, in
>>>> SetChannel
>>>> return _csnd.Csound_SetChannel(self, *args)
>>>> NotImplementedError: Wrong number of arguments for overloaded function
>>>> 'Csound_SetChannel'.
>>>> Possible C/C++ prototypes are:
>>>> SetChannel(Csound *,char const *,double)
>>>> SetChannel(Csound *,char const *,char const *)
>>
>> Thanks again -
>>
>> Art Hunkins
>>
>> ----- Original Message -----
>> From: "Victor Lazzarini" 
>> To: "Art Hunkins" ; "Developer discussions"
>> 
>> Sent: Sunday, October 10, 2010 5:08 AM
>> Subject: Re: [Cs-dev] Csound API Question?
>>
>>
>>>I think this means that one of the arguments is of the wrong type,
>>> which means.
>>> jobject.file_path. This line in your printed messages
>>>
>>> FileName =
>>>
>>> seems to indicate that it is not a string and the line
>>>
>>> print 'FileName = ', filename1
>>>
>>> is not printing it.
>>>
>>> Try, just to test it, placing a string (any) instead of that argument
>>> and see if you get
>>> a result.
>>>
>>> Victor
>>>
>>>> File "/usr/lib/python2.6/site-packages/csnd.py", line 1736, in
>>>> SetChannel
>>>> return _csnd.Csound_SetChannel(self, *args)
>>>> NotImplementedError: Wrong number of arguments for overloaded function
>>>> 'Csound_SetChannel'.
>>>> Possible C/C++ prototypes are:
>>>> SetChannel(Csound *,char const *,double)
>>>> SetChannel(Csound *,char const *,char const *)
>>>>
>>>> I feel I've taken a step backwards. At the same time, I'm very
>>>> grateful for
>>>> your enlightenment (or for that of any other more technically astute
>>>> Csounder than I).
>>>>
>>>> (I wonder if the filename is of the wrong type or some such, needing
>>>> a cast
>>>> of some sort?)
>>>>
>>>> Ever appreciative -
>>>>
>>>> Art Hunkins
>>>>
>>>> ----- Original Message -----
>>>> From: "Victor Lazzarini" 
>>>> To: "Developer discussions" 
>>>> Sent: Friday, October 08, 2010 7:15 PM
>>>> Subject: Re: [Cs-dev] Csound API Question?
>>>>
>>>>
>>>>> 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
>>>>> 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
>>> 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

Date2010-10-11 10:11
FromVictor Lazzarini
SubjectRe: [Cs-dev] Fw: Csound API Question?
I have tested the string channels in the latest Csound and there is  
nothing wrong with them. There has been
no change from 5.10 to 5.12+ in this regard. One thing that might be  
happening is that you are setting
the channel after the instrument in question has started. I don't  
think that will work because the code
you require might be running in i-time. Try and make sure the  
instrument  runs after the channel has been
set.

Victor


On 11 Oct 2010, at 08:16, Oeyvind Brandtsegg wrote:

> I think there is something wrong with string chn channels,
> so that you're unable to set the value of a string chn channel from  
> the API.
> Oeyvind
>
> 2010/10/10 Art Hunkins :
>> Victor,
>>
>> I tried one further test:
>>
>> I copied a sound file, KayIntro.ogg, to the root directory of my  
>> Activity,
>> and changed the appropriate line below to:
>> cs.SetChannel("filename1", "KayIntro.ogg")
>> I also tried:
>> cs.SetChannel("filename1", KayIntro.ogg)
>>
>> The filename still didn't get through to chnget in Csound.
>>
>> Art Hunkins
>>
>> ----- Original Message -----
>> From: "Art Hunkins" 
>> To: "Developer discussions" 
>> Sent: Sunday, October 10, 2010 5:30 PM
>> Subject: Re: [Cs-dev] Csound API Question?
>>
>>
>>> Victor,
>>>
>>> With this change (at your suggestion):
>>> def choose(self, widget):
>>>  chooser = ObjectChooser(self, what_filter=mime.GENERIC_TYPE_AUDIO)
>>>  result = chooser.run()
>>>  if result == gtk.RESPONSE_ACCEPT:
>>>    jobject = chooser.get_selected_object()
>>>    if jobject and jobject.file_path:
>>>      filename1 = jobject.file_path
>>>      print 'FileName = ', filename1
>>>      cs.SetChannel("filename1", "abba")
>>>
>>> The "FileName =" line prints a correct (ogg) filename. Obviously the
>>> correct filename/path has been located.
>>>
>>> In my Csound instrument:
>>> Sname   chnget "filename1"
>>> puts Sname, 1
>>>
>>> puts still prints a blank, and my program continues to treat the  
>>> returned
>>> string as "0".
>>>
>>> Meanwhile, there error messages have disappeared:
>>>>> File "/usr/lib/python2.6/site-packages/csnd.py", line 1736, in
>>>>> SetChannel
>>>>> return _csnd.Csound_SetChannel(self, *args)
>>>>> NotImplementedError: Wrong number of arguments for overloaded  
>>>>> function
>>>>> 'Csound_SetChannel'.
>>>>> Possible C/C++ prototypes are:
>>>>> SetChannel(Csound *,char const *,double)
>>>>> SetChannel(Csound *,char const *,char const *)
>>>
>>> Thanks again -
>>>
>>> Art Hunkins
>>>
>>> ----- Original Message -----
>>> From: "Victor Lazzarini" 
>>> To: "Art Hunkins" ; "Developer discussions"
>>> 
>>> Sent: Sunday, October 10, 2010 5:08 AM
>>> Subject: Re: [Cs-dev] Csound API Question?
>>>
>>>
>>>> I think this means that one of the arguments is of the wrong type,
>>>> which means.
>>>> jobject.file_path. This line in your printed messages
>>>>
>>>> FileName =
>>>>
>>>> seems to indicate that it is not a string and the line
>>>>
>>>> print 'FileName = ', filename1
>>>>
>>>> is not printing it.
>>>>
>>>> Try, just to test it, placing a string (any) instead of that  
>>>> argument
>>>> and see if you get
>>>> a result.
>>>>
>>>> Victor
>>>>
>>>>> File "/usr/lib/python2.6/site-packages/csnd.py", line 1736, in
>>>>> SetChannel
>>>>> return _csnd.Csound_SetChannel(self, *args)
>>>>> NotImplementedError: Wrong number of arguments for overloaded  
>>>>> function
>>>>> 'Csound_SetChannel'.
>>>>> Possible C/C++ prototypes are:
>>>>> SetChannel(Csound *,char const *,double)
>>>>> SetChannel(Csound *,char const *,char const *)
>>>>>
>>>>> I feel I've taken a step backwards. At the same time, I'm very
>>>>> grateful for
>>>>> your enlightenment (or for that of any other more technically  
>>>>> astute
>>>>> Csounder than I).
>>>>>
>>>>> (I wonder if the filename is of the wrong type or some such,  
>>>>> needing
>>>>> a cast
>>>>> of some sort?)
>>>>>
>>>>> Ever appreciative -
>>>>>
>>>>> Art Hunkins
>>>>>
>>>>> ----- Original Message -----
>>>>> From: "Victor Lazzarini" 
>>>>> To: "Developer discussions" 
>>>>> Sent: Friday, October 08, 2010 7:15 PM
>>>>> Subject: Re: [Cs-dev] Csound API Question?
>>>>>
>>>>>
>>>>>> 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
>>>>>> 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
>>>> 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
> 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