debug.lib

Debug library. Its official prefix is db.

This library provides UI-based debug probes for metering and diagnostics. It includes RMS/Peak meters, dynamics probes, signal quality probes, and simple band-energy meters.

Debug probes can be compiled out by setting the DEBUG global to 0 via explicit substitution (e.g. db[DEBUG=0;].probe_rms_db(...)). CNE means constant numerical expression (known at compile time).

The Debug library is organized into 6 sections:

References

Level Probes


(db.)probe_rms_db

RMS level probe (dB). Bargraph includes [unit:dB].

Usage

_ : probe_rms_db(ID, HIDE) : _

Where:

  • ID: (CNE) probe id integer used in [probe:ID]
  • HIDE: (CNE) 0 to show, 1 to hide in UI

Test

db = library("debug.lib");
os = library("oscillators.lib");
probe_rms_db_test = db.probe_rms_db(0, 1, os.osc(220));

(db.)probe_rms_lin

RMS level probe (linear).

Usage

_ : probe_rms_lin(ID, HIDE) : _

Where:

  • ID: (CNE) probe id integer used in [probe:ID]
  • HIDE: (CNE) 0 to show, 1 to hide in UI

Test

db = library("debug.lib");
os = library("oscillators.lib");
probe_rms_lin_test = db.probe_rms_lin(1, 1, os.osc(220));

(db.)probe_peak_db

Peak level probe (dB). Bargraph includes [unit:dB].

Usage

_ : probe_peak_db(ID, HIDE) : _

Where:

  • ID: (CNE) probe id integer used in [probe:ID]
  • HIDE: (CNE) 0 to show, 1 to hide in UI

Test

db = library("debug.lib");
os = library("oscillators.lib");
probe_peak_db_test = db.probe_peak_db(2, 1, os.osc(220));

(db.)probe_peak_lin

Peak level probe (linear).

Usage

_ : probe_peak_lin(ID, HIDE) : _

Where:

  • ID: (CNE) probe id integer used in [probe:ID]
  • HIDE: (CNE) 0 to show, 1 to hide in UI

Test

db = library("debug.lib");
os = library("oscillators.lib");
probe_peak_lin_test = db.probe_peak_lin(3, 1, os.osc(220));

Dynamics Probes


(db.)probe_crest_db

Crest factor probe (peak/rms ratio in dB).

Usage

_ : probe_crest_db(ID, HIDE) : _

Where:

  • ID: (CNE) probe id integer used in [probe:ID]
  • HIDE: (CNE) 0 to show, 1 to hide in UI

Test

db = library("debug.lib");
os = library("oscillators.lib");
probe_crest_db_test = db.probe_crest_db(4, 1, os.osc(220));

(db.)probe_env

Envelope follower probe (attack/release).

Usage

_ : probe_env(ID, HIDE) : _

Where:

  • ID: (CNE) probe id integer used in [probe:ID]
  • HIDE: (CNE) 0 to show, 1 to hide in UI

Test

db = library("debug.lib");
os = library("oscillators.lib");
probe_env_test = db.probe_env(5, 1, os.osc(220));

(db.)probe_min

Minimum-hold probe (inverted peak envelope).

Usage

_ : probe_min(ID, HIDE) : _

Where:

  • ID: (CNE) probe id integer used in [probe:ID]
  • HIDE: (CNE) 0 to show, 1 to hide in UI

Test

db = library("debug.lib");
os = library("oscillators.lib");
probe_min_test = db.probe_min(6, 1, os.osc(220));

(db.)probe_max

Maximum-hold probe (slow peak envelope).

Usage

_ : probe_max(ID, HIDE) : _

Where:

  • ID: (CNE) probe id integer used in [probe:ID]
  • HIDE: (CNE) 0 to show, 1 to hide in UI

Test

db = library("debug.lib");
os = library("oscillators.lib");
probe_max_test = db.probe_max(7, 1, os.osc(220));

Signal Quality Probes


(db.)probe_dc

DC offset probe (very lowpass).

Usage

_ : probe_dc(ID, HIDE) : _

Where:

  • ID: (CNE) probe id integer used in [probe:ID]
  • HIDE: (CNE) 0 to show, 1 to hide in UI

Test

db = library("debug.lib");
os = library("oscillators.lib");
probe_dc_test = db.probe_dc(8, 1, os.osc(220));

(db.)probe_slew

Slew rate probe (RMS of signal derivative).

Usage

_ : probe_slew(ID, HIDE) : _

Where:

  • ID: (CNE) probe id integer used in [probe:ID]
  • HIDE: (CNE) 0 to show, 1 to hide in UI

Test

db = library("debug.lib");
os = library("oscillators.lib");
probe_slew_test = db.probe_slew(9, 1, os.osc(220));

