batocera-linux / batocera.linux

batocera.linux
https://batocera.org
Other
1.93k stars 496 forks source link

(V33-35 on RasPi 4B) Audio streamed to DualShock 4's jack crackles in the right channel, even wired, even in the main menu (not a hardware/BT issue) #6431

Open radpuj opened 2 years ago

radpuj commented 2 years ago

Issue: Audio streamed to DualShock 4's jack crackles in the right channel, even wired, even in the main menu (not a hardware/BT issue).

Expected result: Audio should sound clear in headphones connected to DS4's analog output jack.

Reproduction steps:

  1. Launch Batocera on Raspberry Pi. In my case, it was Batocera 33 2022/02/03 22:26 running on Raspberry Pi 4 Model B Rev 1.4 (4 GB).
  2. Connect DualShock 4 controller - either wired (with an USB cable) or wirelessly (with a Bluetooth dongle).
  3. Connect headphones to DS4 jack output.
  4. Go to System Settings -> Audio output and select DUALSHOCK4 [CUH-ZCT2X] ANALOG STEREO (wired) or e.g. DUALSHOCK4WIRELESS ADAPTOR ANALOG STEREO (over Bluetooth).
  5. There is a significant crackling in the right channel, even in the main menu/Emulation Station; it seems to get worse under heavier load when I launch any game/ROM. The left channel sounds clear all the time.

Please note that:

Perhaps there is some global audio buffering/latency setting that can be modified to fix this issue?

Logs and data: batocera-support-20220619010350.zip

dmanlfc commented 2 years ago

v34? v35 beta?

btw, excellent issue report - thanks!

radpuj commented 2 years ago

v34? v35 beta?

Exactly the same issue occuring in a clean install of: V34 2022/05/23 21:17 and V35-dev 2022/06/15 03:06

dmanlfc commented 2 years ago

Next questions, have you tried other OS's? Have you tried rpi4 Bluetooth?

radpuj commented 2 years ago

Next questions, have you tried other OS's?

Yes. On RecalboxPi4 8.0.2-Electron, audio streamed to DS4's jack output is crystal clear. It even detects when I turn on DS4 and switches audio output automatically. So this confirms this is a Batocera-specific issue.

Have you tried rpi4 Bluetooth?

I believe there's no point in doing that; the same issue is occurring when DS4 is connected with an USB cable. Also, RPi4's built-in Bluetooth module is known to have very weak reception, and it is generally advised to use external USB dongles instead.

To complicate things even more, I've discovered today there are 2 different models of Dualshock 4: V1 (models CUH-ZCT1_) and V2 (CUH-ZCT2_).

On Recalbox, audio streaming over Bluetooth works on V1 and V2. Audio streaming over USB cable only works on V2. On Batocera, audio streaming doesn't work at all on V1. On V2, it works over Bluetooth and USB, but it crackles.

dmanlfc commented 2 years ago

@radpuj unfortunately i don't have that bluetooth dongle to test the audio output options.

In a working OS, can you do this lsmod > /home/<your username>/working.txt and on batocera do lsmod > /userdata/system/logs/bato-lsmod.txt

Sen me the output of the files please using links.

radpuj commented 2 years ago

Thanks @dmanlfc for looking into this issue!

As a matter of fact, if you're in possession of a DualShock 4 controller V2 (model number CUH-ZCT2*), you don't need any Bluetooth dongle to reproduce the problem; simply connect it to Raspberry Pi with a USB cable. (You might need to unpair it from its host PS4 beforehand, as described in issue description.)

Please find the requested logs attached: lsmod-20220628.zip

dmanlfc commented 2 years ago

@radpuj it seems my playstation controller doesn't provide the audio output options. Therefore it must not be the CUH-ZCT2* version.

Just confirmed via this web site - https://en.wikipedia.org/wiki/DualShock

I have a first gen model.

radpuj commented 2 years ago

@dmanlfc Thanks! I am currently on holidays, but when I come home, I will check if first gen DS4 correctly receives audio on Recalbox when connected to the on-board Bluetooth module of Raspberry Pi. If it works on Recalbox, there's hope it could work on Batocera as well...

radpuj commented 2 years ago

@dmanlfc I've finally managed to test Dualshock 4 V1 (model CUH-ZCT1E) on Recalbox, connecting to the onboard Bluetooth module of RasPi4. It pairs & works OK, but it is only recognized as a generic "Wireless controller" and not as DualShock 4 - therefore, it does not support streaming audio to the controller.

Summing up: In order to reproduce this issue, you need either:

If you have neither, streaming audio to DS4's jack output won't work.

k2helix commented 1 month ago

This specific issue keeps happening. When a DS4 V2 controller is connected (wired), sound crackles making it really uncomfortable to use. Not only does it occur in Batocera but also in Raspbian. I also tested in Android TV running in the same Raspberry Pi and it just sounds perfect there.