[chuck-users] snd file writing

Kassen signal.automatique at gmail.com
Thu Sep 30 16:59:52 EDT 2010

2010/9/30 Daniel Trueman <dtrueman at princeton.edu>

> i just want the opposite of SndBuf.read(); want to be able to open a file
> and write to it all at once, even if it causes hiccups in the VM. but as far
> as i can tell it's not possible.

Got it.

> i'm pretty sure i can cram samples into SndBuf using valueAt, doing the
> opposite of what we do now to load samples into LiSa, but i haven't tried
> that either... so maybe it's all a big mess.
>From memory (mine, I mean, not ChucK's) I don't think you can. For LiSa
valueAt() is read/write and for SndBuf I think it's read only.

I think it will have to be a fileIO with some function that formats the
numbers from the LiSa to stick to some audio file format. Might be easy
enough for raw PCM file though you will have to convert the floats to ints.
I heard bad things about implementing the .wav format yourself. I'm not sure
this would actually be easier than having LiSa call libsndfile in C++. This
is, after all, what libsndfile is supposed to do and we already support it.
I imagine that you would be quite sick, quite soon, of turning raw files
into something useful in your wave editor.

It's hard for me to say as I have very little C++ experience.

We could also wonder what the most general solution to this would be as a
potential new feature. Right now I think LiSa is the only build-in thing
that really records anything we might like to save. We could also have a
function that would turn a array of floats into a wave file, give LiSa
the possibility of returning a array like that and also add that to anything
that records that we think of in the future? That sounds more complicated
and I'm not sure it's so much more versatile that it makes sense.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20100930/62b133ae/attachment.html>

More information about the chuck-users mailing list