✅ How to play an MP3 from byte data array instead of writing it to a file and then playing it?

Hey, anyone know how I can play an MP3 directly from a byte array?

This is what I currently have which works but I'd like to avoid writing it to an .mp3 file as there's no point in keeping it and it feels wrong to
Write > Play > Delete
if I can just play it directly from the byte array.
await File.WriteAllBytesAsync($"{voiceClip.Id}.mp3", voiceClip.ClipData.ToArray());
var reader = new Mp3FileReader($"{voiceClip.Id}.mp3");
var waveOut = new WaveOut(); // or WaveOutEvent()
waveOut.Init(reader);
waveOut.Play();
Was this page helpful?