Tiny Core Linux

General TC => Tiny Core Netbooks => Topic started by: julcar on November 20, 2018, 10:56:55 PM

Title: Alsa not working on HP 245 netbook
Post by: julcar on November 20, 2018, 10:56:55 PM
I was playing with sound extensions in my netbook, but there was no success getting at least sound for playing mp3 files

If I run this command

Code: [Select]
lspci -nn | grep Audio

I get this

Code: [Select]
00:01.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Device [1002:15b3]
00:09.2 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] Device [1022:157a]

with

Code: [Select]
aplay -l

I get

Code: [Select]
**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 0: ALC3227 Analog [ALC3227 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I am a n00b on this, never before tried to get audio working on linux.

Extensions I have installed: alsa.tcz, alsa-plugins.tcz, alsa-config.tcz, alsa-modules-4.14.10-tinycore.tcz & alsa-modules-4.14.10-tinycore64.tcz

Thanks in advance for your help guys!
Title: Re: Alsa not working on HP 245 netbook
Post by: Rich on November 20, 2018, 11:05:13 PM
Hi julcar
See if this step by step works for you:
http://forum.tinycorelinux.net/index.php/topic,22145.msg138620.html#msg138620
Title: Re: Alsa not working on HP 245 netbook
Post by: Juanito on November 21, 2018, 12:31:31 AM
I have the same problem - that hdmi comes up as the default - which makes no sense on a laptop.

You can test if sound is actually working with:
Code: [Select]
speaker-test -Ddefault:1 -c2 -t wav -l1..this will use the ALC3227 Analog device rather than hdmi.

Note also that on my laptop I need to load graphics-KERNEL before alsa-config for sound to work...
Title: Re: Alsa not working on HP 245 netbook
Post by: julcar on November 21, 2018, 06:02:15 PM
Still no success, my laptop don't have sound controls on his front panel, instead the sound is controlled with Fn keys (F7 for volume down and F8 for volume up, and, F6 for muting, which also has a led indicator when the speakers are muted).

The weird fact is that after loading alsa.tcz, it turns on the led indicator at F6 key, and there is no way to turn it off, so in my understanding, the laptop is permanently "muted", that is why running the commands on the terminal don't do anything.
Title: Re: Alsa not working on HP 245 netbook
Post by: polikuo on November 21, 2018, 06:22:47 PM
with

Code: [Select]
aplay -l

I get

Code: [Select]
**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 0: ALC3227 Analog [ALC3227 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

You need to change your default audio device to your speaker.
To do that, you have to create a new file /etc/asound.conf
Code: [Select]
pcm.!default {
  type hw
  card 1
}

ctl.!default {
  type hw
  card 1
}

Since the card number may change after reboot,
I'd use device name instead.
In your case, it's "Generic".
Quote
card 1: Generic [HD-Audio Generic], device 0: ALC3227 Analog [ALC3227 Analog]

Thus, your /etc/asound.conf should look like this:
Code: [Select]
pcm.!default {
  type hw
  card Generic
}

ctl.!default {
  type hw
  card Generic
}

To save your changes, append "etc/asound.conf" to your /opt/.filetool.lst
Note that for files listed in /opt/.filetool.lst, there're no leading slashes (/)
Title: Re: Alsa not working on HP 245 netbook
Post by: Juanito on November 21, 2018, 10:01:29 PM
The weird fact is that after loading alsa.tcz, it turns on the led indicator at F6 key, and there is no way to turn it off, so in my understanding, the laptop is permanently "muted", that is why running the commands on the terminal don't do anything.

If the "speaker-test" did not give an error, then perhaps your sound is muted - did you try to un-mute it with alsamixer?
Title: Re: Alsa not working on HP 245 netbook
Post by: julcar on November 22, 2018, 12:07:32 PM
Finally I got sound working, at least the speaker test  :D

I edited onboot.lst like this:

graphics-4.14.10-tinycore.tcz
alsa-config.tcz
alsa-plugins.tcz
alsamixergui.tcz

in that order seems that the alsa.tcz extension is loaded properly, but then, I must run the speaker-test to unmute the speakers, else the speakers stays muted for all the time, note that when I boot the system, the mute led indicator on F6 key turns on, but after running the speaker test the led turns off.

Now, I tried to listen audio from firefox (youtube, livestream, etc) but there's no audio on speakers  :-\
Title: Re: Alsa not working on HP 245 netbook
Post by: coreplayer2 on November 22, 2018, 02:37:15 PM
Good job getting Alsa to work, now you just need to configure Alsa to restore settings on each reboot.   There are various ways to accomplish this, but I prefer
" amixer set "Master" 80 unmute " which is best runs as X starts on each reboot

this will create a file in .X.d to run the unmute command on reboot
Code: [Select]
echo "amixer set "Master" 80 unmute" >> ~/.X.d/alsaNote you'll need a persistent Home or save to your backup



As for Firefox, you'll need to install pulseaudio extension but I'd recommend "pavucontrol.tcz' extension which will easily help you to configure pulseaudio and provide a nice volume control too.. 
Note:  Be sure to follow the instruction in pulseaudio info file
www.tinycorelinux.net/9.x/x86/tcz/pulseaudio.tcz.info (http://www.tinycorelinux.net/9.x/x86/tcz/pulseaudio.tcz.info)

Basically the pulseaudio info file says to create a couple more files in .X.d directory to start dbus and pulseaudio
Code: [Select]
echo "sudo dbus-launch --sh-syntax --exit-with-session" >> ~/.X.d/dbus
echo "start-pulseaudio-x11" >> ~/.X.d/pulseaudio


Title: Re: Alsa not working on HP 245 netbook
Post by: julcar on November 22, 2018, 04:22:49 PM
I've folllowed all the instructions, but something seems to be wrong, I've attached a screenshot when I try to run pavucontrol
Title: Alsa not working on HP 245 netbook
Post by: coreplayer2 on November 22, 2018, 06:34:31 PM
I've folllowed all the instructions, but something seems to be wrong, I've attached a screenshot when I try to run pavucontrol
Looks like pulse audio hasn’t been started

Is pulse audio loaded?  If so then start it  as per  pulse audio info file


How did you install pavucontrol?   
wget ?
APPS  ?
tce-ab ?
tce-load ?

Is pavucontrol.tcz  installed to onboot.lst ?


from the info file

check dbus is running
Code: [Select]
$ /usr/local/etc/init.d/dbus status
check if pulseaudio is running
Code: [Select]
pulseaudio -vv [to test]

Did you create this file to start pulseaudio?
Code: [Select]
echo "start-pulseaudio-x11" > ~/.X.d/pulseaudio



Title: Re: Alsa not working on HP 245 netbook
Post by: Juanito on November 22, 2018, 09:35:54 PM
Finally I got sound working, at least the speaker test
...
but then, I must run the speaker-test to unmute the speakers, else the speakers stays muted for all the time, note that when I boot the system, the mute led indicator on F6 key turns on, but after running the speaker test the led turns off.

The speaker-test command instructed alsa to play sound through device 1 and not the default device 0 (hdmi)

If you want to play sound using other apps that support alsa, you will need to use the apps audio setup menu to instruct it to use device 1 rather than the default.
Title: Re: Alsa not working on HP 245 netbook
Post by: julcar on November 22, 2018, 10:26:23 PM
I've folllowed all the instructions, but something seems to be wrong, I've attached a screenshot when I try to run pavucontrol
Looks like pulse audio hasn’t been started

Is pulse audio loaded?  If so then start it  as per  pulse audio info file


How did you install pavucontrol?   
wget ?
APPS  ?
tce-ab ?
tce-load ?

Is pavucontrol.tcz  installed to onboot.lst ?


from the info file

check dbus is running
Code: [Select]
$ /usr/local/etc/init.d/dbus status
check if pulseaudio is running
Code: [Select]
pulseaudio -vv [to test]

Did you create this file to start pulseaudio?
Code: [Select]
echo "start-pulseaudio-x11" > ~/.X.d/pulseaudio

seems that dbus is not started on system boot, I must run /usr/local/etc/init.d/dbus start

I've installed the extensions through APPS

pulseaudio.tcz is in onboot.lst

and, the three files are in ~/.x.d/ alsa, dbus and pulseaudio.
Title: Re: Alsa not working on HP 245 netbook
Post by: Juanito on November 22, 2018, 10:56:58 PM
For testing purposes it is perhaps better to not have graphics-KERNEL, alsa-config, alsa or pulseaudio in onboot.lst and not to have anything in ~/.X.d.

Then, boot to a console prompt or exit X to the console prompt and:
Code: [Select]
$ tce-load -i graphics-KERNEL
$ tce-load -i alsa-conf
$ tce-load -i alsa
$ tce-load -i pavucontrol adwaita-icon-theme
$ sudo /usr/local/etc/init.d/dbus start
$ startx

..and then double-click on the pavucontrol icon and it should auto-start pulseaudio and display the pulseaudio controls.

If this doesn't work, open a terminal window, run pavucontrol and report the errors you get.
Title: Re: Alsa not working on HP 245 netbook
Post by: julcar on January 17, 2019, 04:16:05 PM
Hi, yesterday I had some time to test this again, here are some hints:

graphics-4.14.10-tinycore.tcz is not needed to get the speaker test work
loading gcc_libs.tcz leads to the audio being muted (which is bad because gcc_libs has libatomic.so.1 required by firefox)

other tests are going on

at least the speaker test works by the moment
Title: Re: Alsa not working on HP 245 netbook
Post by: julcar on January 18, 2019, 12:15:32 AM
Well, after a looooong time testing, I got audio on firefox seeing a youtube video :D

Things I did:

1) create the asound.conf file

Code: [Select]
sudo vi /etc/asound.conf

2) write this and save

Code: [Select]
pcm.!default {
  type hw
  card 1
}

ctl.!default {
  type hw
  card 1
}

3) add persistence

