moonlight-stream / moonlight-android

GameStream client for Android
GNU General Public License v3.0
3.23k stars 512 forks source link

[Issue]: Hearing 5.1 surround sound instead of 7.1 #1295

Closed kentyman23 closed 4 months ago

kentyman23 commented 5 months ago

Describe the bug

I am trying to get 7.1 surround sound audio from my Sunshine PC to Moonlight Android setup, but I can only receive 5.1. I'll go through my setup as thoroughly as possible:

PC

I have a self-built Windows 11 PC. I normally listen to Stereo content from the Realtek audio device on my TUF GAMING X570-PRO (WI-FI) motherboard. While streaming through Sunshine, if I configure the Sound settings in the old Control Panel UI, I can confirm that it thinks my Steam Streaming Speakers should be a 7.1 setup. Format is set to "16 bit, 48000 Hz (DVD Quality)" and there are no spatial sounds configured. Most interestingly, when I click to Test the 7.1 setup, I hear only 5+1 tones, not 7+1. In particular, I don't hear anything for the last two Side Left and Side Right channels. If I put my ear up to my speakers, I actually hear the previous Rear channel tones in both the Rear and Side speakers. This is surprising, as I'll mention below that I have my receiver set to Direct listening mode where it shouldn't do any upmixing or virtualization.

Sunshine

I'm running the latest Sunshine 0.21.0. It automatically switches Windows' Default Device to "Steam Streaming Speakers", which seems correct. I haven't updated any advanced audio settings in Sunshine, so it's defaulting my Audio Sink to "Speakers (High Definition Audio Device)" and honestly I'm not sure which device that is. My _Virtual Sink defaults to "Steam Streaming Speakers", which seems right because I have Install Steam Audio Drivers set to Enabled. The only relevant log output I could find was:

[2023:12:17:11:48:22]: Info: Resetting sink to [virtual-Surround 7.1{0.0.0.00000000}.{7e8cda9c-742a-422b-9e14-eed1e394d4ca}] after default changed
[2023:12:17:11:48:23]: Info: Reinitializing audio capture

Moonlight

I'm running 12.0.2. Under Surround sound configuration, I have selected "7.1 Surround Sound". I have not enabled Enable system equalizer support.

Android

I'm using an Amazon Fire TV Stick 4K Max 1st Gen (2021) plugged directly into my TV's HDMI 1. I've configured Fire OS to use "Best Available" under Surround Sound. I have not turned on any Advanced Audio settings like Volume Leveler or Dialogue Enhancer. If I go to Audio and Video Diagnostics and click Play Dolby Atmos and Vision content, I hear audio out of all 7+1 speakers and my receiver identifies the source as "Atmos 7.1".

TV

I have an LG C2 65" OLED webOS-based TV running the latest 03.33.90 software update version. I have Sound Out selected through "HDMI(ARC) Device". Under Sound>>Advanced Settings, I have Digital Sound Output set to "Auto" and eARC Support enabled. I have a brand new HDMI 2.1 cable connecting receiver to the TV's HDMI 2 port, as this is the one that supports eARC.

Receiver

I have an Onkyo TX-NR7100 AV receiver with the latest R126-0711-0170-0031 firmware update. Under Hardware>>HDMI, I have Audio Return Channel (eARC supported) set to On. I have Source>>Audio Select set to ARC (note that there is no separate eARC option). I am using the "Direct" listening mode to ensure it doesn't do any upmixing or virtualization. While streaming in the Steam Big Picture interface, my receiver reports it's receiving "DD+ 5.1". If I leave it idle, it'll say "DD+ 2.0" until I cause some UI noises and then it goes back to 5.1.

Any idea where this is breaking down? I feel like the fact that my receiver correctly plays and identifies 7.1 content from Fire OS means everything else downstream is fine. So this leaves a problem from Moonlight Android, Sunshine PC, or in my PC's configuration itself. Any debugging suggestions would be greatly appreciated. I'm a software engineer by trade, so I'm comfortable trying more advanced techniques.

Steps to reproduce

Stream a game and only hear 5.1 instead of 7.1 with side channels.

Affected games

Starfield, Steam Big Picture, and even Windows' 7.1 test tones.

Other Moonlight clients

PC

Moonlight adjusted settings

Yes

Moonlight adjusted settings (please complete the following information)

Under Surround sound configuration, I have selected "7.1 Surround Sound". I have not enabled Enable system equalizer support.

Moonlight default settings

Yes

Gamepad-related connection issue

