Signal.sineFill creates additive synthesis wavetables by specifying partials as an amplitude array
Signal.sineFill(size, amplitudes, phases) creates a single-cycle waveform by summing harmonic partials. The amplitudes array element at index n sets the amplitude of partial n+1: [1, 0, 0.5] gives fundamental, no second harmonic, 0.5 of third harmonic. The phases array sets the initial phase offset of each partial in radians. Size must be a power of 2. The resulting Signal must be converted with .asWavetable before loading into a Buffer for use with Osc, VOsc, or Shaper. Classical harmonic series: 1/(1..n) gives 1, 1/2, 1/3, … amplitudes — a sawtooth approximation.
Examples
~wt = Signal.sineFill(1024, 1/(1..8), 0!8).asWavetable; // approximate sawtooth from 8 partials ~buf = Buffer.loadCollection(s, ~wt); { Osc.ar(~buf, 220) * 0.2 }.play;
Assessment
Write the Signal.sineFill call that creates a waveform with only odd harmonics (1st, 3rd, 5th) at equal amplitude — this approximates a square wave. What size would you use and why must it be a power of 2?