in reply to Store system call in a variable

Using system, or qx, or similar methods will block the Tk eventloop, although you may get away with it it for such short commands. To do it properly, you want to use the non-blocking IPC methods available to Tk's eventloop.
See ztk-v4l-video-bloger/recorder for an example. I'm not sure if the amixer commands are still current with newer alsa versions, but it does show the method for using amixer with Tk. You can get a list of all alsamixer settings, just google for how.

The important part of the code above is this:

#setup a shell thru IPC to carry out different # mixer and v4l2 control commands my $pidcon = open3(\*CON,0,0,'/bin/sh'); # then later use it like this &mic_con(1); #turn on Mic sub mic_con{ my $con = shift; if($con == 1){ #turn Mic on to max for recording #turn off playback to avoid feedback squeal print CON "amixer cset name='AC97 Playback Volume', 0\n"; #switch the capture to Mic print CON "amixer sset Mic Capture cap\n"; #turn up maximum Mic gain print CON "amixer cset name='Mic Playback Volume', 100\n"; #turn on Mic +20db boost print CON "amixer cset name='Mic Boost (+20dB)', 1\n"; } if($con == 0){ #restore old Line settings #turn off Mic by changing capture to Line print CON "amixer sset Line Capture cap\n"; #turn off Mic +20db boost print CON "amixer cset name='Mic Boost (+20dB)', 0\n"; #restore normal capture volume print CON "amixer cset name='AC97 Playback Volume', 88\n"; } }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh