WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Setting Alsa volume on easy way  (Read 25227 times)

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6897
    • My Community Forum
Setting Alsa volume on easy way
« on: November 28, 2009, 04:43:07 AM »
Alsa master channel is muted and volume set to 0 after bootup. To change it I'm using the following commands:

Quote
amixer set Master 80%
amixer set Master unmute

You can add them to your startup script. In LXDE for example add them  to

/home/tc/.config/lxsession/LXDE/autostart

Quote
...
...
@amixer set Master 80%
@amixer set Master unmute

To have more fun

Quote
...
...
@amixer set Master 80%
@amixer set Master unmute
@aplay /home/tc/yourstartupmusic.wav

« Last Edit: November 28, 2009, 04:44:58 AM by bmarkus »
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline vinnie

  • Hero Member
  • *****
  • Posts: 1104
  • HandMace informatic works
Re: Setting Alsa volume on easy way
« Reply #1 on: November 29, 2009, 06:51:36 AM »
Great tweaks markus ;)

Offline jls

  • Hero Member
  • *****
  • Posts: 1999
    • Core17
Re: Setting Alsa volume on easy way
« Reply #2 on: November 29, 2009, 07:49:00 AM »
I have in my /opt/.filetool:
etc/asound.state
so I don't need to do what u did, even when I change pc
dCore user

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6897
    • My Community Forum
Re: Setting Alsa volume on easy way
« Reply #3 on: November 29, 2009, 09:41:20 AM »
I have in my /opt/.filetool:
etc/asound.state
so I don't need to do what u did, even when I change pc


On my machine there are no etc/asound.state
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline jls

  • Hero Member
  • *****
  • Posts: 1999
    • Core17
Re: Setting Alsa volume on easy way
« Reply #4 on: November 29, 2009, 09:55:03 AM »
sudo alsactl store
dCore user

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6897
    • My Community Forum
Re: Setting Alsa volume on easy way
« Reply #5 on: November 29, 2009, 10:11:46 AM »
sudo alsactl store

This was not in the post :)
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Kingdomcome

  • Sr. Member
  • ****
  • Posts: 282
Re: Setting Alsa volume on easy way
« Reply #6 on: November 29, 2009, 11:54:01 AM »
Info file to the rescue  :P
Quote
If you want your alsa settings to persist across reboots, use the
command 'alsactl store' after alsa has been set up.  This stores the
configuration in /etc/asound.state.  Place this file in your backup to
allow your alsa settings to persist across sessions.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6897
    • My Community Forum
Re: Setting Alsa volume on easy way
« Reply #7 on: November 29, 2009, 12:34:40 PM »
Well, it works. It is a great solution to save "volume 0%, muted". The question is not how to save, but how to setup, see original post :)
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9253
Re: Setting Alsa volume on easy way
« Reply #8 on: November 29, 2009, 06:11:47 PM »
Adding a sleep command in bootlocal.sh before "/usr/local/etc/init.d/alsasound start" made it restore the settings instead of starting muted.  It evidently is a timing issue with the boot process as some folks have reported success without a sleep command, and myself and others have their sound muted on boot instead of restored. 

Offline jpeters

  • Restricted
  • Hero Member
  • *****
  • Posts: 1017
Re: Setting Alsa volume on easy way
« Reply #9 on: November 29, 2009, 09:47:15 PM »
It's buggy.  I have to turn Master and PCM off and back on after loading the browser.  I've got mine hotkeyed.   

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9253
Re: Setting Alsa volume on easy way
« Reply #10 on: December 02, 2009, 04:57:30 AM »
Yeah, alsa locks in one app for sound preventing other apps from accessing it.  Sometimes that hangs after the first app is closed.  Some of my machines' cards are not detected by OSS, and some apps have bad sound with OSS.  Each has it's own merits and drawbacks.

Offline Xianwen Chen

  • Full Member
  • ***
  • Posts: 142
Re: Setting Alsa volume on easy way
« Reply #11 on: January 30, 2010, 08:19:44 AM »
Code: [Select]
amixer set Master 80%
amixer set Master unmute
amixer set PCM 80%
amixer set PCM unmute

Just FYI that, I have to set PCM as well to have sound.

Offline banditman

  • WikiUser
  • *
  • Posts: 8
Re: Setting Alsa volume on easy way
« Reply #12 on: February 23, 2010, 08:26:57 AM »
What I Do
Run alsamixer unmute and raise the volume sliders to max on master and pcm channels then press esc then run sudo alsactl store, then simply add alsactl restore to bootlocal.sh file.
Job done!  :D

aus9

  • Guest
Re: Setting Alsa volume on easy way
« Reply #13 on: April 21, 2010, 09:17:32 PM »
hi

I have an intel card with LXDE and just to show we are different down under I have to use
amixer set Speaker unmute

-----The volume was already ok as were most other settings......I have not yet set up my intel model=5stack.....but the weird thing is the first time I run
alsamixer I have no PCM selection.....but when I start testing a sound.....I get one.

Anyhow I prefer this way as it only requires non-root access to edit. YMMV



Offline nitram

  • Hero Member
  • *****
  • Posts: 1052
Re: Setting Alsa volume on easy way
« Reply #14 on: June 26, 2015, 12:16:08 PM »
This works for me using Alsa and TinyCore 6 for sound and persistence:
- add alsa-config.tcz to /etc/sysconfig/tcedir/onboot.lst
- add the following to /opt/bootlocal.sh:
     amixer set Master unmute &
     amixer set PCM unmute &
     amixer set Master 80% &
     amixer set PCM 80% &
- on my system if PCM is muted sound does not work
- using Fluxbox, add to .fluxbox/keys to mute/unmute and control volume via keyboard:
     Mod4 Up :Exec amixer sset Master,0 1+
     Mod4 Down :Exec amixer sset Master,0 1-
     Mod4 Left :Exec amixer sset Master,0 toggle

PS: XMMS is still a great music player :)