[Asterisk-Users] Monitor and sox mix quality

Jonathan Feally vulture at netvulture.com
Sun Sep 18 23:11:23 MST 2005


I have not noticed any issues with quality, just with caller volumes 
being way different when mixing 2 channel types (ZAP and SIP 
specifically). Here's my custom script for processing the recording 
files. Make sure you use option "m" on your monitor command so that the 
custom script will run. My script makes a stereo mp3 with the 2 people 
split to left/right and makes the 2 sides have an equal max volume. Hope 
this helps. You can always modify the script to adjust how the mp3 is 
encoded.


extensions.conf:

[globals]
MONITOR_EXEC=/usr/local/bin/2wav2mp3

[macro-callext]
s,1,monitor(wav|${ARG1}_${TIMESTAMP}|m)
s,2,dial(SIP/${ARG1})


root at asterslack2:/usr/local/bin# cat /usr/local/bin/2wav2mp3
#!/bin/sh
# 2wav2mp3 - create stereo mp3 out of two mono wav-files
# source files will be deleted
#
# usage: 2wav2mp3 <wave1> <wave2> <mp3>
#
# extensions.conf
# use option "m" on monitor command
# add this variable to [globals]
# MONITOR_EXEC=/usr/local/bin/2wav2mp3


# location of SOX and SOXMIX
# (set according to your system settings, eg. /usr/bin)
SOX="nice -n 20 /usr/bin/sox"
SOXMIX="nice -n 20 /usr/bin/soxmix"
LAME="nice -n 20 /usr/local/bin/lame -S --cbr -b32 -m s"
NORMALIZE="nice -n 20 /usr/bin/normalize --no-progress -a 1.0 --peak"

# command line variables
LEFT=`echo $1 | awk -F".wav" '{print $1}'`
RIGHT=`echo $2 | awk -F".wav" '{print $1}'`
OUT=`echo $3 | awk -F".wav" '{print $1}'`

#test if input files exist
test ! -r $LEFT.wav && exit
test ! -r $RIGHT.wav && exit

# convert mono to stereo, adjust balance to -1/1
$NORMALIZE $LEFT.wav
$NORMALIZE $RIGHT.wav
# left channel
$SOX $LEFT.wav -c 2 $LEFT-tmp.wav pan -1
# right channel
$SOX $RIGHT.wav -c 2 $RIGHT-tmp.wav pan 1

# in case an old version of sox is used, encoding
# can be done afterwards
$SOXMIX -v 1 $LEFT-tmp.wav -v 1 $RIGHT-tmp.wav -v 1 $OUT.wav
$LAME $OUT.wav $OUT.mp3


#remove temporary files
test -w $LEFT-tmp.wav && rm $LEFT-tmp.wav
test -w $RIGHT-tmp.wav && rm $RIGHT-tmp.wav
test -w $OUT.wav && rm $OUT.wav

#remove input files if successfull
test -r $OUT.mp3 && rm $LEFT.wav $RIGHT.wav
# eof


Good Luck!

-Jon


gw at adcomcorp.com wrote:

>Hello All,
>I am using monitor with soxmix, however the quality seems somewhat low
>after sox converts to mp3.
>
>Does anyone know a way to get a higher quality file?  Some of my lines
>are coming in on isdn.
>
>Regards,
>Greg
>_______________________________________________
>--Bandwidth and Colocation sponsored by Easynews.com --
>
>Asterisk-Users mailing list
>Asterisk-Users at lists.digium.com
>http://lists.digium.com/mailman/listinfo/asterisk-users
>To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
>  
>




More information about the asterisk-users mailing list