Re: [Bluemusic-users] python script and soundfile lengths
Brought to you by:
kunstmusik
From: Steven Y. <ste...@gm...> - 2007-10-28 16:26:16
|
Hi Peiman, Because you are using the python object, you can use Java classes like you would any other Python class. I have in blue a utility class called SoundFileUtilities which has a method which can, given a string filename, return the duration of the soundfile. This depends on the soundFile being able to be read by JavaSound. To use it, use this code: from blue.utility import SoundFileUtilities dur = SoundFileUtilities.getDurationInSeconds("/path/to/file.wav") If you are using AIFF or AIFC files, python has a built-in module that I saw is in the Jython distribution called aifc: http://docs.python.org/lib/module-aifc.html There is a wave module in my python 2.5 distribution but I do not see one with Jython. You could try taking the wave.py file from a regular python distribution and putting it in blue/lib/pythonLib or ~/.blue/pythonLib to see if it will run with Jython. Hope that helps! steven On 10/28/07, peiman <pei...@gm...> wrote: > > Hello all, > > I was wondering if there is a way to pass the length of a sound-file to the > python object (so that it is placed as p-field 3 (am I correct to think that > macros won't work in blue?). I am making a script that reads samples from a > directory and makes a note for each, but the note needs to be exactly the > same length as, or shorter than the length of the samples, to avoid clicks > (using an inbuilt envelope generator). > > Or maybe there is a python module that can get information about > sound-files? > > Many Thanks > Peiman > -- > View this message in context: http://www.nabble.com/python-script-and-soundfile-lengths-tf4706575.html#a13452353 > Sent from the Csound - Blue - User mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Bluemusic-users mailing list > Blu...@li... > https://lists.sourceforge.net/lists/listinfo/bluemusic-users > |