//using NAudio.Wave;
var input1 = new WaveFileReader(path1);
var input2 = new WaveFileReader(path2);
var mono1 = new StereoToMonoProvider16(input1);
var mono2 = new StereoToMonoProvider16(input2);
var stereo1 = new MonoToStereoProvider16(mono1);
stereo1.LeftVolume = 1;
stereo1.RightVolume = 0;
var stereo2 = new MonoToStereoProvider16(mono2);
stereo2.LeftVolume = 0;
stereo2.RightVolume = 1;
var f1 = new Wave16ToFloatProvider(stereo1);
var f2 = new Wave16ToFloatProvider(stereo2);
var mix = new NAudio.Wave.MixingWaveProvider32(new IWaveProvider[] { f1, f2 });
WaveOut wave = new WaveOut();
wave.Init(mix);
wave.Play();
Separating audio left and right
Hello,
I have two wav audio files.
I want to hear these two files separately from the left and right outputs of my headphone.
I have an attempt below but;
When the script runs, the sound of two files comes from the left and right channels, and the sound of one file is quieter but audible.
I want to completely separate the two audio files. For example, my test1.wav file should only play on the left headphone output.
I'm waiting for your help.
var input1 = new WaveFileReader("c:\deneme\test1.wav");
var input2 = new WaveFileReader("c:\deneme\test2.wav");
MultiplexingWaveProvider waveProvider = new MultiplexingWaveProvider(new IWaveProvider[] { input1, input2 }, 2);
waveProvider.ConnectInputToOutput(1,1);
WaveOut wave = new WaveOut();
wave.Init(waveProvider);
wave.Play();
My respects
-
gekka 9,181 Reputation points MVP
2023-11-14T22:53:21.0066667+00:00