[arm-allstar] zero latency microphone monitoring on a radio-less node

Patrick Perdue borrisinabox at gmail.com
Sun Apr 11 01:42:44 EDT 2021


Recently, I started using a radio-less node, and I wanted local 
zero-latency monitoring of my microphone audio. I could have used 
duplex=2, but there is quite a bit of delay, and I didn't want that. I 
have a hearing impairment, and mostly use headphones. I also wanted to 
make sure I wasn't doing anything silly, like popping p's and the like. 
So, I wrote this set of scripts to unmute the mic playback when the mic 
is keyed, and mute it again when it's unkeyed. Asterisk, very wisely, 
mutes the mic playback and turns the mic playback volume down when the 
simplusb module is loaded. I don't blame it for doing this, because 
otherwise, bad feedback loops would happen in most normal situations.

This can probably be done more efficiently, but it works for me, so I'm 
sharing in case anyone else wants to do this for some reason.

Note that this will not give you an accurate representation of the level 
you are sending out to the network, but for my purposes, this is fine.


***unmutemic.sh***


#!/bin/bash
# unmutes microphone on CM108/CM119 fobs. USE CAREFULLY! Do not use this 
script with a standard RF simplex node. It will cause a feedback loop.
# monitor volume to use, range is 0 to 31
MONVOL=31
# device to use, is usually 0 on most single fob systems
MIXDEV=0
amixer -c $MIXDEV cset numid=3 1 > /dev/null
amixer -c $MIXDEV cset numid=4 $MONVOL > /dev/null


***mutemic.sh***

#!/bin/bash
# mutes microphone playback on CM108/119 fobs
# which device to change, is usually 0 on most single fob systems
MIXDEV=0
amixer -c $MIXDEV cset numid=3 0 > /dev/null
amixer cset numid=4 0 > /dev/null


In /etc/asterisk/rpt.conf, under the [events] stanza for your node (if 
one isn't defined, define it)

/etc/asterisk/local/unmutemic.sh = s|t|RPT_RXKEYED
/etc/asterisk/local/mutemic.sh = s|f|RPT_RXKEYED


It would be easy to add a check for a file in /tmp/ or something on the 
SD card to evaluate whether or not the script should run, and tie it to 
a macro for easily toggling the script's functionality from DTMF, but I 
haven't done that.

Hope this is useful for someone other than me.



More information about the ARM-allstar mailing list