WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [Solved] alsa no sound on some machines  (Read 6008 times)

Offline pragmasaurus

  • Newbie
  • *
  • Posts: 5
[Solved] alsa no sound on some machines
« on: June 29, 2020, 11:41:04 AM »
Hello,

So I'm a complete newbie when it comes to Tiny Core but I'm here because I'm using someone else's project (Dosbox Distro, a portable USB implementation of dosbox that uses tiny core) and it works great on most machines but I've come across a few where sound doesn't work. I did some digging around and here's the output of aplay -l for a machine where the sound works vs. one where the sound doesn't work:

Sound works:
Code: [Select]
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC887-VD Analog [ALC887-VD Analog]
   Subdevices: 0/1
   Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC887-VD Digital [ALC887-VD Digital]
   Subdevices: 1/1
   Subdevice #0: subdevice #0

Sound doesn't work:
Code: [Select]
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: CX20641 Analog [CX20641 Analog]
   Subdevices: 0/1
   Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
   Subdevices: 1/1
   Subdevice #0: subdevice #0

It looks like the machine where the sound doesn't work is missing a digital subdevice and instead has an HDMI device. Is this the cause of the problem, and how can I fix it?
« Last Edit: July 20, 2020, 12:22:55 PM by Rich »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11041
Re: alsa no sound on some machines
« Reply #1 on: June 29, 2020, 12:52:21 PM »
The digital device would only matter if you used digital audio cables (toslink, etc). The analog device was detected, so it could be something wrong in the volumes, or a bug in the sound driver. You can check the former with alsamixer or other volume setting tool, and for the latter you could try different TC versions.
The only barriers that can stop you are the ones you create yourself.

aus9

  • Guest
Re: alsa no sound on some machines
« Reply #2 on: June 29, 2020, 10:09:37 PM »
In addition to curaga request....can I ask you to show the results for not-working-Conexant-device
Code: [Select]
lsmod | grep snd
what I am hoping is that you might see a list that includes
snd_hda_intel and a bunch of others but we need a codec too hopefully called...snd_hda_codec_conexant

also when was the last time you had sound working from this device?
Does it work with Windows? What is its sound device name called in Windows
Alternatively, in case this is a Dell etc....what is the make and model of your not working sound hardware machine please?

Offline Sashank999

  • Sr. Member
  • ****
  • Posts: 390
Re: alsa no sound on some machines
« Reply #3 on: June 29, 2020, 11:09:28 PM »
This is based on my experience.
How are you testing audio ? Are you playing some music ? Or are you using some web browser (youtube, spotify, etc.) ?
If you are using a music player, I recommend xmms. I also recommend to install pavucontrol.
In pavucontrol, the sound of speakers is muted by default(happened for me, for you too maybe). Go to "Output Devices" in pavucontrol and unmute it. Some times, sound of the music player may be muted too. Try unmuting them.

If you use a web browser for testing, some sites are blocked from playing audio (happened for me, took 1 hour to figure out). Check the options and unblock it.

Offline marcelocripe

  • Jr. Member
  • **
  • Posts: 89
Re: alsa no sound on some machines
« Reply #4 on: July 01, 2020, 10:34:27 AM »
pragmasaurus,

I went through some difficulties to make the audio work, please check the link: http://forum.tinycorelinux.net/index.php/topic,23705.0.html if the step-by-step steps I've taken are for you.

All the guidance and tips I received from colleagues on this forum I always answer by exemplifying the step by step I performed in each test. I know that by explaining the step by step and with details of information, everyone who has a minimum of computer knowledge can do any job.

If your language is not English, I recommend that you give preference to translating the text I wrote in Portuguese into your language, I have no idea of the level of understanding of the texts translated by Google.

thankful
marcelocripe

Original text in Portuguese, translated into English by Google Translate

---------------

pragmasaurus,

Eu passei por algumas dificuldades para fazer o áudio funcionar, por favor verifica no link: http://forum.tinycorelinux.net/index.php/topic,23705.0.html se os passos a passos que eu realizei servem para você.

Todas as orientações e dicas que eu recebi dos colegas deste fórum eu sempre respondo exemplificando o passo a passo que eu realizei em cada teste. Eu sei que explicando o passo a passo e com detalhes de informações todos que possuem um mínimo de conhecimento em informática conseguem realizar qualquer trabalho. 

