2008/5/22 AlgoMantra
I'm not 100% sure I understand the concept of
granular synthesis, and I can't afford a book right now, so I'm asking if you guys got an example/demo of the technique which I could study (preferably in ChucK)?
I would lurrrv an example in Chuck too!
Ok, pasted below is a small ChucktudE in grains and blitsaw. First it
synthesises a theme, then it uses grains to manipulate the theme..... Well,
that was the plan. The result is more like "first it synthesises a theme,
then does stuff with it and a ending is bolted on because I got a bit bored
with it and grains are hard to use on themes". :¬)
Still, it demonstrates a few nice tricks with grains and it's a start for
exploration, I hope. I also strongly suspect that requesting and using
voices from LiSa too quickly (a few hundred per second) will crash the whole
VM. Badly. These crashes may also have been caused by some other factor,
there are quite a few variables flying around, after all. Uses some tricks
with time and timing which could be eductational and/or confusing.
==================================
//"A night with LiSa", composed by Kassen
//permision granted to copy for fun and educational value
//No waranties, no refunds; mind your speakers and CPU
//remixing and extending strongly encouraged
<<<"let's pretend we're Bach and base the theme on a name!", "">>>;
float G, E;
43 => Std.mtof => G;
52 => Std.mtof => E;
BlitSaw s => Gain amp => dac;
.8=> s.gain;
dac => LiSa l => dac;
4::second => l.duration;
1 => l.record;
3=> s.harmonics;
3 => amp.op;
SinOsc lfo => amp;
second => lfo.period;
G => s.freq;
second => now;
//use the LFO to cover up clicks in the sound
.25::second => lfo.period;
repeat(8)
{
s.harmonics() + 2 => s.harmonics;
.125::second => now;
}
.5::second => lfo.period;
for (0 => int n; n< 4; n++)
{
s.harmonics() -3 => s.harmonics;
if (n%2) G => s.freq;
else E => s.freq;
.25::second => now;
}
5 => s.harmonics;
2::second => lfo.period;
1::second => now;
//stop recording, disconect blitsaw
0 => l.record;
amp =< dac;
<<<"Now we use simple granualtion to repeat the theme a octave down", "">>>;
100 => int slices;
(l.duration() / slices) / 2 => dur ramprate;
l.rate(0, .5);
l.rate(1, .5);
for (0 => int n; n