WASM Stage API Test

Instrument Controls

Instrument Controls

πŸ₯ Bass Drum
1.00
200Hz
0.010s
0.100s
0.70
0.300s
πŸ₯ Snare
1.00
300Hz
0.001s
0.050s
0.30
0.100s
πŸ”” Hi-hat
1.00
440Hz
0.001s
0.020s
0.20
0.050s
πŸ₯½ Cymbal
1.00
600Hz
0.005s
0.200s
0.80
0.500s

πŸŽ›οΈ FM Synthesis

Status:

WASM Stage: ❌ Not loaded

FM Oscillator: ❌ Not loaded

FM Enabled: ⏸️ Disabled

Audio Context: ❌ No

Audio Playing: ❌ No

Stage API Demo:

  • β€’ Multi-instrument: Stage contains 4 oscillators with independent controls
  • β€’ Individual control: Trigger each instrument separately
  • β€’ Group control: Trigger all instruments simultaneously
  • β€’ Enable/disable: Toggle instruments on/off to mute/unmute individual instruments
  • β€’ Volume control: Adjust volume (0.0-1.0) for each instrument
  • β€’ Frequency control: Adjust frequency (50-2000Hz) for each instrument
  • β€’ Waveform control: Select waveform type (Sine, Square, Saw, Triangle, Ring Mod) for each instrument
  • β€’ Ring modulation: Modulator frequency control for Ring Mod waveform
  • β€’ ADSR envelope: Real-time Attack, Decay, Sustain, Release control per instrument
  • β€’ FM Synthesis: Dedicated FM oscillator with carrier/modulator frequency control
  • β€’ FM Modulation Index: ADSR envelope controls modulation depth over time
  • β€’ Release control: Manually trigger release phase for individual or all instruments
  • β€’ Audio mixing: Stage.tick() sums all instrument outputs with controls applied

Instructions:

  1. Click "Load Stage" to initialize the WASM Stage with 4 oscillators + FM oscillator
  2. Click "Start Audio" to begin audio processing
  3. Use individual instrument buttons to test single oscillators
  4. Adjust instrument controls for each oscillator:
    • Enable/Disable: Click ON/OFF button to mute/unmute individual instruments
    • Volume: Control relative volume of each instrument (0.0-1.0)
    • Frequency: Change the pitch of each instrument (50-2000Hz)
    • Waveform: Select tone quality (Sine, Square, Saw, Triangle, Ring Mod)
    • Modulator: Control modulator frequency for Ring Mod waveform (50-2000Hz)
  5. Adjust ADSR envelope controls to shape the sound envelope:
    • Attack: Time to reach full volume (0.001-2s)
    • Decay: Time to drop to sustain level (0.001-2s)
    • Sustain: Level held while triggered (0-1)
    • Release: Time to fade to silence (0.001-5s)
  6. FM Synthesis: Check "Enable FM" to activate FM synthesis controls:
    • Carrier: Main frequency that gets modulated (50-2000Hz)
    • Modulator: Frequency that modulates the carrier (1-1000Hz)
    • Modulation Index ADSR: Controls how much modulation is applied over time
    • Trigger FM: Play the FM oscillator sound independently
  7. Use "Release" buttons to manually trigger the release phase
  8. Use "Release All" to release all instruments simultaneously
  9. Use "Trigger All" to hear the mixed output of all instruments with all controls applied