audioeffects.cabinetsim
CabinetSim - a designed guitar-cabinet response, two characters.
The player’s text is the class docstring; the CLAIMS table in the class’s
test file ties its claim sentences to tests.
- audioeffects.cabinetsim.HZ_GRID_LOW = 0.5
Quantisation grids (audiocomponents#75). Steps are integers or negative powers of two; the spread between a single- and a double-precision
macro_valueis at worst 5.7e-4, three orders of magnitude inside the coarsest of them, so both round to the same grid point.
- audioeffects.cabinetsim.STACK_BODY_HZ = 150.0
the sealed close-miked bump S3 measures with its -3 dB points at 115 and 232 Hz. Broad, because T5a reads 115 Hz.
- Type:
4x12 stack
- audioeffects.cabinetsim.COMBO_BODY_HZ = 115.0
the G12M’s hotter low end (S2 is -2.6 dB at 100 Hz where S1 is -6.4). Lower and narrower, so the character shows at 100 Hz and not at 1 kHz.
- Type:
1x12 combo
- audioeffects.cabinetsim.NOTCH_HZ = 245.0
The open back’s cancellation notch, above the combo’s bump so the notch has a shoulder on both sides inside 100-300 Hz at every Low Cut.
- audioeffects.cabinetsim.PEAK_A_RATIO = 0.8125
gridded_hz * ratiois exact in single and double precision alike.- Type:
Break-up. Exact binary fractions
- audioeffects.cabinetsim.SHELF1_RATIO = 1.3125
one broad shelf for T2’s floor, one steep for T1’s fall.
- Type:
The cliff
- audioeffects.cabinetsim.T3_BAND_LO = 0.7
the two maxima travel with Break-up, which is the macro whose whole job is to move them.
- Type:
T3’s band, re-cut in the fix round
- class audioeffects.cabinetsim.CabinetSim(source, *options, **keywords)[source]
Bases:
ComponentA designed 4x12 stack or 1x12 combo cabinet, built from filters rather than a recorded impulse.
Character.
4x12 stackis a sealed, close-miked box.1x12 combois an open back: at the same settings it has at least 3 dB more at 100 Hz than the stack, and a notch between 100 Hz and 300 Hz that stays at every Low Cut.Low Cut and Body. Low Cut and Body shape the bottom. 40 Hz sits at least 12 dB under 1 kHz at every patch, and 20 Hz at least 20 dB under at the default. 60 Hz stays at least 20 dB under over the whole Body travel, at 48 kHz, 44.1 kHz and 22.05 kHz.
Break-up and Bite. Break-up moves the speaker’s two break-up peaks; over its whole travel each stands at least 3 dB over 1 kHz with a dip of at least 2 dB between them. Bite sets how tall they are. At Bite 0 they are switched off, so there is no break-up at all.
Top and Air. Top and Air shape the top end. Between 5 kHz and 8 kHz the response falls by at least 15 dB at every patch. Between 8 kHz and 16 kHz it falls by no more than 12 dB at the default, and by more once Top is at its 7 kHz stop.
Mix. Mix blends every section at once, and Mix 0 is a wire. The top-end fall holds down to Mix MIDI 120 and is gone by 96; the low cut holds down to Mix MIDI 96 and is gone by 32.
Level. The response is a boost and there is no output trim, so leave headroom. At the hottest setting, combo with Low Cut 55 Hz and Body +6 dB, nothing reaches the rail below -14 dBFS; at the default, nothing does below -6 dBFS. Over the whole surface 1 kHz stays within 1 dB of the input. Below the ceiling the cabinet is linear. Well above it, it clips, and 1 kHz is where you won’t hear it.
Sample rate. At 48 kHz and 44.1 kHz it is the same cabinet within 0.5 dB. At 22.05 kHz the top changes: against 1 kHz, 5 kHz sits more than 3.5 dB higher and 7 kHz more than 3.5 dB lower than at 48 kHz, and the worst patch moves by between 4 dB and 6 dB.
Latency and tail. It adds no latency. The tail is 6144 samples at every shipped patch. The longest ring is the combo’s body bell, not the lowest Low Cut.
Your own impulse. Pass
impulse=some int16 frames and it convolves that instead, which needsaudioconvolve. The tail then grows by the impulse’s length.Macros. Each macro takes the 128 MIDI positions, and a fractional position snaps to the nearest, so a board and a desktop build the same filters.
Patches. Alone on an ESP32-S3 the default was measured at 28 % of a block. The Effect controls page lists what the knobs span and the patches.
It needs
audiobiquad, so a stock CircuitPython board can’t run it.- NAME = 'CabinetSim'
The stable provider name
audioeffects.create()discovers.
- TIER = 'audiodsp'
STOCK or AUDIODSP, with REQUIRES naming the audiodsp-own modules an AUDIODSP class needs.
- Type:
roadmap §3
- CAPABILITIES = ()
The contract’s static reads.
CAPABILITIESnames"tempo_sync"if and only if the class readsself._transport().
- TAIL_SAMPLES = 6144
a burst then silence, counted to the last non-zero sample. The longest ring is not the lowest Low Cut - it is the combo’s own bell, +8 dB of bias plus up to +6 of Body at 115 Hz Q 1.5, which rings longer than three high-pass poles do. At 48 kHz, a 0 dBFS burst: 5565 samples at the worst corner (combo, Low Cut 55, Body +6, burst at the bell’s own 115 Hz), 5493 at the default Low Cut with Body +6, 4421 at shipped patch 1, 2924 at Low Cut 55 with Body 0, and 1850 at the constructor default. Lower rates are shorter in frames (5079 at 44.1 kHz, 2557 at 22.05). 6144 is that worst case with 10 % margin, and the test holds the declaration in both directions.
- Type:
Measured over the whole shipped surface, not at three settings
- SURFACE_CEILING_DBFS = -14.0
The level above which the class’s own resonances reach the rail, at the worst combined macro cell and at the constructor default. The pack published -11 and -5, taken through a
macro_surface()that moves one macro at a time and therefore never swept Low Cut 55 with Body +6 - shipped patch 6’s own settings (audit 3 (p)2 and (p)3). Read in combination:fix2.analytic_dbatpeak_hzreturns +13.148 dB at combo with Low Cut 55 and Body +6 against a published +10.91, the ceiling there is -13 dBFS, and the default’s own peak is at 3164 Hz - a frequency the pack’s THD table never read - where the ceiling is -6 dBFS.The numbers were wrong in the safe direction, which is why they are a park and not a footnote: a user told -11 who plays at -11 clips.
These two are the no-railed-sample levels, which is what a user needs; the pack’s
clip_ceilingreads the highest level under 1 % THD and says -13 and -6 at the same cells, because a handful of railed samples in 4 096 is not 1 % of THD yet. At the worst combined cell the first railed sample is at -13 dBFS (153 of 4 096 at 115 Hz) and -14 is clean at 60, 115, 150 and 3164 Hz; the default is clean at -6 and above, its own peak being at 3164 Hz.
- MACRO_LABELS = ('Character', 'Low Cut', 'Body', 'Break-up', 'Bite', 'Top', 'Air', 'Mix')
Knob names, one per macro index; one mode per label; the private engineering spans behind them; and the patches on the 0-127 grid.
- set_macro(index, value, channel=0, note_id=-1, sample_position=0)[source]
Set macro
indexfrom the 0-127 MIDI scale.This surface is the 128 integer positions, and a float snaps to the nearest before anything else happens. The base class accepts floats “so a host with finer resolution need not quantize”; on this class a finer position is not safe to honour, because only those 128 per macro are proved to hand a board’s single precision and a desktop’s double the same filter (audiocomponents#75). The snap is done here, on the MIDI number the host passed, where
+ 0.5is exact in both precisions - snapping later, from the stored 0..1 position, would put the tie back at every half-step.get_macroreads back the snapped number, not the one sent. The one exception is the numberget_macroitself returns: sent straight back it is kept, so a constructor option off the grid survives a host’s echo.
- property tail_samples
The synthetic sections’ ring, or the user impulse’s length.
TAIL_SAMPLESis the eight-section number and the class returned it whateverimpulse=held: an 8 192-tap impulse measures 8 447 samples of tail and a 48 000-tap room measures 48 255, and a host that trusts 6 144 truncates the tail it was handed (audit 3 (p)1, G2). The convolver’s own ring is the impulse plus what the sections behind it add, so the declaration is the impulse’s length plus the synthetic figure - which is what those two measurements say, to 255 and 255 samples.