afarhan / sbitx

168 stars 58 forks source link

Raspberry Pi 4 HDMI audio modules conflict with loopbacks #4

Closed n7ihq closed 8 months ago

n7ihq commented 2 years ago

sudo modprobe snd-aloop enable=1,1,1 index=1,2,3 HDMI drivers are loaded at index 1, 2 and loopback at index 3. Loopbacks are required at index 1, 2, 3.

cat /proc/asound/cards 0 [audioinjectorpi]: audioinjector-p - audioinjector-pi-soundcard audioinjector-pi-soundcard 1 [vc4hdmi0 ]: vc4-hdmi - vc4-hdmi-0 vc4-hdmi-0 2 [vc4hdmi1 ]: vc4-hdmi - vc4-hdmi-1 vc4-hdmi-1 3 [Loopback ]: Loopback - Loopback Loopback 3

This problem can be fixed by adding the loopback driver in /etc/modules-load.d/modules.conf and loopback options in /etc/modprobe.d/alsa.conf

sudo nano /etc/modules-load.d/modules.conf Add: snd-aloop sudo nano /etc/modprobe.d/alsa.conf Add: options snd-aloop index=1,2,3 enable=1,1,1

cat /proc/asound/cards 0 [audioinjectorpi]: audioinjector-p - audioinjector-pi-soundcard audioinjector-pi-soundcard 1 [Loopback ]: Loopback - Loopback Loopback 1 2 [Loopback_1 ]: Loopback - Loopback Loopback 2 3 [Loopback_2 ]: Loopback - Loopback Loopback 3 4 [vc4hdmi0 ]: vc4-hdmi - vc4-hdmi-0 vc4-hdmi-0 5 [vc4hdmi1 ]: vc4-hdmi - vc4-hdmi-1 vc4-hdmi-1

RichNeese commented 1 year ago

you can disable the hdmi dirver in /boot/config.txt

afarhan commented 8 months ago

The HDMI audio needs to be disabled as mentioned in previous comments. I am closing this

n1ai commented 8 months ago

I've commented on this issue elsewhere:

https://groups.io/g/BITX20/message/108542 -- you don't have to rely on order of discovery if you use proper names

https://groups.io/g/BITX20/message/108485 -- stop using numbers, start using names

A fix is IMO pretty easy: Create and use a new git branch so sending a PR is easier ('git checkout -b sbitx-alsa-names' will do this) Go into sbitx.c and change "plughw:0,0" to "plughw:CARD=audioinjectorpi,DEV=0". Go into sbitx_sound.c and change "plughw:1,0" to "plughw:CARD=Loopback,DEV=0". Go into sbitx_sound.c and change "plughw:2,1" to "plughw:CARD=Loopback_1,DEV=1". Rebuild the code and test that the sbitx app still works for rx and tx of voice modes. Then test that the sbitx app still works with fldigi and/or wsjt-x external digital apps.

Then change /boot/config.txt to not disable HDMI audio (or standard broadcom headphone jack either). Reboot and do the same tests.

Then plug in a USB headset or soundcard dongle, reboot, retest.

I'm pretty sure it will all just work based on the testing I did earlier.