Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] Fw: Csound API Question?

Date2010-11-08 17:41
From"Art Hunkins"
SubjectRe: [Cs-dev] Fw: Csound API Question?
I get this message:

diskinfo can't open 
/home/olpc/.sugar/default/data/f70f03b1-fe40-44e6-9d75-5ef274cf0ad2.wav

The file path is correct, and refers to beats.wav from the Csound distro 
(copied to my XO-1.5 via the Journal).

My file chooser function is:

 def choose1(self, widget):
  chooser =  ObjectChooser(parent=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:
      self.filename[0] = str(jobject.file_path)
#      open(self.filename[0]).read()
#      open(object.file_path).read()
  else:
    self.filename[0] = "0"

I receive the message whether I use either of the "open" lines or neither.

The filename is being passed (successfully, as "file1") to my .csd by this 
line:

   self.w.set_filechannel("file1", self.filename[0])

FWIW, I get the following WARNING earlier in my log:

1289234354.334491 WARNING root: Invocation of ObjectChooser() has deprecated 
parameters.
/usr/lib/python2.6/site-packages/dbus/connection.py:242: DeprecationWarning: 
object.__init__() takes no parameters
  super(Connection, self).__init__(*args, **kwargs)
1289234358.752408 WARNING root: DSObject was deleted without cleaning up 
first. Call DSObject.destroy() before disposing it.

I've assumed that this has nothing to do with my problem, but perhaps I am 
wrong. The *complete* ObjectChooser() function is listed above. (The 
ObjectChooser() call is in the format recommended by a member of the 
sugar-dev list.)

Art Hunkins

----- Original Message ----- 
From: "Victor Lazzarini" 
To: "Art Hunkins" ; "Developer discussions" 

Sent: Monday, November 08, 2010 3:11 AM
Subject: Re: [Cs-dev] Fw: Csound API Question?


> but what error messages do you get?
>
> Victor
> On 7 Nov 2010, at 23:08, Art Hunkins wrote:
>
>> In my FileMix XO activity, I've finally got Python/Sugar to pass 
>> filenames
>> referenced by the Journal, to my .csd (via chnget).
>>
>> Now that the filename is gotten, Csound can't manage to do anything  with 
>> it;
>> neither diskin2 nor diskinfo (via filenchnls, filelen, filepeak) can 
>> open it
>> to read it.
>>
>> Is there something that needs additionally to be done in Python or 
>> Csound to
>> open the file for reading?
>>
>> I've tested both an OGG file created by the Record activity and the 
>> stereo
>> beats.wav from the Csound distro. Accessed from the Journal both  play 
>> fine
>> from both the Browse and Jukebox activities.
>>
>> Art Hunkins
>>
>> ----- Original Message -----
>> From: "Art Hunkins" 
>> To: 
>> Sent: Friday, November 05, 2010 1:39 PM
>> Subject: Re: [Cs-dev] Fw: Csound API Question?
>>
>>
>>> Victor,
>>>
>>> The str() conversion you suggested works just fine; problem solved -
>>> thanks.
>>>
>>> One more question:
>>> I need to pass a value (val) to my Choose() function, something  like 
>>> this:
>>>
>>>  but5 = win.cbbutton(nbox, self.choose(val = 0), "1")
>>>
>>> def choose(self, widget, val):
>>> 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:
>>>     filename = jobject.file_path
>>>     self.filenames[val] = str(filename)
>>>
>>> This doesn't work; I get messages about choose() not being passed the
>>> correct number of arguments (as in, I passed two instead of the three
>>> arguments expected, whatever that means).
>>>
>>> Can you suggest a solution please? (I'm happy to modify my  csndsugui 
>>> code
>>> if necessary.)
>>>
>>> Art Hunkins
>>
>>
>> ------------------------------------------------------------------------------
>> The Next 800 Companies to Lead America's Growth: New Video Whitepaper
>> David G. Thomson, author of the best-selling book "Blueprint to a
>> Billion" shares his insights and actions to help propel your
>> business during the next growth cycle. Listen Now!
>> http://p.sf.net/sfu/SAP-dev2dev
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 


------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-11-08 18:27
FromVictor.Lazzarini@nuim.ie
SubjectRe: [Cs-dev] Fw: Csound API Question?
AttachmentsNone  None  None  None  

Date2010-11-08 19:50
FromMichael Gogins
SubjectRe: [Cs-dev] Fw: Csound API Question?
You should also check the specific types of the filenames provided and
of the argument expected. Sometimes there are different kinds of
strings, or objects that evaluate to strings in some contexts and not
in others.

Hope this helps,
Mike

On Mon, Nov 8, 2010 at 1:27 PM,   wrote:
> There might be two reasons for this
>
> 1) the file does not exist
> 2) you don't have the permissions to it
>
> Have you tried hardcoding the filename into csound to see if it opens it?
>
> Victor
>
> ----- Original Message -----
> From: Art Hunkins 
> Date: Monday, November 8, 2010 5:42 pm
> Subject: Re: [Cs-dev] Fw: Csound API Question?
> To: Victor Lazzarini , Developer discussions
> 
>
>> I get this message:
>>
>> diskinfo can't open
>> /home/olpc/.sugar/default/data/f70f03b1-fe40-44e6-9d75-
>> 5ef274cf0ad2.wav
>> The file path is correct, and refers to beats.wav from the
>> Csound distro
>> (copied to my XO-1.5 via the Journal).
>>
>> My file chooser function is:
>>
>>  def choose1(self, widget):
>>   chooser =  ObjectChooser(parent=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:
>>       self.filename[0] =
>> str(jobject.file_path)#
>> open(self.filename[0]).read()#
>> open(object.file_path).read()  else:
>>     self.filename[0] = "0"
>>
>> I receive the message whether I use either of the "open" lines
>> or neither.
>>
>> The filename is being passed (successfully, as "file1") to my
>> .csd by this
>> line:
>>
>>    self.w.set_filechannel("file1", self.filename[0])
>>
>> FWIW, I get the following WARNING earlier in my log:
>>
>> 1289234354.334491 WARNING root: Invocation of ObjectChooser()
>> has deprecated
>> parameters.
>> /usr/lib/python2.6/site-packages/dbus/connection.py:242:
>> DeprecationWarning:
>> object.__init__() takes no parameters
>>   super(Connection, self).__init__(*args, **kwargs)
>> 1289234358.752408 WARNING root: DSObject was deleted without
>> cleaning up
>> first. Call DSObject.destroy() before disposing it.
>>
>> I've assumed that this has nothing to do with my problem, but
>> perhaps I am
>> wrong. The *complete* ObjectChooser() function is listed above.
>> (The
>> ObjectChooser() call is in the format recommended by a member of
>> the
>> sugar-dev list.)
>>
>> Art Hunkins
>>
>> ----- Original Message -----
>> From: "Victor Lazzarini" 
>> To: "Art Hunkins" ; "Developer
>> discussions"
>> 
>> Sent: Monday, November 08, 2010 3:11 AM
>> Subject: Re: [Cs-dev] Fw: Csound API Question?
>>
>>
>> > but what error messages do you get?
>> >
>> > Victor
>> > On 7 Nov 2010, at 23:08, Art Hunkins wrote:
>> >
>> >> In my FileMix XO activity, I've finally got Python/Sugar to
>> pass
>> >> filenames
>> >> referenced by the Journal, to my .csd (via chnget).
>> >>
>> >> Now that the filename is gotten, Csound can't manage to do
>> anything  with
>> >> it;
>> >> neither diskin2 nor diskinfo (via filenchnls, filelen,
>> filepeak) can
>> >> open it
>> >> to read it.
>> >>
>> >> Is there something that needs additionally to be done in
>> Python or
>> >> Csound to
>> >> open the file for reading?
>> >>
>> >> I've tested both an OGG file created by the Record activity
>> and the
>> >> stereo
>> >> beats.wav from the Csound distro. Accessed from the Journal
>> both  play
>> >> fine
>> >> from both the Browse and Jukebox activities.
>> >>
>> >> Art Hunkins
>> >>
>> >> ----- Original Message -----
>> >> From: "Art Hunkins" 
>> >> To: 
>> >> Sent: Friday, November 05, 2010 1:39 PM
>> >> Subject: Re: [Cs-dev] Fw: Csound API Question?
>> >>
>> >>
>> >>> Victor,
>> >>>
>> >>> The str() conversion you suggested works just fine; problem
>> solved -
>> >>> thanks.
>> >>>
>> >>> One more question:
>> >>> I need to pass a value (val) to my Choose() function,
>> something  like
>> >>> this:
>> >>>
>> >>>  but5 = win.cbbutton(nbox, self.choose(val = 0), "1")
>> >>>
>> >>> def choose(self, widget, val):
>> >>> 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:
>> >>>     filename = jobject.file_path
>> >>>     self.filenames[val] = str(filename)
>> >>>
>> >>> This doesn't work; I get messages about choose() not being
>> passed the
>> >>> correct number of arguments (as in, I passed two instead of
>> the three
>> >>> arguments expected, whatever that means).
>> >>>
>> >>> Can you suggest a solution please? (I'm happy to modify
>> my  csndsugui
>> >>> code
>> >>> if necessary.)
>> >>>
>> >>> Art Hunkins
>> >>
>> >>
>> >> --------------------------------------------------------------
>> ----------------
>> >> The Next 800 Companies to Lead America's Growth: New Video
>> Whitepaper>> David G. Thomson, author of the best-selling book
>> "Blueprint to a
>> >> Billion" shares his insights and actions to help propel your
>> >> business during the next growth cycle. Listen Now!
>> >> http://p.sf.net/sfu/SAP-dev2dev
>> >> _______________________________________________
>> >> Csound-devel mailing list
>> >> Csound-devel@lists.sourceforge.net
>> >> https://lists.sourceforge.net/lists/listinfo/csound-devel
>> >
>>
>>
>> -----------------------------------------------------------------
>> -------------
>> The Next 800 Companies to Lead America's Growth: New Video Whitepaper
>> David G. Thomson, author of the best-selling book "Blueprint to
>> a
>> Billion" shares his insights and actions to help propel your
>> business during the next growth cycle. Listen Now!
>> http://p.sf.net/sfu/SAP-dev2dev
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
> National University of Ireland, Maynooth
>
> ------------------------------------------------------------------------------
> The Next 800 Companies to Lead America's Growth: New Video Whitepaper
> David G. Thomson, author of the best-selling book "Blueprint to a
> Billion" shares his insights and actions to help propel your
> business during the next growth cycle. Listen Now!
> http://p.sf.net/sfu/SAP-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net