Filters

Linear time invariant first and second filters, with controllable filter parameters. Main ones are lpf, hpf and bpf second order filters. Also, delay and tap make a delay line that can be tapped at multiple points.

Synth.filter1Function
filter1(s :: Signal, gain :: Signal)

A first order filter where the gain factor that controls the bandwidth of the filter can be live controlled.

source
Synth.filter2Function
filter2(s :: Signal, f :: Signal, g :: Signal)
filter2(s :: Signal, f :: Signal, g :: Real)
filter2(s :: Signal, f :: Real, g :: Real)

Constructs a second order filter where the frequency and the gamma can be controlled live.

source
Synth.firFunction
fir(filt :: Vector{Float32}, sig :: Signal)

Constructs a "finite impulse response" (FIR) filter with the given filt as the impulse response. Keep the filt argument short (to within about 1000 samples) in order for fir to be able to perform in realtime. The algorithm used is not suitable for very large FIR filter lengths ... which we'll perhaps add in the future.

source
Synth.lpfFunction
lpf(sig :: Signal, freq, q; samplingrate=48000)

Standard second order LPF with frequency and Q factor.

source
Synth.bpfFunction
bpf(sig :: Signal, freq, q; samplingrate=48000)

Standard second order bandpass filter with given centre frequency and Q factor.

source
Synth.bpf0Function
bpf0(sig :: Signal, freq, q; samplingrate=48000)

Standard second order bandpass filter with given centre frequency and Q factor. This variant of bpf gives constant 0dB peak gain instead of the peak gain being determined by Q.

source
Synth.hpfFunction
hpf(sig :: Signal, freq, q; samplingrate=48000)

Standard second order high pass filter with given cut off frequency and Q.

source
Synth.delayFunction
delay(sig :: Signal, maxdelay :: Real; samplingrate=48000)

Sets up a delay ring buffer through which the given signal is passed. A delay is pretty much a pass through and is useful only in conjunction with tap. A delay can fanout on its own, which means you can make multiple tap points on the same delay based on time varying tap locations.

  • sig is the signal that is delayed.
  • maxdelay is the maximum amount of delay possible.
  • samplingrate is the sampling rate in Hz. (This is needed to compute buffer size.)
source
Synth.tapFunction
tap(d :: Delay, t :: Signal)
tap(d :: Delay, t :: Real)

You can setup multiple time varying tap points on a delay line by calling tap multiple times and using it elsewhere. Since a delay is intrinsically fanout capable, this is possible without further ado.

source
Synth.maxdelayFunction
maxdelay(sig :: Delay)

Returns the maximum delay (in seconds) supported by the given delay unit.

source
Synth.protectFunction
protect(sig::Signal; cutoff::Real = 4000.0f0, q::Real = 10.0f0)

Does a simple LPF of the signal with a modest cut off frequency to prevent too many high frequencies from getting through and possibly causing aliasing effects.

source