Adventures in RPi: programming with Chuck to trigger record depending on loudness

The flyer for our show at Kreuzberg Pavillion

Earlier this week Saturday’s exhibition, The Ability to Fail in Public, was announced. Here’s a non-permanent link to the exhibition.

I’ve been trying to programme the RPi for Time Slides – using ChucK. Somehow I managed to lose both the script I’d written and the doc I’d written detailing the script I’d written. #Fail! (how ironic)

Anyway, this is as far as I’ve got with the ChucK script, in a kind of wild mashup of some ChucK example files and a bit of wizardry (level -10)… I can now print “hello” when the mic registers a particular volume. Now I need to work out how to turn the print command into a record command (through LiSa?) and how then to play this back, and loop subsequent recordings over the top. All before Saturday. Wish me luck, I’ll need it!

—-BEGINS—-

// LiSa might be good for starting recording recording
// and then manipulating the loop
//http://chuck.cs.princeton.edu/doc/program/ugen_full.html

//start getting input from mic, something like…
adc => FFT fft =^ RMS rms => blackhole;

// split mic in ???

// if audio > loudness of X  (RMS) -> record
// set parameters – from loudness script
1024 => fft.size;
// set hann window
Windowing.hann(1024) => fft.window;

// get name
me.arg(0) => string filename;
if( filename.length() == 0 ) “foo.wav” => filename;

// control loop
while( true )
{
// upchuck: take fft then rms
rms.upchuck() @=> UAnaBlob blob;
// print out RMS
if( blob.fval(0) > 0.001 ) {

<<< “hello” >>>;
}
// advance time
fft.size()::samp => now;
}

// play recorded sound on loop

//.channels – (int, READ only) – the number channels on the UGen

//Zero crossing detector. Emits a pulse lasting a single sample at the the zero crossing in the direction of the zero crossing.
//(see examples/zerox.ck)
//this is useful if you want to make it loop without a glitch

—–ENDS—–

In terms of Time Slides #Fail, I managed to get some super recordings last night of Brussels after Belgium won against Portugal in the World Cup. Awesome timing.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s