Quantcast
Channel: NVorbis
Viewing all articles
Browse latest Browse all 299

New Post: How to decode OGG to Wav from byte array properly?

$
0
0
To be honest, no. Your problem here is massive memory allocations. I'm seeing 1) the ogg file, 2) the write buffer (about 11x the ogg file size), and 3) the result buffer (same as # 2). That means for every minute of 44.1kHz stereo 128kbit audio you are using 21MB of RAM!

A better solution:
  • Use an audio library that supports PCM buffers instead of WAV. Make sure it supports partial buffers (it asks for small amounts of audio data at a time)
  • Make your custom file format reader support long-lived Stream instances with seeking, then pass that to VorbisReader...
  • Decode the ogg file as needed (only decode as much as you need to fill the requested buffer size)
I think you'll find that your memory requirements will be reduced drastically, and your performance increase significantly, if you make these changes.

Viewing all articles
Browse latest Browse all 299

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>