Overview

This document compares Memory Weaver's web-based psychoacoustic processing with traditional CLI-based audio processing tools (like Sox, FFmpeg, Python scripts) and outlines our development roadmap.

Technical Architecture Comparison

WEB BROWSER APPROACH                    CLI/SCRIPT APPROACH
┌─────────────────────┐                ┌─────────────────────┐
│   User Interface    │                │  Terminal/Script    │
│   (React + HTML)    │                │  (Python/Node/C++)  │
├─────────────────────┤                ├─────────────────────┤
│   Web Audio API     │                │  Native Libraries   │
│  (JavaScript RT)    │                │ (LibSndFile, FFTW) │
├─────────────────────┤                ├─────────────────────┤
│  Browser Sandbox    │                │   Direct Memory     │
│   (Limited RAM)     │                │  (Full System RAM)  │
├─────────────────────┤                ├─────────────────────┤
│    Audio Output     │                │    File Output      │
│  (Real-time only)   │                │  (Batch Process)    │
└─────────────────────┘                └─────────────────────┘

Processing Capabilities Comparison

Aspect Web Browser (Current) CLI/Script Based Memory Weaver Next Phase
Execution Model Real-time, single-threaded Batch, multi-threaded Real-time + Web Workers
Audio I/O Stream only via Web Audio File-based (WAV, FLAC, MP3) Stream + file export
Processing Type Live/interactive Offline/batch Hybrid approach
Memory Model ~2GB browser limit Full system memory 4GB SharedArrayBuffer
Precision Float32 (limited) Float64 available Float32 optimized
Dependencies None (browser built-in) External libs required WASM modules

Feature Implementation Comparison

Feature Web Implementation CLI Implementation Planned Web Upgrade
Binaural Beats ✅ Real-time generation ✅ Pre-generated files ✅ Advanced synthesis
FFT Analysis ⚠️ Limited resolution ✅ High-res FFTW 🔄 WebAssembly FFT
Convolution Reverb ❌ Too CPU intensive ✅ Offline processing 🔄 Optimized convolver
Batch Processing ❌ Not supported ✅ Core strength 🔄 Background workers
File Formats ⚠️ Limited (via browser) ✅ All formats 🔄 More format support
Plugin Support ❌ Not possible ✅ VST/AU hosting ⚠️ Web Audio Modules

Code Execution Differences

CLI/Script Approach (Python Example)

# Traditional CLI psychoacoustic processing
import numpy as np
import scipy.signal as signal
import librosa

# Load and process entire file
audio, sr = librosa.load('input.wav', sr=None)
# Apply psychoacoustic model (can be complex)
processed = apply_psychoacoustic_model(audio)
# Save result
librosa.output.write_wav('output.wav', processed, sr)

Web Browser Approach (JavaScript)

// Real-time psychoacoustic processing
const audioContext = new AudioContext();
const processor = audioContext.createScriptProcessor(4096);

processor.onaudioprocess = (e) => {
  // Process small chunks in real-time
  const input = e.inputBuffer.getChannelData(0);
  const output = e.outputBuffer.getChannelData(0);
  // Limited processing per chunk
  applyPsychoacousticModel(input, output);
};

Performance Metrics

Metric Web Browser CLI/Script Notes
Startup Time <100ms 500ms-2s Web wins for quick tasks
Processing Speed 1x real-time 10-100x real-time CLI better for batch
Max File Size ~500MB Unlimited* Browser memory limits
Concurrent Jobs 1-4 CPU core count Web Workers limited
Power Efficiency Low High Native code advantage

Development Workflow Comparison

CLI Development

┌─────────┐     ┌──────────┐     ┌─────────┐
│  Write  │ --> │  Debug   │ --> │ Deploy  │
│ Script  │     │ Terminal │     │ Server  │
└─────────┘     └──────────┘     └─────────┘
     ↓                                 ↓
[Local Files]                    [Batch Jobs]

Web Development

┌─────────┐     ┌──────────┐     ┌─────────┐
│  Code   │ --> │ Browser  │ --> │  User   │
│ JS/WASM │     │ Testing  │     │ Access  │
└─────────┘     └──────────┘     └─────────┘
     ↓                                 ↓
[Live Preview]                   [Instant Use]