«(mono) looper on Ndef basis» by LFSaw

on 04 Feb'13 15:15 in looperbasicndef

very basic, more explanation and a sound example here: http://tai-studio.org/index.php/2013/02/looper/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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);
})
)
descendants
«Re: (mono) looper on Ndef basis» by S P (private)
full graph
raw 1567 chars (focus & ctrl+a+c to copy)
reception
comments