#!/usr/bin/python # # MixerSet.py # usage: MixerSet.py outfile.wav 44100 hour:min:sec # Set the soundcard mixer on a ViaC7VCM machine running Ubuntu 10.10 Linux. # The sound chip is a Realtek ALC655 Rev 0. # # G. Forrest Cook WB0RIO # Adapted for use with fldigi, Dec. 16, 2013 # # This code has been released under the # GNU GENERAL PUBLIC LICENSE version 2: http://www.gnu.org/ # # For debugging, run gnome-alsamixer and "amixer contents" to # see which variable change with the mixer settings. # import sys import os mixer_prog = "/usr/bin/amixer" # # Sound card mixer settings # # PCM set for output levels just below clipping, works for BPSK31, Olivia and # probably other modes. # # PCM uses actual units, 0-31 pcm_vol = 26 # Other settings use percentages master_vol = 100 aux_vol = 0 # capture == 0 still passes sound through capture_vol = 50 capture_channel = "Aux" # # Count the command line arguments, without much validity checking. # if len(sys.argv) != 1: print 'usage: %s' % sys.argv[0] sys.exit (1) # Make sure the config file exists. #if os.access (config_file, os.R_OK) != 1: # print "Error: config file not found:", config_file # sys.exit (1) # # Set a bunch of variables from the config file. # #execfile (config_file) # # Build and run a bunch of mixer commands. # comd = mixer_prog + " sset Master " + \ str(master_vol) + "%," + str(master_vol) + "% unmute" #print "comd:", comd os.system (comd) comd = mixer_prog + " sset PCM " + \ str(pcm_vol) + "," + str(pcm_vol) + " unmute" #print "comd:", comd os.system (comd) comd = mixer_prog + " sset Aux " + \ str(aux_vol) + "%," + str(aux_vol) + "% unmute cap" #print "comd:", comd os.system (comd) # Select Aux as the capture source comd = mixer_prog + " cset numid=26 " + capture_channel #print "comd:", comd os.system (comd) comd = mixer_prog + " sset Capture " + str(capture_vol) + "%," + str(capture_vol) + "% unmute cap" #print "comd:", comd os.system (comd) # # Set most channel playback volumes to off. # comd = mixer_prog + " sset Line 0%,0% mute nocap" #print "comd:", comd os.system (comd) comd = mixer_prog + " sset Surround 0%,0% unmute" #print "comd:", comd os.system (comd) comd = mixer_prog + " sset CD 0%,0% mute nocap" #print "comd:", comd os.system (comd) comd = mixer_prog + " sset \"Master Mono\" 0% unmute" #print "comd:", comd os.system (comd) comd = mixer_prog + " sset Phone 0% mute nocap" #print "comd:", comd os.system (comd) comd = mixer_prog + " sset Mic 0% mute nocap" #print "comd:", comd os.system (comd) comd = mixer_prog + " sset \"Mic Boost (+20dB)\" off" #print "comd:", comd os.system (comd) # Turn off the Center channel, unmute or playback doesn't work comd = mixer_prog + " sset Center 0% unmute" #print "comd:", comd os.system (comd) # Turn off the Low Frequency Emitter, unmute or playback doesn't work comd = mixer_prog + " sset LFE 0% unmute" #print "comd:", comd os.system (comd) sys.exit (0)