Code: [Select]
echo "etc/asound.conf" >> /opt/.filetool.lst
filetool.sh -b

(at this time I had to remove the norestore bootcode at /mtn/sda1/menu.lst)

4) start dbus at boot time

Code: [Select]
sudo echo "/usr/local/etc/init.d/dbus start" >> /opt/bootlocal.sh

5) my onboot.lst looks like this

Code: [Select]
pci-utils.tcz
alsa-config.tcz
alsa-plugins.tcz
alsamixergui.tcz
pulseaudio.tcz

Now, the only problem to solve is that the laptop starts muted, I have to use alsamixergui to unmute all of the channels to get the audio working.
Title: Re: Alsa not working on HP 245 netbook
Post by: Juanito on January 18, 2019, 12:33:37 AM
Doesn't firefox use pulseaudio for sound?

If so, then there's no need to change any alsa settings, just use pavucontrol or cli pulseaudio commands.
Title: Re: Alsa not working on HP 245 netbook
Post by: julcar on January 18, 2019, 01:25:03 AM
Update

last problem also solved:

Code: [Select]
echo "amixer set "Master" 80 unmute" >> ~/.X.d/alsa
echo "amixer set "Mic" 10 unmute" >> ~/.X.d/alsa

This fixed the muted state at start.
Title: Re: Alsa not working on HP 245 netbook
Post by: julcar on January 18, 2019, 01:27:02 AM
Doesn't firefox use pulseaudio for sound?

