Switched from Uint8Array to Float32Array for level monitoring to get accurate, full-precision audio measurements. The Problem: - getByteTimeDomainData() uses Uint8Array (0-255) - Byte conversion: (value - 128) / 128 has asymmetric range - Positive peaks: (255-128)/128 = 0.992 (not full 1.0) - Precision loss from byte quantization - Mastered tracks with peaks at 0dBFS only showed ~50% The Solution: - Switched to getFloatTimeDomainData() with Float32Array - Returns actual sample values directly in -1.0 to +1.0 range - No conversion needed, no precision loss - Accurate representation of audio peaks Changes Applied: - useMultiTrackPlayer: Float32Array with analyser.fftSize samples - useRecording: Float32Array with analyser.fftSize samples - Peak detection: Math.abs() on float values directly Benefits: ✅ Full 0-100% range for properly mastered audio ✅ Higher precision (32-bit float vs 8-bit byte) ✅ Symmetric range (-1.0 to +1.0, not -1.0 to ~0.992) ✅ Accurate metering for professional audio files Now mastered tracks with peaks at 0dBFS will correctly show ~100% on the meters instead of being capped at 50%. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
19 KiB
19 KiB