Skip to content

Instantly share code, notes, and snippets.

@Eugene-Y
Created November 16, 2013 23:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Eugene-Y/7506864 to your computer and use it in GitHub Desktop.
Save Eugene-Y/7506864 to your computer and use it in GitHub Desktop.
ChucK course, assignment #3
SndBuf2 snare => NRev sRev => Pan2 pSnare => dac;
SndBuf2 crash => NRev sRev3 => dac;
SndBuf2 kick => Pan2 pKick => dac;
SndBuf2 hihat => NRev sRev2 => Pan2 pHihat => dac;
SinOsc sine => dac;
me.dir() => string path;
<<<path>>>;
<<<"">>>;
<<<"-------------------- Taliban Cola -------------------- ">>>;
<<<"">>>;
"/audio/snare_01.wav" => string snareS;
"/audio/kick_03.wav" => string kickS;
string hihatS[4];
"/audio/hihat_01.wav" => hihatS[0];
"/audio/hihat_02.wav" => hihatS[1];
"/audio/hihat_03.wav" => hihatS[2];
"/audio/hihat_04.wav" => hihatS[3];
// instead of modulo
int beatMap;
10::second => dur intro;
// destruction starts at
50::second => dur end;
7 => int beatBase;
5 => int beatMult;
80 => float tempo;
13 => float deltaT;
6 => float deltaF;
0::ms => dur duration;
1 => int kickGroup;
1 => int snareGroup;
1 => int hihatGroup;
1 => int silence;
0 => int silenceRand;
1 => float grain;
0.0 => pSnare.pan;
0.0 => pKick.pan;
0.85 => pHihat.pan;
kick.samples() => int kickSamples;
Math.random2f(100, 800) => float sineF;
<<<"Tramsnittin at", sineF>>>;
//-----------------------------------------------------------
while(grain > 0)
{
0.0 => sRev.mix;
0.05 => sRev2.mix;
0.3 => sRev3.mix;
0 => crash.gain;
path + snareS => string snareName;
snareName => snare.read;
path + kickS => string kickName;
kickName => kick.read;
Math.random2(0, hihatS.cap()-1) => int wHihat;
hihatS[wHihat] => string hihatPath;
path + hihatPath => string hihatName;
hihatName => hihat.read;
hihatName => crash.read;
//------ Random loud groups ----------------------------------
Math.random2(0,100) => int crashRand;
Math.random2(0,100) => int snareRand;
if(snareRand > 90)
{
-1*snareGroup => snareGroup;
}
//if(snareGroup > 0 && silence == -1 && silenceRand != 198)
if(snareGroup > 0)
{
Math.random2f(0.08,0.15) => snare.gain;
}
//if(snareGroup < 0 && silence == -1 && silenceRand != 198)
if(snareGroup < 0)
{
Math.random2f(0.2,0.35) => snare.gain;
}
Math.random2(0,100) => int hihatRand;
if(hihatRand > 90)
{
-1*hihatGroup => hihatGroup;
}
if(hihatGroup > 0)
{
Math.random2f(0.02,0.035) => hihat.gain;
}
else
{
0 => hihat.gain;
}
Math.random2(0,100) => int kickRand;
if(kickRand > 95)
{
-1*kickGroup => kickGroup;
}
//if(kickGroup == 1 && silence == -1 && silenceRand != 197)
if(kickGroup == 1)
{
Math.random2f(0.0,0.1) => kick.gain;
}
//--------------------------------------------------------------------
// sequencer management
if(beatMap == beatBase*beatMult)
{
1 => beatMap;
}
//-------- Main percussion texture --------------------------------------------
Math.random2(100, 7000) => int snarePos => snare.pos;
Math.random2f(0.75, 16) => snare.rate;
Math.random2f(-1.0, 1.0) => pSnare.pan;
Math.random2(0,1000) => int kickPos => kick.pos;
Math.random2f(0.90,1.2) => kick.rate;
Math.random2f(-0.4,0.4) => pKick.pan;
Math.random2(0,100) => int crashPos => crash.pos;
Math.random2f(0.1,1) => crash.rate;
Math.random2f(1.0,1.01) => hihat.rate;
//----- Radio randomization -------------------------------------
0.05 => sine.gain;
Math.random2f(sineF - deltaF, sineF + deltaF) => sine.freq;
Math.random2(0,100) => int rand2;
if(rand2 > 80)
{
0.003 => sine.gain;
4*sineF => sine.freq;
}
if(rand2 > 90)
{
0.0 => sine.gain;
}
if(rand2 < 15)
{
0.15 => sine.gain;
0.125*sineF => sine.freq;
}
//----- Beat construction --------------------------------------
//if((beatMap == 1*beatMult)&& silence == -1 && silenceRand != 197)
if(beatMap == 1*beatMult)
{
//<<<"kick">>>;
0.4 => kick.gain;
0 => snare.gain;
0 => kick.pos;
Math.random2f(0.85,1) => kick.rate;
0.0 => pKick.pan;
0.3 => sRev.mix;
if(crashRand > 85)
{
Math.random2f(0.05, 0.1) => crash.gain;
<<<"pSHHh!!!">>>;
}
}
//if((beatMap == 3*beatMult || beatMap == 6*beatMult)&& silence == -1 && silenceRand != 198)
if(beatMap == 3*beatMult || beatMap == 6*beatMult)
{
//<<<"snare">>>;
0.4 => snare.gain;
0 => kick.gain;
0 => snare.pos;
0.0 => pSnare.pan;
Math.random2f(0.9,6) => snare.rate;
if(crashRand > 85)
{
Math.random2f(0.05, 0.1) => crash.gain;
<<<"PAHHHhh!!!">>>;
}
if(rand2 < 30)
{
4*sineF => sine.freq;
0.02 => sine.gain;
}
}
//--------- Silent Periods ---------------------------------------------
Math.random2(0, 200) => silenceRand;
// dive into radio silence
if(silenceRand > 196 && duration > intro)
{
//invert the silence flag
-1*silence => silence;
if(silence == 1)
{
<<<"Start tramsnishon!!!">>>;
}
else
{
<<<"Silens!">>>;
}
if(silenceRand > 199)
{
<<<"Chenge ze frekvensy range!!!">>>;
Math.random2f(100, 800) => sineF;
<<<"Trasmitin at", sineF>>>;
}
}
if(silence == -1)
{
0 => hihat.gain;
0 => crash.gain;
0 => sine.gain;
0.4 => snare.gain;
// 0.0 => kick.gain;
// different types of silent moments
// not expressive without additional alternative conditions commented above
// anyway nothing special at all, so never mind
/* if(silenceRand == 197)
{
<<<"No kicks">>>;
0 => kick.gain;
}
if(silenceRand == 198)
{
<<<"No snares">>>;
0 => snare.gain;
}*/
}
//--------- Time Progress Management -----------------
beatMap++;
Math.random2f(tempo - deltaT, tempo + deltaT) => grain;
duration + grain::ms => duration;
if(duration > end)
{
<<<"Samfing vrong!!!">>>;
}
//------- some composition details ---------------------
//------- Intro ----------------------------------------
if(duration < intro)
{
0 => kick.gain;
}
if(duration < 1.1 * intro)
{
0 => hihat.gain;
}
if(duration < 1.4 * intro)
{
0 => crash.gain;
0 => sine.gain;
}
//------- Destruction ----------------------------------
if(duration > end)
{
//deltaT should grow faster than tempo
//ratio of those to change the destruction dramatically
deltaT + 0.9 => deltaT;
tempo + 0.5 => tempo;
sineF + 3 => sineF;
//0.05 +=> sRev.mix;
}
if(grain < 0)
{
0 => sine.gain;
<<<"------- END!!! -------">>>;
3::second => now;
}
//------------------------------------------------------
grain::ms => now;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment