1
\$\begingroup\$

We're looking to create a split screen game using Unity that is highly reliant on audio. We would need each player to have their own headphones and use positional audio to navigate through the map.

Is it possible to output different sound (depend on each player's location) to a set of headphones? If I remember correctly, there may be a limitation in Unity and Windows where only one output device can be used. Is this true or is there some way to go about doing this?

If not, would we just have to resolve to running two instances of the game and using network play?

Thanks!

\$\endgroup\$
  • 1
    \$\begingroup\$ You seem to assume the user is using a headset. I would assume the opposite - I know a lot of gamers that don't have a headset. They all have phones, though, and as a result, they almost all have 3.5mm earphones. Have you considered asking the user to use a single headset, and using the channels as your player one and player two? If you ask player one to use the left earpiece, and player two to use the right earpiece, this might be a suitable solution for local play. \$\endgroup\$ – Gnemlock Feb 4 '17 at 3:16
  • \$\begingroup\$ Windows abstracts the raw input and output away (this is also the same reason you can't tell which keyboard he/she uses). If you want to output different sounds for different audio devices, then you need to somehow do that yourself. Considering that you use unity, there's a really low chance you can actually do this. Also, there are almost no sound cards that have two outputs, and using a splitter is like using only one audio device \$\endgroup\$ – Bálint Feb 4 '17 at 14:06
  • \$\begingroup\$ @Gnemlock raises an interesting point about phones. If a single computer is unlikely to have two audio outputs that you can control independently, could you instead run a companion game on each player's phone, which receives networked instructions about what audio to play? Like the Jackbox games, this would let you scale to an arbitrary number of players who each bring their own phone & earbuds, so long as your gameplay & audio design can tolerate a small amount of wifi latency... \$\endgroup\$ – DMGregory Feb 4 '17 at 15:14
  • \$\begingroup\$ Sorry, I missed an important point. The first prototype will be shown at a game conference, so we have full control and will provide two headphones. Using channels will eliminate the ability to use 3D positional audio to find sources of the audio. As for different audio devices, I was thinking that front and back audio on a computer does act as separate devices, so this may work. Just not sure how to make this work in Unity. \$\endgroup\$ – Abubakr Feb 4 '17 at 18:10
  • 1
    \$\begingroup\$ @Abubakr You should edit the question and add that in! \$\endgroup\$ – Alexandre Vaillancourt Feb 4 '17 at 21:47
1
\$\begingroup\$

As far as I can tell Unity does not support this. That doesn't mean it can't be done. What you need is a managed wrapper for a native library that allows such fine control.

You could try using NAudio which is just that, it lets you create IWavePlayers for multiple audio devices and playback APIs.

Note: NAudio doesn't do 3D audio effects.

Disclaimer: I have been unable to test it with multiple sound cards, as I don't have an extra one at hand at the moment of posting (not even an USB one).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.