Generators
Commonly used generators such as oscillators, phasor (i.e. positive sawtooth) and others. This list will grow a bit over time.
oscil is sine wave oscillator, phasor is a sawtooth wave that can also be used as a periodic phase signal, noise is white noise and sample plays back a "sample".
Synth.oscil — Functionoscil(m :: Union{Real,Signal}, f :: Union{Real,Signal}, p :: Union{Real,Signal}; phase = 0.0)A "oscil" is a sinusoidal oscillator whose frequency and amplitude can be varied ("modulated") over time. The f argument is expected to be a frequency in Hz units. m determines the amplitude and p the phase in unit range. The phase named argument is a number in the range [0.0,1.0] determining the starting phase within the cycle. It is added to the overall phase evolution as a constant so that oscil can be used for a sine wave with 0.0 as the phase and as a cosine wave with 0.5 as the phase. This lets us do both FM and PM using the same unit.
An earlier approach was to have the second argument be a phasor. However, the phasor argument always ended up being passed as phasor(freq) and so it made sense to fold the frequency into oscil as the main control. This made for a simpler use of oscil, though a tad less general. So essentially oscil(m, f) is equivalent to oscil_v1(m, phasor(f)) where oscil_v1 was the previous version.
Synth.phasor — Functionphasor(f :: Real, phi0 = 0.0)
phasor(f :: Signal, phi0 = 0.0)A "phasor" is a signal that goes from 0.0 to 1.0 linearly and then loops back to 0.0. This is useful in a number of contexts including wavetable synthesis where the phasor can be used to lookup the wavetable.
Synth.saw — Functionsaw(f :: Union{Real,Signal}, phi0::Float64 = 0.0)A protected sawtooth wave (See protect)
Synth.tri — Functiontri(f :: Union{Real,Signal}, phi0::Float64 = 0.0)A protected triangular wave (See protect)
Synth.sq — Functionsq(f :: Union{Real,Signal}, phi0::Float64 = 0.0)A protected square wave (See protect). This is perhaps the harshest of them with a small possibility of aliasing, so the q factor for this is twice the usual.
Synth.noise — Functionnoise(rng :: AbstractRNG, amp :: Signal)
noise(rng :: AbstractRNG, amp :: Real = 1.0f0)
noise(amp :: Signal)
noise(amp :: Real = 1.0f0)Amplitude modulatable white noise generator.
noise(rng :: AbstractRNG, amp :: Signal)
noise(rng :: AbstractRNG, amp :: Real = 1.0f0)
noise(amp :: Signal)
noise(amp :: Real = 1.0f0)Amplitude modulatable white noise generator.
noise(rng :: AbstractRNG, amp :: Signal)
noise(rng :: AbstractRNG, amp :: Real = 1.0f0)
noise(amp :: Signal)
noise(amp :: Real = 1.0f0)Amplitude modulatable white noise generator.
noise(rng :: AbstractRNG, amp :: Signal)
noise(rng :: AbstractRNG, amp :: Real = 1.0f0)
noise(amp :: Signal)
noise(amp :: Real = 1.0f0)Amplitude modulatable white noise generator.
Synth.sample — Functionsample(samples :: Vector{Float32}; looping = false, loopto = 1.0)
sample(filename :: AbstractString; looping = false, loopto = 1.0, samplingrate=48000.0, selstart=0.0, selend=Inf)Produces a sampled signal which samples from the given array as a source. It starts from the beginning and goes on until the end of the array, but can be asked to loop back to a specified point after that.
- The
looptoargument is specified relative (i.e. scaled) to the length of the samples vector. So if you want to jump back to the middle, you give0.5as thelooptovalue. - The
selstartandselendkeyword arguments can be used to slice into the sound sample, with the default covering the entire file.
If the sample rate of the file is different from the selected samplingrate, the loaded samples will be converted to the given rate (uses DSP.resample).
To make slicing into large files efficient, files are loaded once and cached. This cache is looked up (based on the file name) every time a slice is needed.
sample(name :: Symbol) :: SampleRetrieve named sample. The retrieved sample will have the same looping settings as the stored sample, but not its running state.
Synth.register — Functionregister(name :: Symbol, s :: Sample)Associates the given name with the given sample so it can be retrieved using sample(::String).
register(name :: Symbol, wt :: Vector{Float32})
register(name :: Symbol, wt :: Wavetable)Associates the given wave table with the given name so it can be retrieved using wavetable(::String).