(db.)probe_zcr

Zero-crossing rate probe (lowpassed).

Usage

_ : probe_zcr(ID, HIDE) : _

Where:

  • ID: (CNE) probe id integer used in [probe:ID]
  • HIDE: (CNE) 0 to show, 1 to hide in UI

Test

db = library("debug.lib");
os = library("oscillators.lib");
probe_zcr_test = db.probe_zcr(10, 1, os.osc(220));

Control Signal Probes


(db.)probe_value

Raw value probe (no smoothing).

Usage

_ : probe_value(ID, HIDE) : _

Where:

  • ID: (CNE) probe id integer used in [probe:ID]
  • HIDE: (CNE) 0 to show, 1 to hide in UI

Test

db = library("debug.lib");
os = library("oscillators.lib");
probe_value_test = db.probe_value(11, 1, os.osc(220));

(db.)probe_bool

Boolean probe (gate/trigger state).

Usage

_ : probe_bool(ID, HIDE) : _

Where:

  • ID: (CNE) probe id integer used in [probe:ID]
  • HIDE: (CNE) 0 to show, 1 to hide in UI

Test

db = library("debug.lib");
os = library("oscillators.lib");
probe_bool_test = db.probe_bool(12, 1, os.osc(220) > 0);

Spectral Probes


(db.)probe_band_lo

Low-band energy probe (<300 Hz).

Usage

_ : probe_band_lo(ID, HIDE) : _

Where:

  • ID: (CNE) probe id integer used in [probe:ID]
  • HIDE: (CNE) 0 to show, 1 to hide in UI

Test

db = library("debug.lib");
os = library("oscillators.lib");
probe_band_lo_test = db.probe_band_lo(13, 1, os.osc(220));

(db.)probe_band_mid

Mid-band energy probe (300 Hz - 3 kHz).

Usage

_ : probe_band_mid(ID, HIDE) : _

Where:

  • ID: (CNE) probe id integer used in [probe:ID]
  • HIDE: (CNE) 0 to show, 1 to hide in UI

Test

db = library("debug.lib");
os = library("oscillators.lib");
probe_band_mid_test = db.probe_band_mid(14, 1, os.osc(220));

(db.)probe_band_hi

High-band energy probe (>3 kHz).

Usage

_ : probe_band_hi(ID, HIDE) : _

Where:

  • ID: (CNE) probe id integer used in [probe:ID]
  • HIDE: (CNE) 0 to show, 1 to hide in UI

Test

db = library("debug.lib");
os = library("oscillators.lib");
probe_band_hi_test = db.probe_band_hi(15, 1, os.osc(220));

Tap Utilities


(db.)probe_tap

Tap a signal for side-effect analysis without changing output arity.

Usage

_ : probe_tap(F) : _

Where:

  • F: signal processor for the tap (e.g., meter, analyser)

Example test program

Tap a pre-filter signal without changing arity:

  • The probe taps the signal before the filter.
  • The main signal path remains 1-in/1-out, so the lowpass still sees a mono input.
  • The RMS probe runs in parallel and is exposed through the UI/metrics.
db = library("debug.lib");
os = library("oscillators.lib");
fi = library("filters.lib");
process = os.osc(220)
  : db.probe_tap(db.probe_rms_db(0, 1))
  : fi.lowpass(4, 2000);

Test

db = library("debug.lib");
os = library("oscillators.lib");
tap_test = db.probe_tap(db.probe_rms_db(0, 1), os.osc(220));

(db.)probe_tap_n

Tap an N-channel signal with a processor that takes N inputs and produces 1 output. The original N-channel signal passes through unchanged.

Usage

probe_tap_n(N, F)

Where:

  • N: (CNE) number of channels
  • F: processor with N inputs and 1 output (e.g., sum or mix meter)

Example test program

Tap a stereo signal with a mixdown probe:

  • Two oscillators build a stereo pair with different filters per channel.
  • After a stereo EQ stage, probe_tap_n mixes both channels for a single probe.
  • The stereo signal continues unchanged after the tap (2-in/2-out).
db = library("debug.lib");
os = library("oscillators.lib");
fi = library("filters.lib");
left = os.osc(220) : fi.lowpass(2, 1200);
right = os.osc(330) : fi.highpass(2, 400);
stereo = (left, right)
  : (fi.lowpass(2, 2000), fi.highpass(2, 700));
process = stereo
  : db.probe_tap_n(2,  + : db.probe_rms_db(100, 1))
  : (fi.lowpass(2, 8000), fi.lowpass(2, 8000));

Test

db = library("debug.lib");
os = library("oscillators.lib");
tap_n_test = (os.osc(220), os.osc(330)) : db.probe_tap_n(2, +);