Synth mode is entered by synth(COMMANDS).
Synth mode is the simplest of the input modes. During parsing of COMMANDS, the program maintains four sets of parameters, (wave, vib, tone, and power) which determine the frequency, waveform, shape, amplitude, vibrato, and pitch-sweep of any waveforms applied to a specified patch of music. These are set using the following functions.
@SLOT chooses the slot to be used for future waveform generation.
wave(DATA). This specifies the frequency, amplitude, and offset of any applied waveforms. To generate an instrument which plays at the normally expected pitch, specify a frequency for the fundamental of 440 Hz.
amp(AMP). Equivalent to wave(??? AMP) Sets amplitude alone.
stereo(DATA). If specified, applies amplitude weightings to a two-channel synthesised wave. Default is full amplitude on both channels.
bias(X). Equivalent to wave(0 X). Does not alter the sample. (Deprecated - use c() instead.)
vib(DATA). This specifies the frequency, amplitude, and offset of any vibrato applied (0 for none), plus the magnitude of any pitch-sweep (<1 for falling, >1 for rising).
bend(VAL). Sets pitch-sweep alone as a per-second multiplier.
power=POW. Sine waves can be modified by distorting their shape using this parameter. Values <1 will result in a squarer waveform; >1, more peaked.
tone(DATA). Specifies the frequency, amplitude, and offset to be applied to power to vary the tone of generated sounds.
pitch_adjust(BOOL). This is turned off by default. When turned on, the oscillator frequencies are adjusted for real-time note synthesis.
Waveforms can be imposed using the following functions. For waveforms, the currently set parameters (see above) are used. These are additive and do not silence any sound already present. Where the amplitude is currently set (by wave() etc.) to A...
sine(): despite the name, generates a cosine wave. I.e. it begins at time 0 at a high value A assuming 0 offset.
c(): generates a constant amplitude at the amplitude A specified.
square(): square wave (max and min values of +A and -A).
saw(): sawtooth (discontinuous). A negative amplitude will invert the shape of the waveform.
triangle(): triangle (continuous).
The following waveforms use the power and tone settings, but are slower to synthesise. They are generalisations of the above four waveforms.
distort(): cosine wave, using the distortion power parameter, and optionally the tone oscillator, previously set, applied to the unsigned value at each sample point.
pulse(): pulse (discontinuous). generalises square. The width of the pulse is given by the distortion parameter. power=1 produces a square wave. Sensible values are 0 to 2.
distort_triangle(): generalises sawtooth (power of 0 or 2) and triangle (power of 1). Any intermediate power value may be used.
fundamental(F): sets the fundamental frequency for use in...
sines(1 0 0.5 0 0.25 ... list of amplitudes): overlays a series of sine waves at multiples of the fundamental, where the amplitude of each is denoted in any acceptable format. The fundamental (with a system default of 440 Hz unless specified) is the first entry, and any number of entries may be specified.
white(): white noise, using the amplitude earlier set by wave().
crackle(): crackle noise, using the frequency earlier set by wave().
Using samples as a source of noise
smatter(with=SOURCE f=FREQ pitch(low=A high=B log) amp(low=C high=D log) stereo(left=L right=R)): Adds FREQ copies per second of SOURCE on top of the currently selected slot. Pitch is selected (as a multiple of SOURCE's native pitch) from the range given by A to B, logarithmic if log is specified. Amplitude (as a multiplier) as treated similarly. Stereo position is selected for each copy within the range given by L to R, which can range from -1 (full left) to +1 (full right).
filter(LIST OF FILTERS): allows access to filters from within Synth mode (e.g. inside karpus_strong(...)).