[chuck-users] playing raw audio files

mike clemow gelfmuse at gmail.com
Mon Oct 5 15:02:29 EDT 2009


Hi,

To be fair, all my Python script did was remove the first five lines
of text from the file.  ;-)

ChucK's FileIO objects (at the time I was using them) dealt best with
files consisting solely of numbers.  If you can get your file to be
nothing by whitespace-separated numbers, it's a breeze.  I read
everything in as a float whether it was one or not ("3.0" vs. "3"),
which makes life slightly easier.

One thing that is kind of crazy but totally possible now, is to use a
Unix FIFO pipe as input to your ChucK script.  If you set it up
correctly, you can have a Python script write nicely-formatted data to
your FIFO pipe file and ChucK can read from it as it comes.  That way
you can use Python string processing as a stage in your file input to
ChucK.  It's a bit hackish, but I've done it before and it totally
works.

Look up the Unix command "mkfifo".

I should write a tutorial...

Good luck,
Mike

On Sat, Oct 3, 2009 at 7:54 PM, Andrew C. Smith <acsmith at willamette.edu> wrote:
> I think I understand what you're trying to do here. Have you tried
> WavIn at all, though? It's more general than SndBuf.
>
> Mike Clemow did something like this with SPEAR files, and he had to
> write a Python script to do the string parsing and everything. Just
> because of ChucK's limited string functionality, this may be the best
> way to go. If you get it synchronized with OSC it would make it even
> smoother.
>
> Andrew
>
> On Sat, Oct 3, 2009 at 7:40 PM, Renato Fabbri <renato.fabbri at gmail.com> wrote:
>> i beg for a clue.
>> here is the thing i've playing with,  its a "python macro interpreter
>> -- rythmic chuck sample player":
>>
>> svn co http://svn.assembla.com/svn/audioexperiments/ABeatDetector
>>
>> (browser:
>> http://trac.assembla.com/audioexperiments/browser/ABeatDetector
>> )
>>
>> And now i've been wishing to play some raw audio files (actually, i
>> want to read system files as raw audio).
>>
>> I will write a python scritpt to open raw and write as .wav files for
>> chuck to open for i am not able to open this files as audio directly
>> in chuck.
>>
>> any idea?
>> ciao,
>> rf
>>
>>
>>
>>
>>
>>
>> 2009/10/2 Renato Fabbri <renato.fabbri at gmail.com>
>>>
>>> Hi List,
>>>
>>> I didnt figure out how to read/play raw audio files in chuck, and didn't find any doc either.
>>>
>>> say i want to read a mono "rawsound.raw" as 16bit samples and 8kHz sample rate (say playback sample rate is determined beforehand).
>>>
>>> Is there a way to read and play such a raw audioo data or should i need to convert to wav or similar?
>>>
>>> best,
>>> rf
>>>
>>>
>> _______________________________________________
>> chuck-users mailing list
>> chuck-users at lists.cs.princeton.edu
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>



-- 
http://michaelclemow.com
http://semiotech.org


More information about the chuck-users mailing list