Re: Audio scrub



On Thu, 9 Mar 2006 18:28:58 -0600, Bibo mushi wrote:

I am trying to implement audio scrubbing in my player so that if the user
scrubs the slider control, they can hear the audio in the speed they moved
the slider.
First I was just to catch the HScroll message and use IMediaSeeking::SetRate
to set to whatever rate it is.
But I cannot call SetRate with more than 2, it returns
VFW_E_UNSUPPORTED_AUDIO.
Now, I am not sure how to approach this problem.
Any information is greatly appreciated.

Scrubbing is difficult to do right and even harder to implement in
DirectShow.

For your solution you will need to write a custom transform filter. The
transform filter will sit just before the audio renderer and stretch or
shrink the audio data (using a pitch shift) to the appropriate size for the
desired rate.

The pitch shift isn't difficult to implement if you have some basic audio
knowledge. e.g. to double the audio rate, simply copy every other audio
sample, to triple every third sample. Slowing down the rate is actually
harder. To slow down to half speed you can duplicate every sample but you
will hear some aliasing. Better is to use an averaging method or sinc
interpolation.

--
http://www.chrisnet.net/code.htm
http://www.avdevforum.com/AV
.



Relevant Pages

  • How to know how fast CSliderCtrl was dragged?
    ... would set the audio rate to 1. ... On the other hand, if I drag 1/10th of the slider control in 2ms, I will set ... the audio rate to 0.5 and you will hear the audio being played back slow. ...
    (microsoft.public.win32.programmer.ui)
  • Re: filter graph freezing
    ... I inserted a null transform filter and monitored what audio passed beween ... AVI splitter and DV Mux. ... When the graph is run, ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: IMediaSeeking rate issues
    ... > audio too much. ... Well IMHO you will need to implement pitch shift (or rather rate change ... such a filter in SONAR. ...
    (microsoft.public.win32.programmer.directx.audio)
  • Re: filter graph freezing
    ... I inserted a null transform filter and monitored what audio passed beween ... video frame 22 as it had 10 video frame buffers. ... There is a bug with the way it uses the allocators, ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: how to delay sound stream ?
    ... actual latency) so it sets the audio *out* of sync. ... transform filter. ... For example if an audio sample comes into the transform filter with a ... Iain Downs ...
    (microsoft.public.win32.programmer.directx.video)