Skip to content

feat: Synthetic noise generation .apr model (WASM-first) #144

@noahgift

Description

@noahgift

Summary

Build a .apr model for generating synthetic audio noise (white, brown, pink, etc.) using ML/DL techniques. WASM-first approach enables browser-based interactive demos and CLI execution.

Motivation

  • Demonstrate .apr format capabilities with audio generation
  • WASM-first architecture for instant web demos
  • Showcase ML-based audio synthesis vs traditional DSP
  • Provide infinitely customizable noise generation beyond static presets

Requirements

Core Features

  • .apr model that generates continuous noise streams
  • WASM build for browser deployment
  • CLI execution via aprender run noise.apr
  • Real-time parameter adjustment (no model reload)

Noise Types (via ML generation)

Type Characteristics
White Flat frequency spectrum
Brown/Red -6 dB/octave, deeper
Pink -3 dB/octave, balanced
Blue +3 dB/octave, brighter
Violet +6 dB/octave
Custom User-defined spectral profile

Customization Parameters

  • Spectral shape: Arbitrary frequency curve (not just fixed slopes)
  • Modulation: LFO on amplitude, frequency bands
  • Binaural: Optional stereo offset for binaural beats
  • Texture: Grain size, smoothness, rhythmic patterns
  • Blend: Mix multiple noise profiles

WASM Demo Interface

┌─────────────────────────────────────────┐
│  🎵 Noise Generator                     │
├─────────────────────────────────────────┤
│  Type: [White ▾] [Brown] [Pink] [Custom]│
│                                         │
│  Spectral Curve:  ═══════════╲          │
│                              ╲          │
│  Depth:     ████████░░ 80%              │
│  Texture:   ██████░░░░ 60%              │
│  Modulation:███░░░░░░░ 30%              │
│                                         │
│  [▶ Play]  [⏸ Pause]  [💾 Export .apr]  │
└─────────────────────────────────────────┘

Technical Approach

Option A: Diffusion-based

  • Small diffusion model for audio generation
  • Spectral conditioning for noise color
  • Higher quality, more compute

Option B: Autoencoder + Decoder

  • VAE-style latent space for noise characteristics
  • Fast inference, lower memory
  • Easier WASM deployment

Option C: Neural vocoder adaptation

  • WaveNet/WaveGrad style generation
  • Real-time streaming possible
  • Most complex

Recommended: Start with Option B for WASM feasibility, iterate to A/C.

Dependencies

  • aprender::audio (mel, resample - already exists)
  • trueno (SIMD acceleration)
  • wasm-bindgen / web-sys (browser integration)
  • Web Audio API for playback

Acceptance Criteria

  1. cargo build --target wasm32-unknown-unknown --features audio succeeds
  2. Demo page loads model and generates audio in <2s
  3. Parameter changes reflect in audio within 50ms
  4. Model size <5MB for fast web loading
  5. Works offline after initial load

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions