// title: IDMish modified. It is inspirated from the work of xffff. // author: jerome.lapuyade.lahorgue // description: // This patch uses a SynthDef with Demand and triggered Ugens inside. The advantage of this rather using Pbind is the ability to play very speed rhythms without saturating the server. Indeed, only the OSC message to start the synth is sent by Synth; whereas with Pbind, if the tempo is too speed, a lot of OSC messages are sent during a short time interval. // code: /************** the IDMish modified. The original code is from xffff *******. I have modified his code for optimisation. A synthdef using Demand Ugens is used instead of a fork *****/ //choose a sample for the kick and another for the snare ( ~time=100.collect({[1/8,1/4,1/2].wchoose([20,10,2].normalizeSum)}); ~kick=Buffer.readChannel(s,"C:/ProgramData/Ableton/Live 9 Lite/Resources/Core Library/Samples/Drums/Kick/Kick Gambling.wav",channels:0); ~snare=Buffer.readChannel(s,"C:/ProgramData/Ableton/Live 9 Lite/Resources/Core Library/Samples/Drums/Clap/Clap Simple Snap.wav",channels:0); ) ( SynthDef(\IDMish,{ arg out=0,pan=0,amp=0.1; var time=1/4,trigtime=1,impulse,test,sound, freq, ampenv, filterenv, mod, snare, snaretrig, kick, kickenv, lin,sig, sig1, sig2, sig3; time=Demand.kr(Impulse.kr(1/time),0,Dseq(~time,inf)); impulse=Impulse.kr(1/time); time=Demand.kr(impulse,0,Dseq(~time,inf)); trigtime=Demand.kr(impulse,0,Drand([1,2,4,8,16],inf)); mod=LFNoise2.kr(TRand.ar(0.0,1.0,impulse).dup(2),Demand.kr(impulse,0,Drand([TRand.kr(0.0,0.01,impulse),TRand.kr(0.0,0.001,impulse),TRand.kr(0.0,0.5,impulse)],inf))); freq=70 * Demand.kr(impulse,0,Dseq([0,1].midiratio.stutter(16),inf)) * Demand.kr(impulse,0,Dseq([1,2].stutter(64),inf)); //freq = (freq.midicps)/4; filterenv = EnvGen.kr(Env.linen(time*1.0/TRand.kr(0.0,3.0,impulse).max(0.01),time/TRand.kr(0.0,3.0,impulse).max(0.01),time/TRand.kr(0.0,3.0,impulse).max(0.01)).range(freq*1.5,freq*TRand.kr(0.0,10.0,impulse).max(1.5))); ampenv = EnvGen.kr(Env.perc(0.1,time/TRand.kr(0.0,2.0,impulse).max(1/8),TRand.kr(0.0,1.0,impulse)),impulse); /******* sound **************************/ freq = SinOsc.ar(freq*Demand.kr(impulse,0,Dseq([0.5,1,2,4],inf)).lag(0.3))* Demand.kr(impulse,0,Dseq([0.5,1,1.5],inf)).lag(0.3) * LFNoise1.kr(1/7).range(0.9,1.1) + 1 * freq;//modulation sig = Mix.ar(SinOsc.ar(freq.lag(0.1) * [1,8,2,4,1.002]));//5 sinusoides: la première de frequence freq, la deuxieme à 3 octaves au dessus, la troisieme à une octave, la quatrième à 2 octaves et la dernière 1.002*freq sig1 = LFPulse.ar(freq * [1,4,1.001,2 * LFNoise1.kr(1/10).range(0.999,1.001),1/2], mul:1.00);//5 pulsations de frequences respectives: freq, 4*freq (2octaves), 1.001*freq, frequence variables entre 2*0.999 et 2*1.001, 1/2 (1octave en dessous) sig = sig + sig1;//les deux signaux sont ajoutés sound = sig; snaretrig = Impulse.kr(trigtime); snare = 0.1*PlayBuf.ar(1,~snare,trigger:snaretrig); kickenv = EnvGen.kr(Env.perc(0.01,time),impulse); kick = RLPF.ar(BPeakEQ.ar(PlayBuf.ar(1,~kick,trigger:impulse),440,db:12),110)*kickenv; sound=0.125*(Compander.ar(0.1*sound,10*kick,thresh:0.5,slopeBelow:0.5)+(4*snare)+(10*kick));//side chain test=SinOsc.ar(freq*filterenv); Out.ar(out,Pan2.ar(sound.tanh,pan,amp)); }).add; ) //play this Synth(\IDMish,[\amp,1])