Open purple-mountains opened 6 years ago
Thanks for all the details! I'm wondering what could be integrated in the audio setup script. Seems like it could setup the volume of the card to the max, anything else?
I use .Xmodmap to map the keyboard, and to make use of the brightness down key, and F6 within alsamixer, you can't make the Alt_Gr key your Mode_switch key, otherwise you will lose your F6 function, because you've mapped keycode 72 = XF86MonBrightnessDown. For some strange reason, if you map this key, only Alt_Gr + 72 will give F6. A mapping with Shift, Mode_switch, Mode_switch + shift should give me F6, but it doesn't. Only Alt_Gr.
Shift, Mode_switch, give me F6 in xev, but doesn't get recognized within alsamixer. Only Alt_Gr + key.
$ cat $HOME/.Xmodmap ! xmodmap -pke
! 1 - key ! 2 - shift + key ! 3 - mode_switch + key ! 4 - mode_switch + shift + key ! 5 - alt_gr + key ! 6 - alt_gr + shift + key
! Mode Switch is Alt_Gr / Control_R / Search : 108 / 105 / 133 ! NOTE: Alt_Gr will lose F1, F2, ..., use Control_R keycode 105 = Mode_switch
keycode 72 = XF86MonBrightnessDown F6 F6 F6 F6 F6 XF86Switch_VT_6 keycode 73 = XF86MonBrightnessUp F7 F7 F7 F7 F7 XF86Switch_VT_7
keycode 232 = keycode 233 =
Note: Running "xmodmap -pke" with no .Xmodmap gives XF86MonBrightnessDown/Up mapped to 232/233, but setting these to NULL, still doesn't help with shift + key, mode_switch + key, ... being mapped to F6.
Seems like only Alt_Gr + Brightness Down gives F6 and other function keys accordingly, within alsamixer.
Alt_Gr + Back = F1 Alt_Gt + Forward = F2 Alt_Gr + Refresh = F3 ...
To map brightness, I use either xbindkeys, or i3wm
$ cat .xbindkeysrc
"xbacklight -5" XF86MonBrightnessDown
"xbacklight +5" XF86MonBrightnessUp
$ grep XF86MonBrightness $HOME/.config/i3/config
bindsym XF86MonBrightnessUp exec xbacklight -inc 2 bindsym XF86MonBrightnessDown exec xbacklight -dec 2
I'm wondering what could be integrated in the audio setup script....
A check for these 2 conditions, and ask the user to manually make any changes?
PATH=/etc/modprobe.d FIND="snd_"
find $PATH -type f -exec grep -n "$FIND" /dev/null {} \;
PATH=/etc/asound.conf FIND="ctl.!default"
find $PATH -type f -exec grep -n "$FIND" /dev/null {} \;
PATH=$HOME/.asoundrc FIND="ctl.!default"
find $PATH -type f -exec grep -n "$FIND" /dev/null {} \;
How to get full sound spectrum with just ALSA only, no pulseaudio needed.
There seems to be a bug in ALSA, whenever the bdwrt5677 card is set to device # 0 - default card, for alsamixer, either by
/etc/modprobe.d/{sound.conf, alsa-base.conf, alsa-bdwrt5677.conf, default.conf}
options snd_soc_rt5677 index=0 options snd_hda_intel index=1
or
no *.conf file shown above, and we set the alsamixer default card to bdwrt5677 - with or without a plug slave formatS16_LE for pcm.!default, via $HOME/.asoundrc.
$ cat .asoundrc
ctl.!default { type hw card bdwrt5677 }
Note: "card bdwrt5677" can also be replaced with "card 1" - aplay -l will show this - remember, we didn't change the index in /etc/modprobe.d/*.conf
When we open alsamixer, the bdwrt5677 card is our default card, even though
$ aplay -l ... card 1: bdwrt5677
If either of these conditions is met (*.conf method or .asoundrc method), the bdwrt5677 card will always be the default card in alsamixer, and we never get full sound output. The plug slave fix for pcm!default within $HOME/.asoundrc will improve a little, but not a lot.
HOW TO GET FULL SOUND SPECTRUM
We keep the bdwrt5677 card at index 1, so no /etc/modprobe.d/*.conf needed.
We don't override ctl!default in $HOME/.asoundrc. If we do, we don't get full sound output.
Basically, we are keeping the default card within alsamixer as "HDA Intel HDMI". Alsamixer - F6, we see
Anytime we make bdw-rt5677 the (default) card, WE WILL NEVER GET FULL SOUND SPECTRUM.
In alsamixer, hit F6 and change to the bdw-rt5677 card and set it's master volume to the max, and try
mplayer -ao alsa:device=hw=1 _VIDEO_AUDIOFILE
The mplayer maximum volume value is "relative" to the alsamixer bdwrt5677 master volume. i.e. The maximum mplayer volume is whatever the alsamixer bdwrt5677 master volume reading is, so set the bdwrt5677 master volume to the max and enjoy. Volume output is quite loud with mplayer at 25% volume.
Try the bdwrt5677 master volume at 20%, 50%, 70% and 100%, and with each of these 4 alsamixer settings, try mplayer at full volume to see what I mean.
If you're getting no volume output with mplayer after setting alsamixer, you may need to "re-set" the bdwrt5677 master volume, it will be at about 25%.
You may have edited your $HOME/.asoundrc after exiting alsamixer, with the correct table order values shown above (default, 0, 1), but mplayer now reads in your post alsamixer exit, modified $HOME/.asoundrc.
ctl.!default { type hw card bdwrt5677 }
Open alsamixer - set bdwrt5677 master volume to the maximum, and exit alsamixer
Edit $HOME/.asoundrc and remove ctl!default
Try mplayer -ao alsa:device=hw=1 ....
For some reason, after closing mplayer, and opening mplayer, it's volume setting is always at the maximum, and not at the volume it was, when mplayer was last closed, which does happen when the default alsamixer card is bdwrt5677, which we don't want, if we are to get maximum volume that isn't clipped or increased with gain or treble or anything fancy that will distort the sound.
Enjoy.
Comments welcome.