WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [TRICK] Disable HDMI to use analog for sound users  (Read 871 times)

Offline aus9

  • Full Member
  • ***
  • Posts: 151
[TRICK] Disable HDMI to use analog for sound users
« on: March 09, 2023, 05:53:07 PM »

A long time ago, I used options index=<number> to swap sound card devices to analog because I use analog not HDMI For most recent computers I have owned,
Code: [Select]
aplay -l has always shown
card 0 HDMI
card 1 Analog

On the web I found a new trick.....I should have known this by running modinfo <your sound module>
Code: [Select]
modinfo snd_hda_intel | grep enable
parm:           enable_msi:Enable Message Signaled Interrupt (MSI)
parm:           enable:Enable Intel HD audio interface.

Depending on your kernel module, it may use understems or hypens so run
Code: [Select]
lsmod | grep snd  if you are unsure what yours is please.

OK here is the trick!

contents of /opt/bootlocal.sh.....change to suit your kernel sound module
# put other system startup commands here
modprobe -r  snd_hda_intel
modprobe     snd_hda_intel options enable=0

2) let me explain it.....in alsa terms

alsa detects (say) first device as HDMI and gives it card index=0
my bootlocal says enable=0 meaning disable index=0
alsa "forgets" HDMI but detects my other device
alsa detects (new) first device is analog
alsa gives it card index=0

3) if you are not running pulseaudio, congratulations  ;D
Code: [Select]
alsamixerwill bring up mixer for your analog card

if you are running pulseaudio, run
Code: [Select]
alsamixer -c0should bring up your analog device mixer instead of showing pulseaudio

4) If for some strange reason, your indices are swapped change your bootlocal to "enable=1,0"
which says to alsa enable first device (analog) and disable second device (hdmi)

6) To use firefox, I run it with apulse so do not need pulseaudio

5) if you are unlucky enough to have both analog and hdmi as sub-devices on the same card......this post is not for you...sorry

« Last Edit: March 09, 2023, 05:57:01 PM by aus9 »

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 393
Re: [TRICK] Disable HDMI to use analog for sound users
« Reply #1 on: March 09, 2023, 10:36:27 PM »
I am not familiar with TinyCore on PC's, but have been using piCore on Raspberry Pi's for a long time and only use ALSA.

You normally can use the card name instead of the card number to get over the card indexing on boot issue.

The default ALSA configuration is for card 0, device 0 and sub-device 0 and most people seem to hardcode the card number in their configuration files. This is where the problem starts.

For example, some Raspberry Pi's have one HDMI, some have two. Some have Headphones, some don't. People plug a sound card into the GPIO's and then there are USB sound cards. This creates sound card indexing hell.

So normally you can pass the card name thru the application command line.

You could setup a .asound config file to overwrite the ALSA default so CARD=Analog becomes the default instead of CARD=0.

Then there is a couple of ways of passing the $CARD variable to ALSA config files.

Offline aus9

  • Full Member
  • ***
  • Posts: 151
Re: [TRICK] Disable HDMI to use analog for sound users
« Reply #2 on: March 10, 2023, 11:52:35 PM »
thanks Greg. I do own a RPi but have not had a chance to play with it.
My post was aimed at PC users so my bad if you thought I was targetting ARM users.

but I am happy with my current method.....its fairly simple IMHO