Caso o seu idioma não seja o inglês, recomendo que você dê preferência em traduzir o texto que eu escrevi em português para o seu idioma, eu não tenho ideia do nível de compreensão dos textos traduzidos pelo Google.

Grato
marcelocripe

Texto original em português, traduzido para inglês por Google Tradutor

Offline pragmasaurus

  • Newbie
  • *
  • Posts: 5
Re: alsa no sound on some machines
« Reply #5 on: July 03, 2020, 09:54:38 AM »
The digital device would only matter if you used digital audio cables (toslink, etc). The analog device was detected, so it could be something wrong in the volumes, or a bug in the sound driver. You can check the former with alsamixer or other volume setting tool, and for the latter you could try different TC versions.

Thanks, I'll check the mixer levels next time I have access to the machine that it doesn't work on. Different TC versions isn't really an option for me since this is a premade project made by someone else and I don't have the expertise to build it back up from scratch.

How are you testing audio ? Are you playing some music ? Or are you using some web browser (youtube, spotify, etc.) ?
I'm running Dosbox, a DOS emulator. The sound works on my own machine so I'm not worried about the source being the problem.

can I ask you to show the results for not-working-Conexant-device
Code: [Select]
lsmod | grep snd
also when was the last time you had sound working from this device?
Does it work with Windows? What is its sound device name called in Windows
Alternatively, in case this is a Dell etc....what is the make and model of your not working sound hardware machine please?
The sound was working in Windows before and after booting into TC. I'm not sure what the make and model of the PC was but I think it was a Dell. Are there special considerations for certain models?

Here's the output of lsmod:
Code: [Select]
snd_hda_codec_hdmi         28672     1
snd_hda_codec_conexant     12288     1
snd_hda_codec_generic      40960     1     snd_hda_codec_conexant
snd_hda_intel              24576     3
snd_hda_codec              57344     4     snd_hda_codec_hdmi, snd_hda_codec_conexant, snd_hda_codec_generic, snd_hda_intel
snd_hda_core               36864     5     snd_hda_codec_hdmi, snd_hda_codec_conexant, snd_hda_codec_generic, snd_hda_intel, snd_hda_codec
snd_hwdep                  12288     1     snd_hda_codec
snd_pcm                    49152     5     snd_hda_codec_hdmi, snd_hda_intel, snd_hda_codec, snd_hda_core
snd_timer                  20480     2     snd_pcm
snd                        36864     12    snd_hda_codec_hdmi, snd_hda_codec_conexant, snd_hda_codec_generic, snd_hda_intel, snd_hda_codec, snd_hwdep, snd_pcm, snd_timer
soundcore                  12288     1     snd
It seems to be identical to the output on the working machine.


Offline pragmasaurus

  • Newbie
  • *
  • Posts: 5
Re: alsa no sound on some machines
« Reply #6 on: July 13, 2020, 11:40:06 AM »
I had a chance to interact with the computer where the sound wasn't working again this weekend.

I tried opening the alsamixer gui, and I found that the master volume slider is at 50%. As soon as I change the master volume slider to anything (even something lower than the original 50%), the sound works! Does anyone know why it would be completely silent until the main slider is interacted with? And how I might make this change persistent so I don't have to open the mixer each time the system boots?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11573
Re: alsa no sound on some machines
« Reply #7 on: July 13, 2020, 11:50:06 AM »
Hi pragmasaurus
Try following these directions for setting up ALSA and see if that changes anything:
http://forum.tinycorelinux.net/index.php/topic,22145.msg138620.html#msg138620

Also see what coreplayer2 has to say about using  amixer  in that same thread:
http://forum.tinycorelinux.net/index.php/topic,22145.msg138634.html#msg138634

Offline pragmasaurus

  • Newbie
  • *
  • Posts: 5
Re: alsa no sound on some machines
« Reply #8 on: July 13, 2020, 06:30:18 PM »
Hi pragmasaurus
Try following these directions for setting up ALSA and see if that changes anything:
http://forum.tinycorelinux.net/index.php/topic,22145.msg138620.html#msg138620

