[chuck-users] unclapping music and how to record stereo files.
Ge Wang
gewang at CS.Princeton.EDU
Wed Jul 26 01:11:26 EDT 2006
On Jul 25, 2006, at 2:50 PM, jesus gollonet wrote:
> I've just published in my blog a little exercise in chuck. It's a
> reproduction of "clapping music" by steve reich.
>
> http://www.jesusgollonet.com/blog/?p=133
>
> Although they're in the blog post, I'll put the code and audio in the
> wiki if there is interest.
Cool! Totally!
For fun, here is a modified version that uses shreds and built-in
glottal pops (ahh and ooo). If you want, play with the shift period
and factor, or add a third clapper.
---
// our patch
sndbuf clapper1 => dac.left;
sndbuf clapper2 => dac.right;
// load built-in sounds
"special:glot_ahh" => clapper1.read;
"special:glot_ooo" => clapper2.read;
// the full "clapping music" figure
[.5, .5, 1, .5, 1, 1, .5, 1 ] @=> float seq[];
// length of quarter note
.36::second => dur quarter;
// how many measures per shift
3 => int shift_period;
// how much to shift by (in quarter notes)
.5 => float shift_factor;
// one clapper
fun void clap( sndbuf buffy, int max, float factor )
{
int shifts;
int count;
// infinite time loop
for( ; ; shifts++ )
{
// one measure
for( 0 => count; count < seq.cap(); count++ )
{
// set gain
seq[count] => buffy.gain;
// clap!
0 => buffy.pos;
// let time go by
if( !max || shifts < max || count != (seq.cap() - 1) )
seq[count]::quarter => now;
else
{
<<< "shift!!!", "" >>>;
seq[count]*factor*quarter => now;
0 => shifts;
}
}
}
}
// spork one clapper, shift every shift_period measures
spork ~ clap( clapper1, shift_period, shift_factor );
// spork, no shift
spork ~ clap( clapper2, 0, 0 );
// infinite time loop
while( true ) 1::day => now;
---
Best,
Ge!
More information about the chuck-users
mailing list