oscy
A Rust library for audio oscillators and waveform generation.
Oscillators
| Oscillator | Description |
|---|---|
NaiveOsc |
Simple oscillator without anti-aliasing. Fast but produces aliasing at higher frequencies. |
PolyBlepOsc |
Band-limited oscillator using polyBLEP for reduced aliasing. |
| More | Additional implementations planned. |
Usage
Filling an audio buffer
use ;
let mut osc = new;
let mut buffer = ;
osc.fill;
Using as an iterator
use ;
let osc = new;
let samples: = osc.take.collect;
Naive vs PolyBLEP
Use NaiveOsc when performance is critical and aliasing is acceptable (e.g., low frequencies, or when followed by filtering). Use PolyBlepOsc for cleaner sound at higher frequencies.
use ;
// Naive: simple and fast, but aliases
let mut naive = new;
// PolyBLEP: smooths discontinuities to reduce aliasing
let mut blep = new;
Supported waveforms
- Sine
- Saw
- Square
- Triangle
License
MIT License - see LICENSE for details.