moonlight-stream / moonlight-ios

GameStream client for iOS/tvOS
GNU General Public License v3.0
990 stars 247 forks source link

spatial audio headphones support #590

Open benjaminfrombe opened 5 months ago

benjaminfrombe commented 5 months ago

It would be great if spatial audio headphones were supported, now the headphone channels are always stereo.

Danos0100 commented 4 months ago

Theoretically this should be possible by requesting a 5.1 stream and then running it through Apple's spatial audio library. Multichannel streams don't have to be Dolby Audio as can be seen by playing the wave test file here: https://www2.iis.fraunhofer.de/AAC/multichannel.html. The multichannel AAC file should work as well, however as of iOS 17, multichannel AAC files don't work anymore. The iPhone still says 'spatial audio' if you go to control center, but it is played as normal stereo.

What you can already do is using Windows Sonic (free) or Dolby Atmos for headphones (paid) to create a virtual surround signal on the Windows side of your setup. As this is still a stereo signal (on a technical perspective), you can use this on your Airpods as well – just without headtracking, of course.

benjaminfrombe commented 4 months ago

Some apps (like infuse) have already implemented this. When you request a 5.1 stream, your spatial audio capable headset will give you surround sound.

prlaodude commented 3 months ago

Would also love to have this. Especially with the Vision Pro around the corner.

Danos0100 commented 1 month ago

Okay, so requesting a 5.1 or 7.1 stream is entirely possible and the Apple TV version of moonlight-ios uses this. However when connecting AirPod to the Apple TV, the stream remains stereo and doesn't even offer upmixing. This probably has to do with Moonlight using the opus library to decode the audio stream? D: