Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: (mono) looper on Ndef basis
name
code content
s.boot; ( q = (); q.length = 16; // 16 seconds == 8 bars @ 120bpm q.numFrames = q.length * s.sampleRate; q.looperInBus = Bus.audio(s); Spec.add(\switch, [0, 1, \lin, 1, 0]); Spec.add(\recLevel, \db); Spec.add(\preLevel, \db); Spec.add(\playbackRate, \rate); Spec.add(\recEnable, \switch); Spec.add(\recCuePoint, [0, q.length]); Spec.add(\playCuePoint, \recCuePoint); Spec.add(\resetRec, \switch); Spec.add(\resetPlay,\switch); ) NdefMixer(s) ( Ndef(\clicktrack, { Mix([ SinOsc.ar(440) * Decay.ar(Impulse.ar(2), 0.1, 0.2), SinOsc.ar(880) * Decay.ar(Impulse.ar(0.5), 0.1, 0.2) ]); }) ) ( Ndef(\oneTrackLooper, { // A looper for one track, mono. var in = Ndef(\input).ar; // your input var buffer = LocalBuf.newFrom(0!q.numFrames); // stores loop var recEnable = \recEnable.kr(0).lag2(0.01); var recLevel = \recLevel .kr(0).dbamp; var preLevel = \preLevel .kr(0).dbamp; // converts from samples to seconds var playCuePoint = \playCuePoint.kr(0) * s.sampleRate; var resetRec = \resetRec.tr(1); var resetPlay = \resetPlay.tr(1); var playRate = \playbackRate.kr(1); // recording RecordBuf.ar( in, buffer, loop: 1, recLevel: recLevel * recEnable, preLevel: preLevel, trigger: resetRec ); // playing back PlayBuf.ar( 1, buffer, rate: playRate, trigger: resetPlay, startPos: playCuePoint, loop: 1 ); }) ) // something to loop ( Ndef(\input, { SoundIn.ar(0); }) )
code description
very basic, more explanation and a sound example here: http://tai-studio.org/index.php/2013/02/looper/
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change