ALSA

From Noah.org
Revision as of 20:46, 21 July 2013 by Root (Talk | contribs) (beep does not work)

Jump to: navigation, search


I hate ALSA and PulseAudio.

Usually I hate them when the mute state displayed in the GUI gets out of state with the actual sound that may or may not be coming out of the speakers. Often it will show not muted, but no sound will play. When I click the mute button it will show muted but no sound will play. When I click the mute button again it will show not muted and sound will finally play... sometimes.

Use alsamixer to adjust the audio with a Curses GUI. The m key will mute or unmute a channel. If the display under the volume bar shows (X) then it is unmuted. If you press m the display under the volume bar should show MM for muted. The GUI in your window manager may or may not update to reflect the change. Sometimes the two will get out of sync.

The amixer command is useful for adjusting sound settings in a script.

beep does not work

I also hate this stuff when I'm trying to get a simple `beep` system command to work. In alsamixer the beep channel is usually on the far right, often off the edge of the screen, so you have to scroll to see it. Make sure it is not muted. You may also want to set the volume to 50%.

Check that you have a file called /dev/input/by-path/platform-pcspkr-event-spkr. If you do not see this file then you may be able to get the kernel to create it by loading the pcspkr kernel module.

modprobe pcspkr

After doing that you should hopefully see the /dev/input/by-path/platform-pcspkr-event-spkr file. Now should be able to run the beep command with the -e option:

beep -e /dev/input/by-path/platform-pcspkr-event-spkr

It may work without the -e option:

beep

If everything worked then you should now be able to do this:

beep -e /dev/input/by-path/platform-pcspkr-event-spkr -f 392 -l 500; \
    beep -e /dev/input/by-path/platform-pcspkr-event-spkr -f 440 -l 500; \
    beep -e /dev/input/by-path/platform-pcspkr-event-spkr -f 349 -l 500; \
    beep -e /dev/input/by-path/platform-pcspkr-event-spkr -f 175 -l 500; \
    beep -e /dev/input/by-path/platform-pcspkr-event-spkr -f 262 -l 1000

Or without the -e option:

beep -f 392 -l 500; \
    beep -f 440 -l 500; \
    beep -f 349 -l 500; \
    beep -f 175 -l 500; \
    beep -f 262 -l 1000