sysadmin Linux

Linux

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