[chuck-users] record audio directly into sndbuf?

Matt Diamond mdiamond at jhu.edu
Wed Mar 18 20:05:45 EDT 2009

My apologies if this question is silly, I'm a bit of a programming  

I'd like to create a patch wherein I could record a few seconds of  
audio from the adc (mic input), then play random segments of that  
audio back. Seems simple enough, but I'm having trouble mastering the  
art of recording sound in ChucK. Ideally, I'd like to use sndbuf to  
store the audio in a temporary buffer, though I'm wondering if my only  
option is to use WvOut to write the audio to an actual file.

I'm not even doing very well using WvOut to record... I'd like the  
recording to be triggered by a button toggle (or even just triggered  
by a normal button with a set recording duration). I think I'm fairly  
comfortable with the MAUI button object, but I'm not sure how to  
implement triggered recording. I've seen examples that merely set up  
an adc => WvOut w => blackhole configuration, then tell the program to  
just do this for 5 seconds and then close the file, but I'd like  
something where I could have the shred running, and then activate a  
recording process when the button is pushed. I've tried implementing  
this with a while (button.state()) loop inside of an infinite time  
loop, but it usually ends up crashing. I also thought I saw something  
about a w.record operation in the ChucK wiki, but I didn't see  
anything about this function in the documentation.

Anyway, sorry that this is so unfocused... I'm just not sure how to  
even start approaching the problem. Bottom line: can I use sndbuf to  
record live audio, and if not, how can I use WvOut to do this?

Matt Diamond

More information about the chuck-users mailing list