If so, then there's no need to change any alsa settings, just use pavucontrol or cli pulseaudio commands.

I decided to uninstall pavucontrol to make more lighter the boot, pulseaudio just works fine alone.
Title: Re: Alsa not working on HP 245 netbook
Post by: Rich on January 18, 2019, 06:10:16 AM
Hi julcar
... Now, the only problem to solve is that the laptop starts muted, I have to use alsamixergui to unmute all of the channels to get the audio working.
Based on what I did here:
http://forum.tinycorelinux.net/index.php/topic,22145.msg138620.html#msg138620
I think you left out the following steps (after setting your volume levels):
Code: [Select]
sudo alsactl store
echo alsactl restore >> /opt/bootlocal.sh
echo usr/local/etc/alsa/asound.state >> /opt/.filetool.lst.
filetool.sh -b
Title: Re: Alsa not working on HP 245 netbook
Post by: julcar on January 19, 2019, 06:12:14 PM
Hi julcar
... Now, the only problem to solve is that the laptop starts muted, I have to use alsamixergui to unmute all of the channels to get the audio working.
Based on what I did here:
http://forum.tinycorelinux.net/index.php/topic,22145.msg138620.html#msg138620
I think you left out the following steps (after setting your volume levels):
Code: [Select]
sudo alsactl store
echo alsactl restore >> /opt/bootlocal.sh
echo usr/local/etc/alsa/asound.state >> /opt/.filetool.lst.
filetool.sh -b

the alsactl store could be on shutdown.sh?
Title: Re: Alsa not working on HP 245 netbook
Post by: Rich on January 19, 2019, 06:19:16 PM
Hi julcar
Quote
the alsactl store could be on shutdown.sh?
You could if you want to and you change volume levels a lot. If you have volume levels you are comfortable with then just
running  alsactl store  once is sufficient.
Title: Re: Alsa not working on HP 245 netbook
Post by: julcar on January 20, 2019, 01:44:14 AM
Hi julcar
Quote
the alsactl store could be on shutdown.sh?
You could if you want to and you change volume levels a lot. If you have volume levels you are comfortable with then just
running  alsactl store  once is sufficient.

You were right, now I have full sound with my notebook  ;D