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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
|
CLASS::Harmonics
summary:: Convenient factory for filling buffers with harmonics on the server
categories:: Collections, Server, UGens>Buffer
DESCRIPTION::
Harmonics objects are convenient factories for creating Arrays that are used to fill buffers using the b_gen sine fill commands on the server.
CLASSMETHODS::
method::new
Create a new Harmonics array of size. Nothing is filled in for you, until instance methods are applied.
code::
a = Harmonics.new(16); // just returns an instance of Harmonics with size
::
INSTANCEMETHODS::
method::ramp
code::
a.ramp(1.0, 1.0); // returns a harmonic series
b = Buffer.alloc(s, 512, 1);
// harmonic series for freqs, ramp down for amps
b.sine2(a.ramp(1.0, 1.0).postln, a.ramp(0.5, -0.025).postln, true, true, true);
(
z = SynthDef("help-Osc",{ arg out=0,bufnum=0;
Out.ar(out,
Osc.ar(bufnum, 200, 0, 0.5)
)
});
)
y = z.play(s,[\out, 0, \bufnum, b]);
y.free;
::
method::decay
Implements the formula: 1 / ((i+1) ** k)
code::
a.decay(1.0);
b.sine2(a.ramp(1.0, 1.0).postln, a.decay(1.0).postln, true, true, true);
y = z.play(s,[\out, 0, \bufnum, b]);
y.free;
::
method::geom
Implements the formula: 1 / (i ** k)
code::
a.geom(1.2);
b.sine2(a.ramp(1.0, 1.0).postln, a.geom(1.2).postln, true, true, true);
y = z.play(s,[\out, 0, \bufnum, b]);
y.free;
::
method::formant
Create a formant like structure.
code::
a.formant(6, 3);
b.sine2(a.formant(12, 3).postln, a.geom(1.2), true, true, true);
y = z.play(s,[\out, 0, \bufnum, b]);
y.free;
::
method::teeth
code::
a.teeth(6, 3);
b.sine2(a.teeth(2, 3).postln, a.geom(1.2), true, true, true);
y = z.play(s,[\out, 0, \bufnum, b]);
b.sine2(a.teeth(4, 1).postln, a.geom(1.2), true, true, true);
b.sine2(a.teeth(1, 3).postln, a.geom(1.2), true, true, true);
b.sine2(a.teeth(2, 3).postln, a.geom(1.2), true, true, true);
y.free;
::
method::cutoff
Returns 1.0 to the nth place, fills the rest with 0.0
code::
a.cutoff(3);
b.sine2(a.ramp(1.0, 1.0), a.cutoff(3), true, true, true);
y = z.play(s,[\out, 0, \bufnum, b]);
b.sine2(a.ramp(1.0, 1.0), a.cutoff(3), true, true, true);
b.sine2(a.ramp(1.0, 1.0), a.cutoff(5), true, true, true);
b.sine2(a.ramp(1.0, 1.0), a.cutoff(1), true, true, true);
y.free;
::
method::shelf
code::
a.shelf(0, 6, 1, 0);
b.sine2(a.ramp(1.0, 1.0), a.shelf(0, 6, 1, 0).postln , true, true, true);
y = z.play(s,[\out, 0, \bufnum, b]);
b.sine2(a.ramp(1.0, 1.0), a.shelf(0, 11, 1, 0).postln , true, true, true);
b.sine2(a.ramp(1.0, 1.0), a.shelf(2, 6, 1, 0).postln , true, true, true);
b.sine2(a.ramp(1.0, 1.0), a.shelf(6, 8, 1, 0).postln , true, true, true);
y.free;
::
method::sine
code::
a.sine(8, 0, 1, 0);
b.sine2(a.ramp(1.0, 1.0), a.sine(8, 0, 1, 0).postln , true, true, true);
y = z.play(s,[\out, 0, \bufnum, b]);
b.sine2(a.ramp(1.0, 1.0), a.sine(4, 0, 1, 0).postln , true, true, true);
b.sine2(a.ramp(1.0, 1.0), a.sine(2.2, 0.5pi, 0.4, 0.2).postln , true, true, true);
b.sine2(a.ramp(1.0, 1.0), a.sine(pi, 0.25pi, 0.5, 0).postln , true, true, true);
y.free;
::
method::pulse
code::
a.pulse(8, 0, 2, 1, 0);
b.sine2(a.ramp(1.0, 1.0), a.pulse(8, 0, 2, 1, 0).postln , true, true, true);
y = z.play(s,[\out, 0, \bufnum, b]);
b.sine2(a.ramp(1.0, 1.0), a.pulse(8, 0, 2, 1, 0).postln , true, true, true);
b.sine2(a.ramp(1.0, 1.0), a.pulse(4, 0, 2, 0.4, 0.2).postln , true, true, true);
b.sine2(a.ramp(1.0, 1.0), a.pulse(7, 0.5pi, 3, 0.5, 0.1).postln , true, true, true);
y.free;
::
method:: rand, exprand, linrand
method:: rand2
method:: coin
|