Merge pull request #506 from andrewcsmith/patch-2
[supercollider.git] / HelpSource / Classes / LinCongC.schelp
blob7f0bcf5ef6a047c9959e1aa029ec217982b50629
1 class:: LinCongC
2 summary:: Linear congruential chaotic generator
3 categories:: UGens>Generators>Chaotic
4 related:: Classes/LinCongN, Classes/LinCongL
6 description::
7 A cubic-interpolating sound generator based on the difference equation:
9 code::
10         x[n+1] = (a * x[n] + c) % m
12 warning:: revise formulae converted to c like code ::
14 The output signal is automatically scaled to a range of [-1, 1].
16 classmethods::
17 method:: ar
18 argument:: freq
19 Iteration frequency in Hertz
20 argument:: a
21 Multiplier amount
22 argument:: c
23 Increment amount
24 argument:: m
25 Modulus amount
26 argument:: xi
27 Initial value of x
29 examples::
30 code::
31 // default initial params
32 { LinCongC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);
35 code::
36 // randomly modulate params
38 { LinCongC.ar(
39         LFNoise2.kr(1, 1e4, 1e4),
40         LFNoise2.kr(0.1, 0.5, 1.4),
41         LFNoise2.kr(0.1, 0.1, 0.1),
42         LFNoise2.kr(0.1)
43 ) * 0.2 }.play(s);
47 code::
48 // as frequency control...
51 SinOsc.ar(
52         LinCongC.ar(
53                 40,
54                 LFNoise2.kr(0.1, 0.1, 1),
55                 LFNoise2.kr(0.1, 0.1, 0.1),
56                 LFNoise2.kr(0.1),
57                 0, 500, 600
58         )
59 ) * 0.4 }.play(s);