D
D
Dmitry2014-05-12 17:53:06
Audio
Dmitry, 2014-05-12 17:53:06

How to simultaneously play 2 audio files in C#, each on its own speaker?

The situation is as follows, there are 2 speakers connected to the same PC, but located in different rooms.
Under a certain condition, the application (windofs forms) must play 2 audio files, each will be heard only from its own speaker.
Downloaded several different libraries - NAudio, LibZplay. It turns out to display the file on one column, the volume of the second is reduced. And how to do for two files, I'll never know.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2014-05-12
@abcdefghijklmnopqrstuvwz

Understood:

var input1 = new WaveFileReader(файл1.wav");
var input2 = new WaveFileReader(файл2.wav");                   
 var waveProvider = new MultiplexingWaveProvider(new IWaveProvider[] { input1, input2 }, 2);
waveProvider.ConnectInputToOutput(0, 0);
waveProvider.ConnectInputToOutput(1, 1);

WaveOut Device = new WaveOut(); 
Device.Init(waveProvider);
 Device.Play();

And everything is fine.

A
aush, 2014-05-12
@aush

You need to make one of these two files - it will have the first file in the left channel, and the second in the right. Like here , just the other way around.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question