Skip to content

Commit

Permalink
Merge pull request #23 from schollz/onset
Browse files Browse the repository at this point in the history
Onset
  • Loading branch information
schollz authored Sep 3, 2021
2 parents 45e1a85 + 4812de9 commit 618b44f
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 123 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ digital tape loops x 6.

![Image](https://user-images.githubusercontent.com/6550035/91628872-c47b8c80-e978-11ea-9d07-df79ef337a0f.gif)

https://vimeo.com/590419704

i call this script *"oooooo"* because it is composed of six loops. they are like digital tape loops - you can level, pan, speed, slow, shorten, lengthen, dub, overdub, destroy any loop at any time.

i was inspired to make this after seeing tape loops circulating (pun sorta intended) all over the place. i like the idea of having multiple independent different loops, with different sizes, played on a different tape players with different eccentricities. i don't have any cassette tapes but i have norns so i wrote this script to try to make digital tape loops.
Expand Down Expand Up @@ -50,7 +52,7 @@ all parameters are available via the global menu.
- in tape mode, press K1+K3 to prime recording. when primed, recording will automatically begin when incoming audio rises above a threshold. the recording threshold can be set by global parameter "`recording -> rec thresh`".
- in tape mode, you can force recording by hitting K1+K3 a second time.
- recording stops after traversing the whole loop. you can stop it earlier with K2 or K3 (in tape mode) and that will shrink the loop to that point. you can set recording to continue to the next loop by setting the global parameter "`recording -> rec thru loops`" to `yes`.
- by default, volume in "pinched" when starting/stopping recording to avoid pops from discontinuous signals. you can lower/raise the pinching by adjusting the global parameter "`vol pinch`".
- by default, loops will be recorded with a crossfade for gapless playback. if you are recording something with initial transients (like drums), I recommend reducing the crossfade (`loop X -> crossfade`) to 1 ms.
- to record a loop over and over, infinitely, change `recording -> stop rec after` to its max value.

**quick menu:**
Expand All @@ -62,6 +64,7 @@ all parameters are available via the global menu.

**A loop:**

- the "A" loop is found by turning E1 all the way to the right.
- "A" loop can control all loops. the tape mode works as before, but affects all loops.
- the quick menu differs from loops but is also activated by K2 or K3, and modulated with E3

Expand All @@ -86,11 +89,6 @@ all parameters are available via the global menu.

<p align="center"><a href="https://www.instagram.com/p/CEeMRPDhCt_/"><img src="https://user-images.githubusercontent.com/6550035/91628603-2be40d00-e976-11ea-93ee-6f58fc835142.png" alt="Demo of playing" width=80%></a></p>

## my other norns

- [barcode](https://github.com/schollz/barcode): replays a buffer six times, at different levels & pans & rates & positions, modulated by lfos on every parameter.
- [blndr](https://github.com/schollz/blndr): a quantized delay with time morphing
- [clcks](https://github.com/schollz/clcks): a tempo-locked repeater for monome norns

## license

Expand Down
34 changes: 20 additions & 14 deletions lib/Engine_SimpleDelay.sc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Engine_SimpleDelay : CroneEngine {
//var <responder;
var <responder;
//var <onsetdetector;
var synth;
// var recorder;
Expand All @@ -15,9 +15,16 @@ Engine_SimpleDelay : CroneEngine {
alloc {
buffer1 = Buffer.alloc(context.server,48000 * 0.03, 1,bufnum:bufnum1);
buffer2 = Buffer.alloc(context.server,48000 * 0.03, 1,bufnum:bufnum2);
synth = { arg delay=0.03, volume=0.0;
var input = SoundIn.ar([0, 1]);
BufDelayC.ar([bufnum1,bufnum2], input, delayTime:0.03, mul:volume)
// synth = { arg delay=0.03, volume=0.0;
// var input = SoundIn.ar([0, 1]);
// BufDelayC.ar([bufnum1,bufnum2], input, delayTime:0.03, mul:volume)
// }.play(context.server);

synth = { arg threshold=(-60), volume=0.0;
var input = Mix.new(SoundIn.ar([0, 1]));
var onset = Trig.kr(Coyote.kr(input,fastLag:0.05,fastMul:0.9,thresh:threshold.dbamp,minDur:0.2));
SendTrig.kr(onset,0,1);
Silent.ar();
}.play(context.server);

// onset detection!
Expand All @@ -27,23 +34,22 @@ Engine_SimpleDelay : CroneEngine {
// var onsets = Onsets.kr(chain, onset_threshold, \rcomplex, floor: 0.02,mingap:20);
// SendTrig.kr(onsets, 0, 1);
// }.play(context.server);
// responder = OSCFunc(
// {
// arg msg, time;
// // postln('['++time++']');
// NetAddr("127.0.0.1", 10111).sendMsg("onset",1,time);
// },'/tr', context.server.addr);
responder = OSCFunc(
{
arg msg, time;
// postln('['++time++']');
NetAddr("127.0.0.1", 10111).sendMsg("onset",1,time);
},'/tr', context.server.addr);

this.addCommand("delay", "f", { arg msg; synth.set(\delay, msg[1]); });
this.addCommand("volume", "f", { arg msg; synth.set(\volume, msg[1]);});
this.addCommand("threshold", "f", { arg msg; synth.set(\threshold, msg[1]);});
}

free {
// responder.free;
responder.free;
// onsetdetector.free;
synth.free;
// recorder.free;
buffer1.free;
buffer2.free;
}
}
}
Loading

0 comments on commit 618b44f

Please sign in to comment.