Name
Synth -- synthesise/modulate audio tones or noise signals
Synopsis
synth [-j KEY] [-n] [len [off [ph [p1 [p2 [p3]]]]]] {[type] [combine]
      [[%]freq[k][:|+|/|-[%]freq2[k]]] [off [ph [p1 [p2 [p3]]]]]}
Function
This effect can be used to generate fixed or swept frequency audio tones with various wave shapes, or to generate wide-band noise of various "colours". Multiple synth effects can be cascaded to produce more complex waveforms; at each stage it is possible to choose whether the generated waveform will be mixed with, or modulated onto the output from the previous stage. Audio for each channel in a multi-channel audio sample can be synthesised independently.

Note that since this effect is generative you need to use soundfx.Generate() instead of soundfx.Process() with this effect. You might also want to set the Channels, Bits, and Frequency tags when calling soundfx.Generate() to set the desired sample format. The length can also be specified as a parameter to synth or by another given effect that has an associated length.

For example, the following produces a 3 second audio sample containing a sine-wave swept from 300 to 3300 Hz:

 
synth 3 sine 300-3300

Multiple channels can be synthesised by specifying the set of parameters shown between braces multiple times; the following puts the swept tone in the left channel and adds "brown" noise in the right:

 
synth 3 sine 300-3300 brownnoise

The following example shows how two synth effects can be cascaded to create a more complex waveform:

 
synth 0.5 sine 200-500 synth 0.5 sine fmod 700-100

Frequencies can also be given in "scientific" note notation, or, by prefixing a "%" character, as a number of semitones relative to "middle A" (440 Hz). For example, the following could be used to help tune a guitar's low "E" string:

 
synth 4 pluck %-29

N.B.: This effect generates audio at maximum volume (0dBFS), which means that there is a high chance of clipping when using the audio subsequently, so in many cases, you will want to follow this effect with the gain effect to prevent this from happening. (See also Clipping above.) Note that, by default, the synth effect incorporates the functionality of gain -h (see the gain effect for details); synth's -n option may be given to disable this behaviour.

A detailed description of each synth parameter follows:

len is the length of audio to synthesise (any time specification); a value of 0 indicated to use the input length, which is also the default.

type is one of sine, square, triangle, sawtooth, trapezium, exp, [white]noise, tpdfnoise, pinknoise, brownnoise, pluck; default=sine.

combine is one of create, mix, amod (amplitude modulation), fmod (frequency modulation); default=create.

freq / freq2 are the frequencies at the beginning/end of synthesis in Hz or, if preceded with "%", semitones relative to A (440 Hz); alternatively, "scientific" note notation (e.g. E2) may be used. The default frequency is 440Hz. By default, the tuning used with the note notations is "equal temperament"; the -j KEY option selects "just intonation", where KEY is an integer number of semitones relative to A (so for example, -9 or 3 selects the key of C), or a note in scientific notation.

If freq2 is given, then len must also have been given and the generated tone will be swept between the given frequencies. The two given frequencies must be separated by one of the characters ":", "+", "/", or "-". This character is used to specify the sweep function as follows:

:
Linear: the tone will change by a fixed number of hertz per second.

+
Square: a second-order function is used to change the tone.

/
Exponential: the tone will change by a fixed number of semitones per second.

-
Exponential: as "/", but initial phase always zero, and stepped (less smooth) frequency changes.

Not used for noise.

off is the bias (DC-offset) of the signal in percent; default=0.

ph is the phase shift in percentage of 1 cycle; default=0. Not used for noise.

p1 is the percentage of each cycle that is "on" (square), or "rising" (triangle, exp, trapezium); default=50 (square, triangle, exp), default=10 (trapezium), or sustain (pluck); default=40.

p2 (trapezium): the percentage through each cycle at which "falling" begins; default=50. exp: the amplitude in multiples of 2dB; default=50, or tone-1 (pluck); default=20.

p3 (trapezium): the percentage through each cycle at which "falling" ends; default=60, or tone-2 (pluck); default=90.


Show TOC