I'd be happy to help you record audio in WAV format using LiveKit! You can achieve this by implementing a custom solution with client-side SDKs. Here’s a simple overview of how you can do it:
1.
Subscribe to an Audio Track: Use the SDK to detect when an audio track becomes available and access its raw audio frames.
2.
Create a WAV Header: You’ll need to construct a 44-byte RIFF-compliant WAV header using details like sample rate, bit depth, and number of channels.
3.
Write Header and Audio Data: Start by writing the WAV header to a file, then append the raw PCM audio data from the track in little-endian format.
4.
Finalize the WAV File: Once recording is finished, update the header with the final file size and data size so the file is properly formatted.
There are helpful examples available for Rust and Node.js SDKs that show how to handle raw audio streams and save them as WAV files. If you’re working with other platforms like Swift or Android, the same principles apply, and I’d be more than happy to help you put together a reference implementation.
Feel free to share which SDK or platform you’re using, and I can provide more tailored guidance or examples to support you!
Sources:
examples/receive-audio/index.ts |
Processing raw media tracks | LiveKit Docs |
examples/save_to_disk/src/main.rs |
src/room/track/record.ts |
Capturing the First Few Seconds of a Call for Processing