Linux
Make headset loud
I'm using a Microsoft LifeChat LX-3000 headset, which works quite well. But it has very low volume on Ubuntu sometimes. After some fiddling, I figured out that this is because the volume in ALSA is set to 33%.
I can use alsamixer
to
turn it up to 100%, but quite frequently the volume drops down to 33% again
(I haven't been able to make sense of this yet, but I guess, this happens after
waking up from standby or something or when plugging in the headset == putting
my laptop in the docking station).
But this was annoying so I looked up how to do this non-interactively and there
are two very helpful commands. aplay -l
which lists all audio devices known
to ALSA inclusing their device ID. And amixer
, which allows changing the
volume.
With these combined I came up with one of my famous bash-one-liners nicely
packed into a user cron job (crontab -e
) which runs every 5 minutes:
*/5 * * * * for device in $( aplay -l | grep "Microsoft LifeChat LX-3000" | cut -d ' ' -f 2 | tr -d ':' ) ; do amixer set 'Speaker' 100% -c "${device}" >/dev/null; done
This might not be the most elegant solution, but it solves the problem.
Keep audio channel open
I have a Lenovo ThinkPad T460s hooped uo to an Onkyo TX-NR646 A/V-Receiver. Whenever i start to play some audio, it only starts playing on the speakers a few hundred milliseconds later. My guess is, that when no audio is being played, the audio channel over HDMI is torn down and it needs to be brought up again when audio is played back. The handshake between the devices takes some time, causing the audio playback to start late.
To mitigate this issue, I'm permanently running a command in the background which is generating white noise at a volume which is too low for the speakers to reproduce. This way there are no audible artifacts but the audio channel is kept permanently open.
Technical implementation
The play
command from the sox
package is used to generate the audio. As
with modern linux desktops sound output is tied to the user session with
pulseaudio, the tool could not run as a system daemon.
I created a .desktop
file to run the command when logging in:
~/.config/autostart/play.desktop
[Desktop Entry]
Type=Application
Exec=play -qn synth white 8 vol 0.00001
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=Fix Audio
Name=Fix Audio
Comment[en_US]=plays a constant inaudible tone to keep the audio channel towards the AV receiver open
Comment=plays a constant inaudible tone to keep the audio channel towards the AV receiver open