File: ListTrig.html

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-- 4,896 bytes parent folder | download | duplicates (3)
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<!-- Translation from RTF performed by UnRTF, version 0.21.9 -->
<!--font table contains 0 fonts total-->
<!--invalid font number 0-->
</head>
<body><b><font size="5"><font color="#000000">ListTrig<span style="font-size:13pt">Emit a sequence of triggers at specified time offsets<font size="5"><br>
<!--invalid font number 1-->
</font></span></font></font></b><font size="5"><font color="#000000"><span style="font-size:13pt"><font size="5"><span style="font-size:9pt"><br>
</span></font></span></font></font><!--invalid font number 0-->
<b><font size="3"><font color="#000000"> ListTrig.kr(bufnum, reset, offset, numframes)<br>
</font></font></b><!--invalid font number 2-->
<font color="#000000"><br>
The data stored in the [<u>Buffer</u>] at<!--invalid font number 0-->
<b>bufnum<!--invalid font number 2-->
</b> should be a (single-channel) ordered list of time offsets in seconds. ListTrig will then emit a trigger signal (a single-sample value of 1, at control rate) at each of those times, which are measured from the beginning of the synth's existence, or from the most recent<!--invalid font number 0-->
<b>reset<!--invalid font number 2-->
</b> trigger (which also resets reading back to the beginning of the buffer).<br>
<br>
The<!--invalid font number 0-->
<b>offset<!--invalid font number 2-->
</b> parameter can be used to modify the offsets globally. For example, to delay the list of values all by half a second, use an<!--invalid font number 0-->
<b>offset<!--invalid font number 2-->
</b> of 0.5. (The<!--invalid font number 0-->
<b>offset<!--invalid font number 2-->
</b> value is only updated at initialisation or reset.)<br>
<br>
Behaviour is undefined if the buffer's values are not in ascending order. If the buffer contains two or more adjacent equal values, it will skip over the duplicates (i.e. only one trigger will be output, and its value will still be 1).<br>
<br>
</font><!--invalid font number 0-->
<b><font color="#000000">numframes<!--invalid font number 2-->
</font></b><font color="#000000"> tells the UGen the size of the buffer. If not set, this will automatically be filled with<!--invalid font number 3-->
<i><b>BufFrames.kr(bufnum)<!--invalid font number 2-->
</b></i><b></b>, which is typically what you want to use anyway.<br>
<br>
<!--invalid font number 0-->
<b>Example<!--invalid font number 1-->
</b><span style="font-size:9pt"><br>
</span></font><font color="#000000"><br>
s.boot;<br>
<font color="#bf0000">// Everyone likes Fibonacci numbers:<font color="#000000"><br>
b = <font color="#0000bf">Buffer<font color="#000000">.loadCollection(s, [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] * 0.1);<br>
<font color="#bf0000">// Or you could load some numbers from a file:<font color="#000000"><br>
b = <font color="#0000bf">Buffer<font color="#000000">.loadCollection(s, <font color="#0000bf">FileReader<font color="#000000">.read(<font color="#606060">&quot;/Users/danstowell/svn/stored_docs/bbx annots/onsets_gt/vb5gt.txt&quot;<font color="#000000">, <font color="#0000bf">true<font color="#000000">, <font color="#0000bf">true<font color="#000000">).collect(<font color="#0000bf">_<font color="#000000">.at(0).asFloat));<br>
(<br>
<font color="#bf0000">// ListTrig used here to output some simple grains.<font color="#000000"><br>
<font color="#bf0000">// I'm also using .poll and a ramp to output the calculated time value, to check the output.<font color="#000000"><br>
<font color="#bf0000">// Note the accuracy, which is limited to the accuracy of the control rate.<font color="#000000"><br>
x = { <font color="#0000bf">|t_reset=0|<font color="#000000"><br>
 <font color="#0000bf">var<font color="#000000"> trigs, env, son, ramp;<br>
 trigs = <font color="#0000bf">ListTrig<font color="#000000">.kr(b.bufnum, t_reset);<br>
 env = <font color="#0000bf">EnvGen<font color="#000000">.ar(<font color="#0000bf">Env<font color="#000000">.perc(0.01, 0.1), trigs);<br>
 son = <font color="#0000bf">SinOsc<font color="#000000">.ar(440, 0, env * 0.2);<br>
 <br>
 ramp = <font color="#0000bf">Phasor<font color="#000000">.kr(t_reset, <font color="#0000bf">ControlRate<font color="#000000">.ir.reciprocal, 0, <font color="#0000bf">inf<font color="#000000">);<br>
 ramp.poll(trigs, <font color="#606060">&quot;Trigger at time offset&quot;<font color="#000000">);<br>
 <br>
 son.dup;<br>
}.play(s)<br>
);<br>
x.set(<font color="#007300">\t_reset<font color="#000000">, 1);</font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></body>
</html>