Windows WAVE volume control using Snack

started by Theo Verelst

Not a big page, I guess, but a often-usable subject: how to make the windows sound louder and softer, in this case using a tcl script.

In principle, snack offers access to most audio functions on windows, so here I used the snack lib to make a little script to control the volume of usually the default 'wave' channel of the windows sound business:

 package require snack

 if {[snack::audio play_gain] < [lindex $argv 0]} {
    set in 1
 } {
    set in -1
 }

 for {set i [snack::audio play_gain]} { $i != [lindex $argv 0]} {incr i $in} {
    snack::audio play_gain $i ;
    after 201
 }

call the script for isntance like this:

 tclsh setwinvol 80

and the volume will gradually change from its previous value to in this case 80. Normally it runs from 0 to 100, I think.

Note that the loop control is not fool-proof (the == condition), and that the script idles without UI updates until it finishes.

It is possible to use the same script with pcom to allow remote access to the volume control, which I think is interesting, see also remote execution using tcl and Pcom.

Windows audio is far from perfect, of course, It just happens to be so that I need to use a windows machine, and that I have made this high Q Usb AD/DA converter for it.


Not to be confused with Audio volume under tcl control through the parallel port which is about an electronics projects of tv.


Anyone know how to make snack control the master volume instead of just the wave channel ?


Is this wave different than the wav digital audio file format?


Category Sound