2 summary:: Convenient factory for filling buffers with harmonics on the server
3 categories:: Collections, Server, UGens>Buffer
6 Harmonics objects are convenient factories for creating Arrays that are used to fill buffers using the b_gen sine fill commands on the server.
11 Create a new Harmonics array of size. Nothing is filled in for you, until instance methods are applied.
13 a = Harmonics.new(16); // just returns an instance of Harmonics with size
20 a.ramp(1.0, 1.0); // returns a harmonic series
22 b = Buffer.alloc(s, 512, 1);
23 // harmonic series for freqs, ramp down for amps
24 b.sine2(a.ramp(1.0, 1.0).postln, a.ramp(0.5, -0.025).postln, true, true, true);
26 z = SynthDef("help-Osc",{ arg out=0,bufnum=0;
28 Osc.ar(bufnum, 200, 0, 0.5)
32 y = z.play(s,[\out, 0, \bufnum, b]);
37 Implements the formula: 1 / ((i+1) ** k)
41 b.sine2(a.ramp(1.0, 1.0).postln, a.decay(1.0).postln, true, true, true);
42 y = z.play(s,[\out, 0, \bufnum, b]);
47 Implements the formula: 1 / (i ** k)
51 b.sine2(a.ramp(1.0, 1.0).postln, a.geom(1.2).postln, true, true, true);
52 y = z.play(s,[\out, 0, \bufnum, b]);
57 Create a formant like structure.
61 b.sine2(a.formant(12, 3).postln, a.geom(1.2), true, true, true);
62 y = z.play(s,[\out, 0, \bufnum, b]);
70 b.sine2(a.teeth(2, 3).postln, a.geom(1.2), true, true, true);
71 y = z.play(s,[\out, 0, \bufnum, b]);
72 b.sine2(a.teeth(4, 1).postln, a.geom(1.2), true, true, true);
73 b.sine2(a.teeth(1, 3).postln, a.geom(1.2), true, true, true);
74 b.sine2(a.teeth(2, 3).postln, a.geom(1.2), true, true, true);
79 Returns 1.0 to the nth place, fills the rest with 0.0
83 b.sine2(a.ramp(1.0, 1.0), a.cutoff(3), true, true, true);
84 y = z.play(s,[\out, 0, \bufnum, b]);
85 b.sine2(a.ramp(1.0, 1.0), a.cutoff(3), true, true, true);
86 b.sine2(a.ramp(1.0, 1.0), a.cutoff(5), true, true, true);
87 b.sine2(a.ramp(1.0, 1.0), a.cutoff(1), true, true, true);
95 b.sine2(a.ramp(1.0, 1.0), a.shelf(0, 6, 1, 0).postln , true, true, true);
96 y = z.play(s,[\out, 0, \bufnum, b]);
97 b.sine2(a.ramp(1.0, 1.0), a.shelf(0, 11, 1, 0).postln , true, true, true);
98 b.sine2(a.ramp(1.0, 1.0), a.shelf(2, 6, 1, 0).postln , true, true, true);
99 b.sine2(a.ramp(1.0, 1.0), a.shelf(6, 8, 1, 0).postln , true, true, true);
107 b.sine2(a.ramp(1.0, 1.0), a.sine(8, 0, 1, 0).postln , true, true, true);
108 y = z.play(s,[\out, 0, \bufnum, b]);
109 b.sine2(a.ramp(1.0, 1.0), a.sine(4, 0, 1, 0).postln , true, true, true);
110 b.sine2(a.ramp(1.0, 1.0), a.sine(2.2, 0.5pi, 0.4, 0.2).postln , true, true, true);
111 b.sine2(a.ramp(1.0, 1.0), a.sine(pi, 0.25pi, 0.5, 0).postln , true, true, true);
117 a.pulse(8, 0, 2, 1, 0);
119 b.sine2(a.ramp(1.0, 1.0), a.pulse(8, 0, 2, 1, 0).postln , true, true, true);
120 y = z.play(s,[\out, 0, \bufnum, b]);
121 b.sine2(a.ramp(1.0, 1.0), a.pulse(8, 0, 2, 1, 0).postln , true, true, true);
122 b.sine2(a.ramp(1.0, 1.0), a.pulse(4, 0, 2, 0.4, 0.2).postln , true, true, true);
123 b.sine2(a.ramp(1.0, 1.0), a.pulse(7, 0.5pi, 3, 0.5, 0.1).postln , true, true, true);
127 method::rand, exprand, linrand, rand2, coin