[asterisk-dev] adjusting the playback speed of voicemail messages.
John Todd
jtodd at loligo.com
Thu Apr 3 12:52:24 CDT 2008
At 4:33 PM -0500 4/2/08, Steven S. Critchfield wrote:
>----- "Travis Hein" <travis.hein at travnet.org> wrote:
> > I'm hoping I'm 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
I believe that 1.6 branches include an interface to Jack... let's see... yes.
http://svn.digium.com/view/asterisk/branches/1.6.0/CHANGES?view=markup
502 * Added a new module, app_jack, which provides interfaces to
JACK, the Jack
503 Audio Connection Kit (http://www.jackaudio.org/). Two
interfaces are
504 provided; there is a JACK() application, and a JACK_HOOK()
function. Both
505 interfaces create an input and output JACK port. The
application makes
506 these ports the endpoint of the call. The audio coming
from the channel
507 goes out the output port and whatever comes back in on the
input port is
508 what gets sent to the channel. The JACK_HOOK() function
turns on a JACK
509 audiohook on the channel. This lets you run the audio coming from a
510 channel through JACK, and whatever comes back in is what
gets forwarded
511 on as the channel's audio. This is very useful for building custom
512 vocoders or doing recording or analysis of the channel's
audio in another
513 application.
This most likely can do what you want, but I don't have a clear
understanding of the interface method at this point, and I don't know
enough about how JACK works to say what a filter would look like to
slow down or speed up audio without distorting the pitch. Let us
know if this is the right solution, and the methods and details of
any successful tests!
JT
More information about the asterisk-dev
mailing list