No

Gamepad-related input issue

Yes

Gamepad-related streaming issue

Yes

Android version

Fire OS 7.6.6.4 (PS7664/3772)

Device model

Fire TV Stick 4K Max 1st Gen (2021)

Server PC OS version

Windows 11 22H2 (OS Build 22621.2861)

Server PC GeForce Experience version

Sunshine 0.21.0

Server PC Nvidia GPU driver version

546.33

Server PC antivirus and firewall software

Windows Defender and Windows Firewall

Screenshots

No response

Relevant log output

[2023:12:17:11:48:22]: Info: Resetting sink to [virtual-Surround 7.1{0.0.0.00000000}.{7e8cda9c-742a-422b-9e14-eed1e394d4ca}] after default changed
[2023:12:17:11:48:23]: Info: Reinitializing audio capture

Additional context

No response

kentyman23 commented 4 months ago

I tried setting Fire OS to use "PCM" under Surround Sound. When streaming Moonlight, my receiver reports "MCH PCM 5.1" as the input, so that didn't help.

sittingmongoose commented 4 months ago

Just wanted to put in some somewhat helpful insight, I confirmed OPs settings against my shield(including pc settings) and the shield is working as expected but the firestick is not. It appears to be a Firestick issue.

kentyman23 commented 4 months ago

It appears to be a Firestick issue.

Thinking about this more, why would I be able to get 7.1 from other apps besides Moonlight? Are you saying there may be a bug in Moonlight Android that only affects FireOS, or are you saying the hardware somehow isn't capable?

Actually, what audio codec should I be expecting? I'm reading about the "Fire TV Stick 4K Max - 1st Gen (2021)" here and see that some codecs support 8 channels and others only support 6:

  • Dolby Atmos (EC3_JOC). Up to 48kHz, 8 channels, 16-bit and 24-bit. Dolby Atmos is available on select Netflix, Prime Video, and Disney+ titles when connected to compatible equipment.
  • AC3 (Dolby Digital). Up to 48kHz, 6 channels, 16-bit and 24-bit
  • eAC3 (Dolby Digital Plus). Up to 48kHz, 8 channels, 16-bit and 24-bit
  • AAC-LC. Up to 48kHz, 6 channels, 16-bit and 24-bit
  • HE-AACv1 (AAC+). Up to 48kHz, 6 channels, 16-bit and 24-bit
  • HE-AACv2 (enhanced AAC+). Up to 48kHz, 6 channels, 16-bit and 24-bit
  • FLAC. Up to 48 kHz, 2 channels, 16-bit and 24-bit (no dither for 24 bit)
  • MIDI. MIDI (Type 0 and 1), DLS (Version 1 and 2), XMF, and Mobile XMF. Ringtone formats RTTTL/RTX, OTA, and iMelody
  • MP3. Up to 48 kHz, 2 channels in DSP (16-bit and 24-bit) and software (16-bit)
  • Vorbis. Ogg (.ogg), Matroska (.mkv).
  • PCM/Wave. Up to 96 kHz, 6 channels, 16-bit and 24-bit
  • AMR-NB. Supported
  • Opus. Up to 8 channels, 48 kHz
kentyman23 commented 4 months ago

Okay, that might explain it. From source inspection, it appears that Moonlight Android always uses AudioFormat.ENCODING_PCM_16BIT [source] and this device only supports 6 channels for PCM (as shown above). Unless there's a way to use one of the above codecs with 8 channels, I don't think this will work for me. However, until someone can confirm that those aren't options, I think this bug still makes sense to leave open.

kentyman23 commented 4 months ago

I got a "Fire TV Stick 4K Max - 2nd Gen (2023)", which indeed supports "PCM/Wave. Up to 192 kHz, 8 channels, 16-bit and 24-bit". However, now when I do the 7.1 speaker test from the old Windows Control Panel, I'm hearing my side and rear channels as swapped. So instead of hearing RL/RR/SL/SR, I'm hearing SL/SR/RL/RR.

image

EDIT: I started a thread on Discord (https://discord.com/channels/804382334370578482/1196805161943838830) to discuss this separate issue.

kentyman23 commented 4 months ago

Closing because the original problem was simply a hardware limitation. I will create a new issue if necessary for the swapped channel problem with the 2nd Gen (2023) hardware.

kentyman23 commented 4 months ago

I'm using this Discord thread to discuss my new speaker swap issue with the Gen 2. Since the Gen 1 doesn't actually support 8-channel PCM, I'm going to close this.