tSIP: using SoX

SoX is best known as command line audio converter, but it is also lightweight (comparing to e.g. mplayer) audio player that allows selecting output audio device. With help of ShellExecute function added to Lua engine it allows to create very flexible notifications, playing audio file(s) through one or more audio devices.

Note: for very short files (e.g. DTMF tones that last fraction of the second) specify shorter than default sox buffer (e.g. --buffer 1024), otherwise file would sound like it was cut out.

Lua code to play test.wav file through audio device named "USB Phone":

ShellExecute("open", "sox.exe", "test.wav --buffer 1024 -t waveaudio \"USB Phone\"", nil, 0)

Back to howto list.

 "Cookie monsters": 6036070    Parse time: 0.001 s