Personal tools
You are here: Home Linux Asterisk Setting the volume of voice messages

Setting the volume of voice messages

volgain, centos 5.2, el 5.2, sox, voicemail, asterisk

The voicemail email messages received from Asterisk are very quiet. The 'volgain' voicemail option allows sox to be run over the attachement before it is emailed.

The key line of code to perform the volume change is:

snprintf(tmpcmd, sizeof(tmpcmd), "sox -v %d %s.%s %s.%s", volgain, attach, format, newtmp, format);

The value of the 'volgain' option is passed directly to sox via the '-v' option. The sox man page for the '-v' states:

-v volume Change amplitude (floating point); less than 1.0 decreases, greater than 1.0 increases.  May use a negative number to invert the phase of the audio data.  It is interesting to note that we perceive volume logarithmically but this adjusts the amplitude linearly. As with other format options, the volume option effects the file its specified with.  This is useful whe processing mutiple input files as the volume adjustment can  be  specified  for  each input file or just once to adjust the output file.  This can be compared to an audio mixer were you can control the volume of each input as well as a master volume (output side). soxmix defaults the value of the -v option for each input file to 1/input_file_count.  This means if your mixing two input files together then each input file’s volume  is adjusted by 0.5.  This is done to prevent clipping of audio data during the mixing operation.  Users will most likely not be happy with this large of  a volume adjustment and can specify the -v option to override this default value.Note: For the non-mixing case, see the stat effect for information on finding the maximum volume adjustment that can be done with this  option  without  causing audio data to be clipped.

Note: Although sox using a floating point value, Asterisk uses an integer.

Procedure

Install sox

# yum install sox

Edit the /etc/asterisk/voicemail.conf to set the volume gain.

[general]
volgain = 9

Links

Appendices

install sox

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 sox                     i386       12.18.1-1        base              314 k

Transaction Summary
=============================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 314 k
Document Actions