|
TR123e - EMCT Computing Final Project Version 1.0
Research Project Translation from gen~ to embedded Moog synth
|
High-fidelity scalar implementation of Huovilainen Moog ladder filter. More...
#include <MoogLadderFilterBase.h>
Public Member Functions | |
| MoogLadderFilterScalar (float sampleRate) | |
| Construct scalar Moog filter with sample rate configuration. | |
| void | reset () |
| Reset all filter state variables to zero. | |
| void | setSampleRate (float sr) |
| Update sample rate and recalculate dependent coefficients. | |
| void | setParams (float cutoffHz, float resonance, int mode) |
| Configure filter parameters with unified interface. | |
| float | process (float in1, float in2, float in3, float in4) |
| Process audio sample through complete Huovilainen algorithm. | |
| MoogLadderFilterScalar (float sampleRate) | |
| Construct scalar Moog filter with exact Gen~ parameter mapping. | |
| void | reset () |
| Reset all filter state to match Gen~ reset behavior. | |
| void | setSampleRate (float sr_) |
| Update sample rate and recalculate derived coefficients. | |
| void | setParams (float cutoffHz, float resonanceVal, int modeSel) |
| Set filter parameters with exact Gen~ parameter mapping. | |
| float | process (float in1, float in2, float in3, float in4) |
| Process audio sample with exact Gen~ algorithm implementation. | |
| MoogLadderFilterScalar (float sampleRate) | |
| Construct enhanced scalar filter with sample rate configuration. | |
| void | reset () |
| Reset all filter state with enhanced clearing. | |
| void | setSampleRate (float sr) |
| Update sample rate with enhanced coefficient recalculation. | |
| void | setParams (float cutoffHz, float resonance, int mode) |
| Set parameters with corrected semantics and improved validation. | |
| float | process (float in1, float in2, float in3, float in4) |
| Process audio with corrected input mapping and enhanced stability. | |
Private Attributes | |
| float | s1 |
| Comprehensive filter state variable set. | |
| float | s2 |
| float | s3 |
| float | s4 |
| float | s5 |
| float | s6 |
| float | s7 |
| float | s8 |
| Filter stage states with improved precision. | |
| float | slim |
| Saturation limiter state for nonlinear feedback modeling. | |
| float | previn |
| Previous input sample for feedback calculations. | |
| float | fc |
| Filter parameter storage. | |
| float | rc |
| Resonance and frequency control parameters. | |
| float | expr1 |
| float | expr2 |
| Sample rate dependent coefficients with improved calculation. | |
| float | sr |
| System configuration parameters. | |
| int | mode |
| Filter mode selection state. | |
High-fidelity scalar implementation of Huovilainen Moog ladder filter.
Enhanced scalar Moog ladder filter with improved stability and interface.
Direct scalar translation of Gen~ moogLadderFilter with complete fidelity.
This class provides a complete scalar implementation of the Huovilainen Moog ladder filter model, serving as the reference implementation for algorithmic validation and performance comparison. The implementation maintains exact compatibility with the original Gen~ code while providing optimized C++ structure and comprehensive state management.
@design_characteristics
@implementation_fidelity The scalar implementation maintains:
@performance_profile
@applications
This class provides an exact scalar implementation of the Huovilainen Moog ladder filter as originally implemented in Max/MSP Gen~. Every coefficient, calculation order, and state variable has been preserved to ensure bit-exact compatibility with the original visual programming implementation.
@design_principles
@state_variable_mapping The implementation maintains exact correspondence with Gen~ history operators:
@mathematical_preservation All empirical coefficients from the original research are preserved:
@applications
This class provides a refined scalar implementation of the Huovilainen Moog ladder filter with improved utility functions, corrected parameter handling, and enhanced numerical stability while maintaining exact algorithmic compatibility with the original Gen~ implementation.
@enhancement_focus
| MoogLadderFilterScalar::MoogLadderFilterScalar | ( | float | sampleRate | ) |
Construct scalar Moog filter with sample rate configuration.
Initialize scalar filter with Gen~ compatible setup.
| sampleRate | Audio processing sample rate for coefficient calculation |
Initializes the filter with sample rate dependent parameters and establishes default state for immediate processing capability.
| MoogLadderFilterScalar::MoogLadderFilterScalar | ( | float | sampleRate | ) |
Construct scalar Moog filter with exact Gen~ parameter mapping.
| sampleRate | Audio processing sample rate for coefficient calculation |
Initializes the filter with exact replication of Gen~ initialization sequence, including sample rate dependent coefficient calculation and state variable clearing.
| MoogLadderFilterScalar::MoogLadderFilterScalar | ( | float | sampleRate | ) |
Construct enhanced scalar filter with sample rate configuration.
| sampleRate | Audio processing sample rate for coefficient calculation |
| float MoogLadderFilterScalar::process | ( | float | in1, |
| float | in2, | ||
| float | in3, | ||
| float | in4 ) |
Process audio sample through complete Huovilainen algorithm.
Process sample with complete Gen~ algorithm implementation.
| in1 | Primary audio input signal |
| in2 | Resonance modulation signal |
| in3 | Envelope control signal |
| in4 | Thermal noise input signal |
Updated process semantics with corrected input mapping:
This method implements every mathematical operation from the original Gen~ code in exactly the same order with identical coefficients, ensuring bit-exact compatibility with the visual programming version.
SECTION 1: INPUT CONDITIONING (Exact Gen~ sequence) Add thermal noise and process envelope control exactly as in Gen~
SECTION 2: RESONANCE MODULATION (Gen~ envelope shaping) Process resonance control with envelope modulation using exact coefficients
SECTION 3: COEFFICIENT CALCULATION (Exact Gen~ polynomial) Calculate filter coefficients using exact polynomial approximation from original Huovilainen model as implemented in Gen~
SECTION 4: FIRST ITERATION (Gen~ initial processing) Implement first pass through ladder with nonlinear saturation using exact saturation curve and coefficient application
SECTION 5: SECOND ITERATION (Gen~ accuracy refinement) Implement second pass for improved nonlinear accuracy using refined feedback and state calculations
SECTION 6: MODE CALCULATIONS (Complete Gen~ mode set) Calculate all six filter modes using exact Gen~ coefficients and signal combination methods
SECTION 7: MODE SELECTION (Gen~ switch implementation) Select appropriate output based on mode parameter using exact Gen~ mode indexing and default behavior
SECTION 8: STATE UPDATES (Exact Gen~ state management) Update all state variables in exact order as performed by Gen~ history operator updates
| float MoogLadderFilterScalar::process | ( | float | in1, |
| float | in2, | ||
| float | in3, | ||
| float | in4 ) |
Process audio sample with exact Gen~ algorithm implementation.
| in1 | Primary audio input (Gen~ inlet 1) |
| in2 | Envelope control signal (Gen~ inlet 2) |
| in3 | Resonance modulation (Gen~ inlet 3) |
| in4 | Thermal noise input (Gen~ inlet 4) |
Implements the complete dual-iteration Huovilainen algorithm exactly as coded in the original Gen~ patch, preserving every mathematical operation and coefficient application.
@algorithm_fidelity
@processing_stages
| float MoogLadderFilterScalar::process | ( | float | in1, |
| float | in2, | ||
| float | in3, | ||
| float | in4 ) |
Process audio with corrected input mapping and enhanced stability.
| in1 | Primary audio input with improved conditioning |
| in2 | Resonance modulation with corrected processing |
| in3 | Envelope control with enhanced scaling |
| in4 | Thermal noise with improved integration |
| void MoogLadderFilterScalar::reset | ( | ) |
Reset all filter state variables to zero.
Reset all state variables to exact Gen~ defaults.
Clears all internal state to eliminate residual signal content and prepare for clean processing of new audio material.
Implements exact state clearing as performed by Gen~ reset, ensuring identical initialization behavior across implementations.
| void MoogLadderFilterScalar::reset | ( | ) |
Reset all filter state to match Gen~ reset behavior.
Clears all state variables to exact zero values as performed by Gen~ reset functionality, ensuring identical startup behavior.
| void MoogLadderFilterScalar::reset | ( | ) |
Reset all filter state with enhanced clearing.
Improved state clearing that ensures complete elimination of residual content while preparing filter for optimal startup behavior.
| void MoogLadderFilterScalar::setParams | ( | float | cutoffHz, |
| float | resonanceVal, | ||
| int | modeSel ) |
Configure filter parameters with unified interface.
Set parameters with exact Gen~ parameter interpretation.
| cutoffHz | Cutoff frequency in Hz |
| resonance | Resonance amount [0.0-1.0] |
| mode | Filter mode selection [0-5] |
Updated interface with corrected parameter semantics:
Maintains exact parameter processing including range validation and internal format conversion as performed in original Gen~ code.
| void MoogLadderFilterScalar::setParams | ( | float | cutoffHz, |
| float | resonance, | ||
| int | mode ) |
Set parameters with corrected semantics and improved validation.
| cutoffHz | Cutoff frequency in Hz with enhanced range validation |
| resonance | Resonance amount [0.0-1.0] with improved scaling |
| mode | Filter mode selection [0-5] with consistent indexing |
| void MoogLadderFilterScalar::setParams | ( | float | cutoffHz, |
| float | resonanceVal, | ||
| int | modeSel ) |
Set filter parameters with exact Gen~ parameter mapping.
| cutoffHz | Cutoff frequency in Hz (exact Gen~ scaling) |
| resonanceVal | Resonance amount [0.0-1.0] (Gen~ range) |
| modeSel | Filter mode selection [0-5] (Gen~ mode indices) |
Implements exact parameter processing as performed in Gen~ including range validation and internal format conversion.
| void MoogLadderFilterScalar::setSampleRate | ( | float | sr_ | ) |
Update sample rate and recalculate dependent coefficients.
Update sample rate with exact Gen~ coefficient calculation.
| sr | New sample rate for coefficient recalculation |
Updates all sample rate dependent parameters and coefficients to maintain accurate filter behavior at new processing rate.
Implements the exact mathematical operations performed in Gen~ for sample rate dependent coefficient generation.
| void MoogLadderFilterScalar::setSampleRate | ( | float | sr | ) |
Update sample rate with enhanced coefficient recalculation.
| sr | New sample rate for improved coefficient computation |
| void MoogLadderFilterScalar::setSampleRate | ( | float | sr_ | ) |
Update sample rate and recalculate derived coefficients.
| sr_ | New sample rate for coefficient recalculation |
Implements exact Gen~ sample rate update logic including frequency scaling factor calculation and warping compensation.
|
private |
|
private |
Sample rate dependent coefficients with improved calculation.
|
private |
Filter parameter storage.
Resonance and frequency parameters with corrected scaling.
Current parameter values and derived coefficients:
|
private |
Filter mode selection state.
Filter mode selection with consistent indexing.
Integer mode selector matching Gen~ mode parameter for six-mode filter response selection.
|
private |
Previous input sample for feedback calculations.
Saturation and delay states with enhanced stability.
Maps to Gen~ previn history operator providing temporal delay element essential for feedback topology.
|
private |
Resonance and frequency control parameters.
Direct correspondence with Gen~ param objects maintaining exact parameter interpretation and scaling behavior.
|
private |
Comprehensive filter state variable set.
Filter stage state variables [s1-s8].
Complete state preservation matching Gen~ history operators:
Direct mapping from Gen~ history operators maintaining exact correspondence with visual programming state storage.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Filter stage states with improved precision.
|
private |
Saturation limiter state for nonlinear feedback modeling.
Corresponds to Gen~ slim history operator maintaining saturation memory across processing iterations.
|
private |
System configuration parameters.
System and filter parameters with enhanced organization.
Sample rate and derived coefficients.
System parameters matching Gen~ internal calculations for sample rate dependent coefficient generation.
Sample rate for coefficient calculation