A deep dive into building real-time audio pipelines in React Native by bypassing file-based APIs and working directly with in-memory PCM buffers. Covers constructing a 44-byte WAV header in JavaScript using DataView, transferring raw audio data from native to JS via JSI ArrayBuffers with zero-copy semantics, merging header and PCM data in memory, and playing back the result using react-native-audio-api. Also shows how the resulting WAV buffer can be saved to disk for compatibility with other libraries like expo-audio.
Table of contents
Understanding PCM BuffersBuilding a WAV File in MemoryJSI and ArrayBuffersMerging Buffers in JavaScript with Buffer ViewsIn-Memory PlaybackBonus: Universal CompatibilitySummarySort: