0

I want to do something like that:

Two stereo cards and I want to play music completely selectively, this means 1.mp3 on 1 channel in 1 sound card and 1 channel on 2 sound card, 2.mp3 on 2 channel in 1 sound card and 3.mp3 na 2 channel in 2 sound card. And changing that just in time.

I read about that few evenings and in my opinion best way is use NAudio, but I try to prepare hello world app in this scope and I have huge problems.

This is my code:

        WaveOut waveOut1 = new WaveOut();
       

        
        var input2 = new Mp3FileReader(@"c:\sample2.mp3");
        var input1 = new Mp3FileReader(@"c:\sample3.mp3");
        
           var waveProvider = new MultiplexingWaveProvider(new IWaveProvider[] { input1, input2 }, 2);
           waveProvider.ConnectInputToOutput(0, 0);
          

        waveOut1.Init(waveProvider);
        waveOut1.Play();
        

And if I changed connectinputtooutput args 0,1;1,0;0,0;1,1 I still hear input nr 2 on each channel (checked on two sound cards).

If I play these mp3 directly both working well.

This was my inspiration: https://markheath.net/post/handling-multi-channel-audio-in-naudio

Can somebody tell my why this script not working properly?

Or maybe you have simpler solution to achieve this? Maybe for linux?

thank you K.

  • The link is using one card with multiple channels while you want to use two cards. So you need two instances of the Mp3FileReader with each instance connected to a different card. – jdweng Sep 26 '20 at 09:55
  • I know. But if I want to be able to manage sound among 4 channels using 2 sound cards then I should do this on one card. For example I want to play 1.mp3 on left speaker and 2.mp3 on right speaker. My script in each configuration play second mp3 on each channels. This is a problem on this stage. – user1253359 Sep 26 '20 at 10:39
  • You have 1,0 and 1,1 So input 1 is on output outputs 0 and 1. – jdweng Sep 26 '20 at 11:48
  • "And if I changed connectinputtooutput args 0,1;1,0;0,0;1,1 I still hear input nr 2 on each channel (checked on two sound cards)." – user1253359 Sep 26 '20 at 17:11
  • That is even worse. Now you have 0,1 and 0,0 so input channel 0 is on both output channels 1 and 0, Then you have 1,0 and 1,1 so input channel 1 is also on both output 0 and 1. – jdweng Sep 26 '20 at 21:54

0 Answers0