Skip to content

Instantly share code, notes, and snippets.

@ekozhura
Created April 19, 2015 18:49
Show Gist options
  • Save ekozhura/375b14f217fd46950371 to your computer and use it in GitHub Desktop.
Save ekozhura/375b14f217fd46950371 to your computer and use it in GitHub Desktop.
mixing two breaks with LinLin UGen
(
{
var source1, source2, buf1, buf2, tempo, rate = 44100, beatDur;
tempo = 170 / 60;
beatDur = (44100 / tempo).ceil;
buf1 = Buffer.read(s, "sounds/break_1_170.wav", startFrame: beatDur * 0);
buf2 = Buffer.read(s, "sounds/break_2_170.wav", startFrame: beatDur * 0);
source1 = PlayBuf.ar(2, buf1, BufRateScale.kr(buf1), startPos: beatDur * 0.5, rate: 1, trigger: Impulse.kr(tempo/16));
source2 = PlayBuf.ar(1, buf2, BufRateScale.kr(buf2), rate: 0.75, trigger: Impulse.kr(tempo/4)) * 0.5;
Limiter.ar(
LinLin.ar(LFPulse.ar(tempo * 4.reciprocal, 0.5, width: 0.75), 0, 1, source1, source2) * 0.6 ! 2,
0.6
);
}.play;
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment