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

Queue up samples then play all at once

Jun 11, 2013 at 1:03 AM
Hello, I'm working on a drum sequencer and am relatively new to Naudio so bare with me. So far I have it all working (looping through and playing the samples) but I have a feeling the way I implemented the sample play back will cause the accuracy to decline once more samples are added. This is the basics of what I have so far.

I'm using a AudioFileReader > WaveMixerStream32 > AsioOut . I load with mixer.AutoStop = False and AsioOut.Play() . Then in a timer I loop though and check for drum hits for each column per row of the sequencer. If a hit is found then I set the AudioFileReader.Posistion = 0 to play the sample. The problem is there will be a small delay between each sample played (on the same column) since I am using a loop to find each drum hit per row in the column.

Is there a way with Naudio to queue up multiple samples to be played all at once when called to?

(Note that I have taken a look at the drum machine sample provided and am quite blown away at the code since I normally program in . I am learning C# so any example code I can understand just not full on C# programs)

Also if anyone can suggest a more accurate timer to use in .NET that would be helpful. I'm currently using the System.Windows.Forms.Timer and its not the most accurate. I heard the multimedia timer from winmm.dll is suppose to be the best but I'm not quite sure how to implement it.
Jun 11, 2013 at 10:58 AM
I recommend you use the same approach I use in the drum machine sample. If understanding C# is hard for you, then try putting it through some of the free online VB to C# converters.