[chuck-users] Is it possible to get mp3 output instead of wav?

Kassen signal.automatique at gmail.com
Thu Oct 2 06:18:57 EDT 2008

Hey, Manish!

   My first post here. I stumbled on chuck this morning and have not been
>> able to take my hands off it.. its fun!! While going through the manual I
>> found chuck can write a Wav file to disk, can it also write an .mp3 file? I
>> searched through the chuck-users archives messages but found no direct
>> response.
Short answer; no. The thing is that compressed files like MP3 and so on are
a lot more complicated then .wav, .aiff, and so on. These last come down to
a simple train of numbers expressing the amplitude of the contained wave at
points in time, MP3 on the other hand is more like a description of how to
recreate the sound in a way that will seem (almost) the same to human ears.
So; it's a lot more complicated and harder on the CPU to "record to mp3".
Basically recording to MP3 comes down to figuring out what the wave would
be, encoding that to MP3 and writing the MP3 to disc. This is not to say it
would be impossible to do that in the future but it does explain why we
don't have it.

You can of course still encode the .wav to MP3 yourself in your favourite
editor, then delete the .wav for easier storage or for sharing your sounds
with your friends without cloging your whole connection with large files.

>> Also, I was curious if chuck can read in from a mp3 file. If not, are you
>> aware of a command line tool that can convert from mp3 to wav and then feed
>> into chuck (that's assuming wav files can be chucked). One of the reasons to
>> try something like above is to make my own karaoke files (20-30 of them),
>> but all my songs are mp3. I was planning to use chuck to do some frequency
>> filtering to achieve karaoke effect and then possibly add some computer
>> generated sounds to create a mix.
Right now I see two options. You could decompress your files to waves (for
example VLC has a "transcode wizard" that will do this, WinAmp can be set to
output to wave files instead of your soundcard and of course any decent
audio editor can save to .wav) then load those in a SndBuf UGen for playback
in ChucK.

You could also get one of the various programs that can route audio between
programs and link the output of your MP3 player to the input (adc) of ChucK
for further realtime treatment. What program you use for this will depend on
your OS. For Linux there is Jack, Mac has Soundflower... and for Windows I
don't know for sure what the best choise would be because I have a soundcard
that will do this for me so I didn't look into that too deeply.

There is no such thing as directly sending a wave file to ChucK; you can
either load the file in a SndBuf and tell it how and when to play back or
you can send a audio stream into ChucK.

I hope that clarifies?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20081002/b3b50ab8/attachment-0001.html>

More information about the chuck-users mailing list