File: SLOnset.schelp

package info (click to toggle)
supercollider-sc3-plugins 3.7.1~repack-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 14,332 kB
  • ctags: 11,704
  • sloc: cpp: 140,180; lisp: 14,746; ansic: 2,133; xml: 86; makefile: 82; haskell: 21; sh: 8
file content (64 lines) | stat: -rw-r--r-- 1,267 bytes parent folder | download | duplicates (4)
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
class:: SLOnset			
summary::experimental time domain onset detector
categories:: UGens>Analysis
//SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, http://composerprogrammer.com/index.html
keyword:: SLUGens


Description::
Purely time domain onset detector

Works well for loud signals but fainter onsets are missed, and really loud onsets lead to multiple triggers. 

(my note: needs some sort of log amplitude correction?)


Examples::

code::
(
x = {arg threshold=10.0; 

var input, onsets; 

input = SoundIn.ar(0); 

onsets= SLOnset.kr(input,20,5,5,threshold); 

Out.ar(0, SinOsc.ar(440,0,0.1)*Decay2.ar(K2A.ar(onsets), 0.01, 0.1)); 

}.play;
)


x.set(\threshold, 10.0)


x.free;


b = Buffer.read(s,"sounds/a11wlk01.wav"); // remember to free the buffer later.
b = Buffer.read(s,"sounds/break2"); // remember to free the buffer later.


(
x = {arg threshold=10.0, hysteresis=20; 

var input, onsets; 

input = PlayBuf.ar(1, b, BufRateScale.kr(b), loop:1);

onsets= SLOnset.kr(input,20,5,5,threshold,hysteresis); 

Out.ar(0, input + (SinOsc.ar(440,0,0.1)*Decay2.ar(K2A.ar(onsets), 0.01, 0.05))); 

}.play;
)


//by setting these appropriately can get somewhere...
x.set(\threshold, 50.0)
x.set(\hysteresis, 10.0)

b.free;
::