[chuck-users] How to read large data files

Mike McGonagle mjmogo at gmail.com
Tue Jan 3 18:16:24 EST 2006

Hello all,

I recently found ChucK, and have started to work with it in putting
together some music. I am trying to use fractal data as a control for
various parameters. I rewrote my fractal program in ChucK, but because
of how the floats are of limited percision, I am getting different
results than the same program written in C.

I had thought about two (three?) different approaches to solving the
problem, the first would be to use my C program to generate the
fractal data, and write it to a file. My program can write this data
to an audio file, which would then be imported into ChucK. BUT, it
would appear that it is not possible to access the underlying sample
data from a 'sndbuf' object.

I had looked to see if there was a generic function to read raw data
from a disk file, but could not find anything. Also, would this be
practical to read, as these datafile can have as many as 20,000
samples per file, these into an Array? How much overhead is there in
using an array of floating point values on the order of 20,000

The last idea would be to write a UGEN object in C++, and then
recompile ChucK to include this new object. Is there a limitation to
how many outputs a UGEN can produce in a single iteration? Several of
the fractals that I am working with output more than one value per
iteration (each output values represents a different variable in the
fractal algorithm).

Any suggestions would be appreciated. Thanks.

More information about the chuck-users mailing list