Quantcast
Channel: naudio Work Item Rss Feed
Viewing all articles
Browse latest Browse all 738

Commented Issue: Playing Short Audio Files [16377]

$
0
0
I'm writing a game and I'd like to use NAudio to add sound to it. I followed a few examples and was rather pleased with NAudio's API and performance.

I ran into the following issue: NAudio will not play short audio files. I've used WaveChannel32.Length to get the following numbers.
Files with length 755712 or less will not play.
Files with length 5935104 do play.
I'm not sure where the exact limit is. There are no exceptions thrown. I was hoping to use NAudio to play files of about 1 second long. Is anyone else having this issue? Is there a fix? Do I need to find a different library?
Comments: there should be no problem with short sounds. I've made a drum machine example in the WPF demo that plays loads of short sounds. I can't see a problem with your code although WaveMixerStream32 is an ancient class that really I'd like to take out of NAudio - it was written for one very specific application a long time ago. If you can, I'd recommend using a similar approach to the WPF demo app. Use AudioFileReader to get your samples as an ISampleProvider, and the MixingSampleProvider to mix them together.

Viewing all articles
Browse latest Browse all 738

Trending Articles



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