gen9 - make a function with a waveform, composed of any partials
makegen(table_number, 9, table_size, partial1_ratio, partial1_amp, partial1_phase [, ... partialN_ratio, partialN_amp, partialN_phase ])
Call makegen from a script with a function_type of 9 to make a function table with a waveform. You define the waveform in terms of any number of partials, harmonic or inharmonic, with specific amplitudes and starting phase for each.
Normally the table will be rescaled to fit between -1 and 1. Put a negative sign before the number to prevent this.
Note that inharmonic partials in are not truly inharmonic, since their periodicity is governed by the table size. In contrast, all harmonic partials complete an integer number of cycles spanning the table.
makegen(2, 9, 1000, 1, 1, 0)
makes one cycle of a sine wave, at full amplitude, with starting phase of 0 degrees. This is exactly equivalent to makegen(2, 10, 1000, 1).
makegen(-2, 9, 1000, 1, 0.5, 90)
makes one cycle of a cosine wave, at half amplitude (from -.5 to +.5). Making table_number negative prevents rescaling the function to span -1 to +1.
makegen(2, 9, 1000, 1, 1, 0, 2, 0.4, 90, 10.1, 0.1, 130)
makes a waveform with the first harmonic at amplitude 1 and phase 0, the second harmonic at amplitude 0.4 and phase 90, and an inharmonic partial with 10.1 times the frequency of the fundamental at amplitude 0.1 and phase 130.
makegen(1, 9, 1000, 0.5, 1, 0)
makes a waveform with one half-cycle of a sine wave, suitable for use as a grain envelope.
makegen(-1, 9, 1000, 0, 0.5, 90, 1, 0.5, -90)
makes a ``raised cosine'' shape, or hanning window. (Gen 25 does this more simply.) The DC component specified by the first triplet of arguments adds 0.5 to every point on the phase-shifted sine wave cycle specified by the second triplet of arguments, thus making all the table values positive. Not sure why DC phase has to be non-zero, but it does.
Gen 10 lets you specify a waveform more simply, but with only harmonic partials and no phase adjustment.