Skip to main content

Wave: filter

ReverbWave AWave BWave CEnvelope #0Envelope #1Envelope #2Envelope #3Envelope #4DDleftrightAPPLY_EFFECTChannel Block (there are six of them)RIGHT_LEVEL*REVERB_LEVEL*LEFT_LEVEL*APPLY_WIDENER80 samples (3.6ms)DelayEffectD
Where we are in the synthesizer diagram
LowpassOscillatorOSCILLATOR_SHAPEOSCILLATOR_HZ*PULSE_WIDTH*OSCILLATOR_LEVEL*FILTER_KINDFILTER_HZ*FILTER_RESONANCEDIGITAR_MODEDIGITAR_BLENDDIGITAR_HZ*DIGITAR_FEEDBACK*OUTPUT_LEVEL*FilterDelayDigitar Block (Wave A/B only)Input Gate+/- Blend
Wave component (filter highlighted)

What is a digital filter?

A foundational principle of DSP theory is that complex sound waves are "made of" frequencies: mathematically, the waveform of any everyday sound can be reconstructed by adding together different levels of pure tones (sine waves with particular phase offsets) at each frequency. Going in the reverse direction, we can break a sound apart into its component frequencies and graph them over time as a spectrogram. This graph visually captures characteristics such as the pitch and tone of a note, well enough that a person can often guess the kind of instrument by looking at the spectrogram for a particular note.

A filter shapes a sound by increasing or decreasing the level of each frequency in the signal. The filter's frequency response graph plots these increases/decreases visually, similar to a graphic equalizer on a home stereo system. Your mouth can act as a mechanical filter: for example, if the sound of your voice is "ahh", by moving your lips you can shape it into "wahhh" or "wow" without altering the pitch, mimicking the sound of a bandpass filter or lowpass filter.

Computer programs can implement a digital filter that adjusts frequencies by applying calculations to each sample of a signal. Designing filters is a rich topic with many possible approaches. Jamdac uses a trapezoidally integrated state variable filter. Without getting into details, its main benefit is that it requires very little code, and it maintains very little state from sample to sample—just two numbers! The arithmetic does not involve any square roots or trigonometry.

Caution: Extreme parameter settings can cause the filter's state variables to overflow. The filter will enter an error state where its output is all zeros (silence). The error will get cleared when the next note is triggered.

FILTER_KIND

The FILTER_KIND offers five choices: lowpass, bandpass, highpass, notch reject, and peak. You can find extensive explanations and tutorials about them on the web. Synthesizers mainly use the lowpass, bandpass, and highpass filter kinds. The other two are just easy extras: The notch reject filter is approximated as lowpass plus highpass. The peak filter is lowpass minus highpass.

FILTER_HZ

The cutoff frequency for the filter is a parameter that roughly determines the "bend" in the frequency response graph. For the bandpass, notch reject, and peak filter, FILTER_HZ is basically the pitch (center frequency) that we're isolating, removing, or emphasizing. For the lowpass and highpass filter, FILTER_HZ is supposed to indicate the frequency beyond which we start reducing the signal, but it's a fairly broad paintbrush. Accurately controlling individual frequencies is quite challenging even with high quality algorithms.

FILTER_RESONANCE

For Hybrix's filters, the FILTER_RESONANCE parameter very approximately determines the fatness of the bend in the frequency response graph. The default value is 0.8, and most of the time you won't need to change it.

OUTPUT_LEVEL

The OUTPUT_LEVEL parameter allows you to adjust the volume level of the output after it has been filtered.

I/O definitions

CLASS IO_WAVE # SIZE 30
# 0=NONE, 1=TRIANGLE, 2=SAW, 3=PULSE, 4=NOISE
VAR OSCILLATOR_SHAPE: BYTE

# UNITS: HERTZ
INSET OSCILLATOR_HZ: IO_DYNAMIC

# UNITS: S6.10 FIXED POINT
INSET OSCILLATOR_LEVEL: IO_DYNAMIC

# UNITS: S6.10 FIXED POINT, RANGE 0.0 .. 1.0
# 0.0 PRODUCES CONSTANT OUTPUT OF -1.0
# 1.0 PRODUCES CONSTANT OUTPUT OF 1.0
INSET PULSE_WIDTH: IO_DYNAMIC

# 0 = NONE
# 1 = LOWPASS
# 2 = BANDPASS
# 3 = HIGHPASS
# 4 = NOTCH
# 5 = PEAK
VAR FILTER_KIND: BYTE

# UNITS: HERTZ INDICATING THE FILTER'S CUTOFF FREQUENCY
INSET FILTER_HZ: IO_DYNAMIC

# UNITS: S6.10 FIXED POINT, RANGE 0.0 .. 1.0
VAR FILTER_RESONANCE: PAIR

# UNITS: S6.10 FIXED POINT
INSET OUTPUT_LEVEL: IO_DYNAMIC

# 0=DRY, 1=CHANNEL EFFECT
VAR APPLY_EFFECT: BYTE
END CLASS