Also see what coreplayer2 has to say about using  amixer  in that same thread:
http://forum.tinycorelinux.net/index.php/topic,22145.msg138634.html#msg138634

Thanks, it looks like coreplayer2's post is describing my exact problem (I didn't realize there was both a volume control and a mute/unmute, so I probably just didn't notice the channel was muted).

I followed his instructions of creating a file containing the amixer command in /home/tc/.X.d/alsa and then adding that path to /opt/.filetool.lst. I ran the backup using filetool.sh -b, but it seems that the command doesn't occur on boot like I expected (I'm not currently at the problem PC but I tried using it to set the master volume to a specific level on my PC). I checked and the alsa file and the line in .filetool.lst did persist. Is there something else I need to do in order to have that alsa file execute on boot, or should it automatically do that since it's in the filetool?

aus9

  • Guest
Re: alsa no sound on some machines
« Reply #9 on: July 13, 2020, 09:00:16 PM »
the info for alsa-config suggests you might need a sleep command,
this is to allow setup or initialization of your sound device.

pretending you have alsa-config.tcz alsa.tcz in your boot list
Note that for some devices alsa-config should be loaded before alsa.
alsa-config contains setup files for some devices

Quote
/bin/sleep 4
amixer set "Master" 80 unmute

I have a persistent home, because ~/.X.d is not in your negative list called /opt/.xfiletool.lst
(x means no).....you should not need to specify any file for  .X.d IMHO in your .filetool.lst


why not try first a manual system?
If interested, remove all alsa TCEs from your boot list

Change ~.X.d/alsa to read

Quote
tce-load -i alsa-config alsa
/bin/sleep 4
amixer set "Master" 80 unmute

reboot and see if that works. You may need to adjust the sleep command?
Once you know a reliable sleep time, (if needed) you can add your alsa TCEs back into boot list
and delete the first line

Incidently, if you save your mixer levels you can have them restore to whatever levels you want, instead of using amixer commands.....but that may be a bridge too far for you at the moment  ;D

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11573
Re: alsa no sound on some machines
« Reply #10 on: July 14, 2020, 12:24:09 AM »
Hi aus9
... Incidently, if you save your mixer levels you can have them restore to whatever levels you want, instead of using amixer commands.....but that may be a bridge too far for you at the moment  ;D
If the OP follows the instructions in the first link I posted, steps 7 through 10 do exactly that.

aus9

  • Guest
Re: alsa no sound on some machines
« Reply #11 on: July 14, 2020, 12:41:30 AM »
Hi Rich

Yes but I was reacting to his thoughts that made me think he should lean towards the amixer solution.

As you know, if you restore your mixer levels (once set and saved correctly)....I should not be using some other
file to set mixer levels.

just saying.....but I shall sneak back into my box for now

Offline pragmasaurus

  • Newbie
  • *
  • Posts: 5
Re: alsa no sound on some machines
« Reply #12 on: July 20, 2020, 12:00:18 PM »
If the OP follows the instructions in the first link I posted, steps 7 through 10 do exactly that.

Ah, I avoided solutions involving saving and restoring the mixer levels, because I assumed that because the sound works on most computers, that it wasn't a problem with the mixer preset.

the info for alsa-config suggests you might need a sleep command,
this is to allow setup or initialization of your sound device.

I tried putting in a sleep command to delay the configuration, and while it didn't solve my problem, watching the mixer gui during startup revealed that something else is setting the mixer levels after the levels are restored and after this delayed amixer command. I suppose this is what I get for monkeying around with someone else's project- who knows what script or process is doing this.

In the end I fixed the issue by calling amixer much later in my own dosbox batch file, using the dos-linux interface that was already in place on this system.

Thanks to all of you who helped me work through this issue!

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11573
[Solved] Re: alsa no sound on some machines
« Reply #13 on: July 20, 2020, 12:22:15 PM »
Hi pragmasaurus
... watching the mixer gui during startup revealed that something else is setting the mixer levels after the levels are restored ...
In that case, adding:
Code: [Select]
sudo alsactl restoreto your config file should work too. The upside is you are not hard coding any amixer actions. If you change levels, they will be saved
when you backup/shutdown and restored next time you start up.

Marked as solved.