WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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


  • Guest
[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: 404
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.


  • Guest
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


  • Guest
Re: [TRICK] Disable HDMI to use analog for sound users
« Reply #3 on: September 18, 2023, 06:23:01 PM »

I have seen a recent post and need to update this trick. Firstly above method still works but it is smarter to use a blacklist bootcode and then one liner in bootlocal.sh like this

1) Blacklist whatever your internal hdmi sound kernel module is. For most it will be "blacklist=snd_hda_intel" without the quotes.
so over reboot we can see it in dmesg.....if interested. I am using a grub bootloader so that blacklist bootcode is added to my linux line not my initrd line. YMMV syslinux users would add the bootcode to APPEND line

Code: [Select]
dmesg | grep blacklist # SNIPPING duplicate entries and mine is an example only YMMV
Kernel command line: BOOT_IMAGE=/boot/vmlinuz64 quiet lst=14.lst home=sda3 tce=sda3 LANG=en_AU.UTF.8 blacklist=snd_hda_intel,pcspkr

2) Then the line for internal analog devices
modprobe     snd_hda_intel options enable=0

« Last Edit: September 18, 2023, 06:47:39 PM by aus9 »


  • Guest
Re: [TRICK] Disable HDMI to use analog for sound users
« Reply #4 on: September 18, 2023, 06:28:42 PM »
USB devices are a little different. Years ago when I last looked.....ALSA had a config that blocked usb devices getting index=0.
On TC64 14.x this no longer appears to be true so

For usb device that I tested I have a blacklist bootcode and NO entries in bootlocal.sh

I have blacklist bootcode as above from post 3 (1) and I blocked loading my internal kernel driver in bootlocal.sh with reboot with a cheap and nasty usb sound server and without needing firmware loaded for this device....I saw

Code: [Select]
tc@box:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

lsmod | grep snd
snd_usb_audio         200704  3
snd_pcm                69632  2 snd_usb_audio
snd_timer              24576  2 snd_pcm
snd_usbmidi_lib        20480  1 snd_usb_audio
snd_rawmidi            20480  1 snd_usbmidi_lib
snd_seq_device         12288  1 snd_rawmidi
snd_hwdep              12288  1 snd_usb_audio
snd                    49152 11 snd_usb_audio,snd_pcm,snd_timer,snd_usbmidi_lib,snd_rawmidi,snd_seq_device,snd_hwdep
soundcore              12288  1 snd

and test play of mpg123 works as expected.

thanks for reading
« Last Edit: September 18, 2023, 06:48:54 PM by aus9 »