Skip to main content

Module ir

Module ir 

Source
Expand description

Impulse responses for the pedal’s user CAB (IR) slots (docs/05): reading and writing WAV files, resampling, and the conversion to the pedal’s upload format.

convert is the official app’s IR conversion, recovered from its native code (docs/05) and matching its uploads exactly: a file that isn’t a 48 kHz mono 24-bit WAV is first converted to one (first channel, JUCE’s resampler, 24-bit); the first IR_TAPS samples are time-reversed and scaled so that the response between 398 Hz and 3 kHz is centred on 0 dB. The upload itself is crate::upload::user_ir_upload / Device::import_user_ir.

Structs§

ConvertedIr
An IR converted for upload.
Wav
A decoded WAV file: one sample vector per channel, scaled to ±1.0.

Enums§

Encoding
Sample encoding of a WAV file.
Method
How an IR is converted.
WavError

Constants§

IR_SAMPLE_RATE
The pedal’s sample rate.
IR_TAPS
Samples per uploaded IR (42.7 ms at 48 kHz).
PEDAL_IR_TAPS
Samples of an uploaded IR that the pedal actually plays (8 ms): data[1664..2048], i.e. taps 0..383. Measured by re-amping probe IRs (docs/05).

Functions§

app_gain
The app’s gain: 1 / √(max |X| · min |X|) over bins 136–1023 of the 16384-point spectrum of the first IR_TAPS samples, i.e. the band’s peak and trough end up symmetric about 0 dB.
convert
Convert an IR exactly as the official app does (docs/05):
convert_optimised
The optimised conversion: a PEDAL_IR_TAPS-tap filter (the part of an upload the pedal plays) with the whole IR’s 1/6-octave magnitude response, instead of the IR’s first 2048 samples cut off by the pedal after 384. The file is resampled with resample (windowed sinc); the filter is minimum-phase (no leading delay, energy packed into the start), refined over a few iterations, then fitted tap by tap to the full IR’s band levels. Its level is the one the app means to give the IR (app_gain on the IR’s first 2048 samples from its onset), matched over 100 Hz – 8 kHz. The unused part of the upload is zero.
convert_with
Convert with the given Method.
resample
Resample x from from Hz to to Hz: windowed-sinc interpolation (Kaiser, β = 9, 32 zero crossings each side), low-pass at 95 % of the lower Nyquist frequency. The output covers the same duration (ceil(len · to / from) samples), with no delay.
resample_like_app
Resample like the official app: JUCE’s ResamplingAudioSource (linear interpolation, with its low-pass applied to the input when downsampling and to the output when upsampling, none within ±0.01 % of 1:1), writing ⌊len · to / from⌋ samples.
slot_name
The slot name the official app gives an imported IR: the file name without its extension, cut to 16 characters (seen in the one captured import; the record has room for 31).