Skip to content

Instantly share code, notes, and snippets.

@miguel-negrao
Created May 10, 2012 15:42
Show Gist options
  • Save miguel-negrao/2654012 to your computer and use it in GitHub Desktop.
Save miguel-negrao/2654012 to your computer and use it in GitHub Desktop.
Gamelan practice
(
i = 2**(1/9);
~innerIntervals = [i,i,i**2,i,i,i,i**2];
~intervalsToRoot = ([1]++~innerIntervals).inject([], { |state,x|
if(state.size == 0){
[x]
} {
state ++ [state.last*x]
}
});
k = MIDIMKtl('nnkn0');
k.reset;
~buts =
[7.collect{ |i| k.elements.at(("bd_"++(i+1)++"_1").asSymbol.postln).eventSource },
7.collect{ |i| k.elements.at(("bu_"++(i+1)++"_1").asSymbol.postln).eventSource }.reverse
];
~synths = 7.collect{ nil };
~buts.do{ |but,j| [but,~intervalsToRoot,(0..7)].flopWith{ |a,b,i|
a.do{ |v|
{ Out.ar(0, Splay.ar(EnvGen.kr(Env.perc, 1)*Saw.ar(400*b*(j+1))*0.2)) }.play;
}
}
};
)
(
fork{
loop {
0.7.wait;
{ EnvGen.ar(Env.perc, doneAction:2)*WhiteNoise.ar*0.1 ! 2 }.play
}
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment