Output multiple audio to individual sound card channels - c#

I have an eight channel sound card. 8 audio in and 8 audio out. When the driver for the sound card is installed, the following is shown on Playback devices.
Play 1-2
Play 3-4
Play 5-6
Play 7-8
I can enumerate all 4 devices (Play 1-2,Play 3-4) and play on each of them. The current situation only allows me to have 4 audio outputs. The sound card also has individual audio out wires/port for each channel.
What I want to do is to play on Play 1, Play 2, Play 3, etc. Is there any way to achieve this. I am currently using NAudio to enumerate and playback.

You can play two independent mono streams out of one of the stereo pairs using MultiplexingSampleProvider or MultiplexingWaveProvider. If you want to treat the whole soundcard as a single device, then I've found AsioOut tends to be the only option and again you can use the multiplexing providers to route individual NAudio wavestreams to the different device outputs.

Related

Observed periodic noise with ASIO sound card in my audio processing application

I observe noise which shows up periodically (every 5 seconds or so) when i use Asio sound card with the custom built audio processing application visualisation tab which displays the frequency analysis.
The noise is not observed when using a Direct Sound card with the same audio.
I have tried changing the number of channels that are listening to the audio for Asio from 8 to 2 but that doesn't fix the issue!
The sampling rate is 48kHz.( Tweaked it to 44kHz, doesn't fix the issue).
The audio processing application is written in C# and made use of NAudio API.
I've included the images for the waveform in the link:
https://www.sendbig.com/view-files?Id=8fe0ff05-d27e-9ec2-161f-415d923599b7
The first image is the clean signal with no noise and the next image shows the audio along with the noise.
Any inputs on this is appreciated!

How to output two different audio to two audio devices separately from same Unity3d application

I am developing a two player game in which one player will have to hear one type of audio and second player to hear different audio. The computer is planned to be connected with two audio devices - one headset and another headset using usb sound card. The game is planned to be developed using Unity3d. How to split audio? Is it possible to use FMOD and generate this? How to send separate audio from same game to separate audio devices ? Thanks!

Send sound to concrete output channel in Unity3D

I would like to know how can I send sound to concrete output channel in Unity3D. I have 3 output channels (and three speakers connected to 5.1 audiocard) and I want to put unique mono sound to everyone and one common spatial stereo sound to all of them with center in 2nd channel. Can I do it without additional tools like FMOD or WWISE?
P.S. I'm using Unity3D 5.4.0 and I would like to use Unity Mixer in this project. Regular stereo WAV files are the sources of sound.

How can I send an audio stream from the output device to an input device?

I am working on a project where I am playing a wave file using naudio to someone over the phone through a softphone. The person making the call, wearing a usb headset (which is an external soundcard) would need to be able to speak along with the wave files. Right now I'm running a dual 3.5mm audio cable from the output into the input on the back of the computer to make this happen. This is making me have to use the onboard sound card for the wave and the head set for the person to speak which means I have to switch the default input audio device on-demand to allow the person to be heard or the wave to be heard. This causes issue with the softphone app depending on how its devices are set. I want to cut out the onboard soundcard altogether. I want to send both my wave audio and the person speaking, into the same input device.
When I play the audio this is the code I call:
WaveStream waveStream = new WaveFileReader(#"C:\Users\Public\Music\tester.wav");
WaveOut waveOut = new WaveOut();
waveOut.DeviceNumber = int.Parse(device1);
WaveOut.Init(waveStream);
WaveOut.Play();
At this point I would love to not only send to the selected output device but also to an input device as well. Is there any simple ways I can do this? Thanks for your help in advance.
Unfortunately, the various Windows audio APIs provide no way for you to replace the audio received by an actual input device with your own audio, so this isn't something you can achieve out of the box with NAudio. What you need is to create a virtual audio input device. This is quite a lot of work, so the simplest solution is to purchase something like Virtual Audio Cable, which will allow you to create virtual sound devices and patch them together.

Need multiple sound outputs to multiple speakers

How do I play 3 different music tracks at the same time on my computer, such that song1 is played in speaker1, song2 in speaker2...
Is this possible programatically? What additional hardware will I need? Do I need 3 seperate sound cards? Given that the hardware is in place, how would I "route" the sound output for a particular song to a particular speaker.
Alternatively, is there a special hardware that can handle multiple inputs and outputs?
Appreciate your expert opinions.
http://www.esi-audio.com/products/maya44usb+/ Try this with the NAudio c# Libary look at AsioOut and the MultiplexingWaveProvider
Provided that you have as many outputs (total) as you have songs you are all set (I'm assuming you'll just be playing each song in mono). The simplest way to tackle this problem is to open one "stream" for each song and play the song through that stream. You'll have to do some work to open each stream with the right number of channels and ensure that the song is played in the correct channel.
There are two potential problems with that technique: 1. some audio API/hardware combinations don't allow multiple streams to access the same device. This is most commonly an issue on windows/ASIO, but it may be an issue in other cases -- I am not a windows expert. 2. it is a bit tricky to ensure that all streams are exactly synchronized. If you require tight synchronization you should use a single stream and a single hardware device.
If the above issues are a concern, then you should get some audio hardware with at lest three outputs, and open one stream with access to three channels.
You can use PortAudio for audio I/O, and libsoundfile for reading the sound files (of course, there are other options for both these tasks).

Categories

Resources