Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (
- //MIDI
- MIDIClient.init;
- MIDIIn.connectAll;
- ~notes = Array.newClear(128); //Pad Synth Array
- //Channel 1 pad Synth
- MIDIdef.noteOn(\noteOn, {
- arg vel, nn, chan, src;
- ~notes[nn] = Synth.new(
- \jorKlank2,
- [
- \atk, 1.0,
- \dec, 0.8,
- \sus, 0.7,
- \rel, 1.5,
- \ffreq, nn.midicps,
- \freqs, #[1500, 100, 1000, 300, 256, 123, 908, 1200, 157, 311, 677, 521, 743],
- \amps, #[0.2, 0.3, 0.33, 2, 0.1, 0.9, 0.6, 0.45, 0.67, 0.3, 0.77, 0.88, 0.35].reverse,
- \rings, #[0.2, 0.3, 0.33, 2, 0.1, 0.9, 0.6, 0.45, 0.67, 0.3, 0.77, 0.88, 0.35];
- ]
- );
- }, chan: 0).permanent_(true);
- MIDIdef.noteOff(\noteOff, {
- arg vel, nn;
- [vel, nn].postln;
- ~notes[nn].set(\gate, 0);
- ~notes[nn] = nil;
- }).permanent_(true);
- )
- //SYNTH
- (
- SynthDef(\jorKlank2,{
- arg
- gate = 1, atk = 0.2, dec = 0.5, sus = 1, rel = 1, ffreq=440,
- freqs = #[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
- amps = #[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
- rings = #[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- var
- temp,
- envelope = EnvGen.kr(Env.adsr(atk, dec, sus, rel), gate, doneAction: 2),
- exciter = SinOsc.ar([ffreq, ffreq+3]*2, mul:0.001),
- klank = DynKlank.ar(`[freqs, amps, rings], exciter);
- Out.ar([10], klank*envelope);// Pan2.ar(klank*envelope, pan));
- }).add;
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement