This project has moved and is read-only. For the latest updates, please go here.

Multiple Wav with different volumes for a drum kit

Jan 22, 2013 at 10:42 AM

I have started with an electronic drum kit project at home and made progress to the point where I have data streaming over serial port from my kit. Now I need to play wav files to represent the drum data.

How do I load multiple wav files and play them back at the same time ? Keep in mind that a relatively long wav could be already playing and I want to play another one (or more) on top of it.

Any info would be appreciated greatly.

Jan 22, 2013 at 2:21 PM

If you have a look at the source code for the WPF Demo app you'll see a drum machine sample app which should give you a good starting point. It uses a MixingSample provider and then inserts the drum hits as new mixer inputs when needed. It automatically removes them as mixer inputs when they finish playing. This approach means you only need to open one sound device.

Jan 23, 2013 at 10:19 AM

I ran the pre-compiled demo and it look exactly like what i am looking for.  Thank you for the info.

I downloaded the demo source, but cannot get it to compile. I get the following error in MediaTypeVieeModel.cs :

using NAudio.MediaFoundation; -- the type or namespace name 'MediaFoundation' does not exist.

Is this in version 1.6 ?



Jan 23, 2013 at 10:29 AM

MediaFoundation is new to NAudio 1.7 (still in alpha). It's not part of the drum machine demo though, so you should be able to use that code with 1.6