In my work, we had to use a ring buffer to play audio data (we decode audio data to raw WAV and use a ring buffer for playback).
Interestingly, while the core part of the audio process is in rust (through WASM), the ring buffer itself is written in JS land (shared array buffer so that the audio context can read from it).