Technical Features Explained
1. The Audio Pipeline
The app uses a standard oscillator-to-gain routing. The Gain Node acts as our master volume, while the Oscillator Node generates the raw waveform.
2. Waveform Types
Sine: A smooth, pure tone (perfect for tuning).
Square: Contains only odd harmonics, sounding "hollow" or like a vintage game console.
Sawtooth: Contains all harmonics, sounding very bright and buzzy.
Triangle: Soft like a sine but with a bit more "edge."
3. Logarithmic vs. Linear
Frequency is perceived logarithmically. While the slider in this code is linear for simplicity, I have capped the range at 20,000Hz (the limit of human hearing).
4. Anti-Popping
When changing volume or frequency, I use setTargetAtTime instead of setValueAtTime. This adds a micro-fade (exponential smoothing) to prevent audible "clicks" or "pops" that happen when an audio signal changes instantly.