Generators
Commonly used generators such as oscillators, phasor (i.e. positive sawtooth) and others. This list will grow a bit over time.
sinosc 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.sinosc — Functionsinosc(m :: Union{Real,Signal}, f :: Union{Real,Signal}; phase = 0.0)A "sinosc" 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 f the frequency in Hz. The phase named argument is a number in the range [0.0,1.0] determining the starting phase within the cycle.
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 sinosc as the main control. This made for a simpler use of sinosc, though a tad less general. So essentially sinosc(m, f) is equivalent to sinosc_v1(m, phasor(f)) where sinosc_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.
Currently sample rate conversion is not supported, though that is a feature that must be added at some point.
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).