### Initializing EllipticBlep Class (C++) Source: https://github.com/signalsmith-audio/elliptic-blep/blob/main/README.md Includes the necessary header file and demonstrates how to create an instance of the `EllipticBlep` template class, typically using `float` as the data type. ```cpp #include "elliptic-blep.h" signalsmith::blep::EllipticBlep blep; ``` -------------------------------- ### Applying Phase Compensation with EllipticBlepAllpass (C++) Source: https://github.com/signalsmith-audio/elliptic-blep/blob/main/README.md Demonstrates the usage of the `EllipticBlepAllpass` class alongside `EllipticBlep` to achieve approximately linear phase. It shows how to instantiate the allpass filter, process the signal, and access the linear delay constant. ```cpp EllipticBlep blep; EllipticBlepAllpass blepAllpass; // using the BLEP in default mode (adding BLEP residue to a naive signal) float minPhaseY = aliasedY + blep.get(); // pass samples through the filters float approxLinearY = blepAllpass(minPhaseY); // It's best to use this constant, in case the filter gets redesigned later size_t linearLatency = EllipticBlepAllpass::linearDelay; ``` -------------------------------- ### Implementing Sawtooth Oscillator with Elliptic BLEP (C++) Source: https://github.com/signalsmith-audio/elliptic-blep/blob/main/README.md Provides a full C++ struct implementing a band-limited sawtooth oscillator. It demonstrates how to manage phase, use `EllipticBlep` to add discontinuity cancellation, and optionally apply phase correction with `EllipticBlepAllpass`. ```cpp struct SawtoothOscillator { float freq = 0.001f; // relative to sample-rate float amp = 1; void reset() { blep.reset(); allpass.reset(); phase = 0; } // next output sample float operator()() { phase += freq; blep.step(); while (phase >= 1) { float samplesInPast = (phase - 1)/freq; phase = (phase - 1); // -2 change, order-1 (step) discontinuity blep.add(-2, 1, samplesInPast); } float result = (2*phase - 1); // naive sawtooth result += blep.get(); // add in BLEP residue result = allpass(result); // (optional) phase correction return result*amp; } private: signalsmith::blep::EllipticBlep blep; signalsmith::blep::EllipticBlepAllpass allpass; float phase = 0; }; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.