This project has moved. For the latest updates, please go here.

can Naudio take 2 16bit arrays and play them as stereo

Mar 29 at 12:32 AM
I'm working on a project to create and electronic version of a musical instrument and I've figured out I'm having some phase issues between some of the samples. Each sample is recorded at 44100, 16 bit mono. It is exactly 1 cycle for the frequency. I need to be able to feed two 16 bit streams in preferably from two 16 bit integer arrays and shifting one to play ahead or behind the other so that I can get the best match for phase between the two channels. The plan is to feed the output real time to Adobe Audition and use it's frequency and phase analysis tools to do the visualization.

For this to work and make it easy, I want to play the 1 cycle in a loop but increase or decrease the starting point for one loop relative to what is playing in the other channel. Once I figure out the best offset to use I'll recreate the data array to start at that point. This data is then used in an Arduino type processor to actually reproduce the sound based on the wave data for each note.

I guess this all boils down to can NAudio take two 16bit arrays and feed them separately in as left and right channel of a stereo wave output?

Can I control the starting point and duration in terms of number of samples when playing?

That way I can keep the number of samples I need for a note but start it further in than the first data point. In order to allow for the shift my plan is to duplicate the wave so that it can be clipped to the right number of samples and still preserve the integrity of the wave itself.