[asterisk-dev] adjusting the playback speed of voicemail messages.
Steven S. Critchfield
critch at basesys.com
Wed Apr 2 16:33:14 CDT 2008
----- "Travis Hein" <travis.hein at travnet.org> wrote:
> Im hoping Im missing something and there is some easy way, but
> after
> looking at the code, it appears that the sample rate for the ast_frame
> is
> assumed to be 8 kHz. The formats/format_wav.c seems to also assume 8
> kHz
> always as well, and the ast_format does not seem to have an
> int (*set_sample_rate)(struct ast_filestream *, int new_rate);
> either, which I was thinking would need something like that so that
> the
> ast_control_streamfile() (that is called by the voicemail playback)
> could
> adjust the sample rate by a given amount, just like it currently does
> for
> the skipms value to the seek() function.
The problem with speed up and slow down is that just adjusting the sample rate doesn't make inteligent sounding audio. I'm sure you are familiar with the sound of audio from a tape recorder when you also hit the fast forward button. Sounds a lot like chipmunks.
Also the sample rates are set specifically because that is what it takes to get it onto PSTN networks. I believe there is another branch where they have worked on that assumption, but it isn't the trunk from what I know.
What you need to be able to do is essentially set up either a filter or a temporary file. A filter would sit in the middle of the audio stream and apply some tricks to properly stretch or compress the audio in such a way as to not affect pitch. The temp file route would be to use sox to modify the audio file and maintain the sample rate and such so you could just work from the modified audio file.
Downside is, I don't think putting a audio filter in the loop is currently feasible in the trunk, again, other branches I believe are working on this. I don't know how easy the sox route would be for you. Especially if you expect to maintain a pointer into the audio file and only effectively adjust from that spot forward. or restart from the sport you stopped to modify the audio file.
--
Steven Critchfield critch at basesys.com
More information about the asterisk-dev
mailing list