Skip to content

Instantly share code, notes, and snippets.

@tedthetrumpet
Created August 29, 2016 20:17
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 tedthetrumpet/3fa8c3ce9e250d3ec375bf30dad74b90 to your computer and use it in GitHub Desktop.
Save tedthetrumpet/3fa8c3ce9e250d3ec375bf30dad74b90 to your computer and use it in GitHub Desktop.
(
// reset
Pdef.all.clear; Pdefn.all.clear; Ndef.all.clear; Buffer.freeAll;
// quantize changes to four beats
Pbindef.defaultQuant = 4;
Pdefn.defaultQuant = 4;
s.waitForBoot{
// set tempo to 120
TempoClock.default.tempo = 120/60;
// setup sample path
~bufs = ( "samples/".resolveRelative ++ "*").pathMatch.collect({ |i| Buffer.read(s, i)});
// define synth to play back buffers
SynthDef(\bf, {|out = 0 buf = 0 amp = 0.1 freq = (60.midicps), pan = 0.0|
var sig = PlayBuf.ar(2, buf, BufRateScale.kr(buf) * freq/60.midicps, doneAction:2);
sig = Balance2.ar(sig[0],sig[1], pan);
Out.ar(out, sig * amp)
}).add;
s.sync;
};
)
// useful
Pdef.all.asCompileString.newTextWindow
Ndef.all.asCompileString
s.meter
s.prepareForRecord
s.record
s.stopRecording
thisProcess.platform.recordingsDir.openOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment