Re: DirectShow Video Realtime Ptich

Tech-Archive recommends: Speed Up your PC by fixing your registry



On Fri, 06 May 2005 00:19:53 GMT, gman wrote:

> Hey Guys,
>
> I have been trying to write a directshow filter for a couple months now that
> will allow me to change the pitch of a video in realtime. So in other words
> I want the same effect as SetRate, but without having the music interrupt
> whenever I change the rate.
>
> I have played with creating my own custom reference clock, changing the
> timestamps in the sample grabber and in an in place transform filter. I just
> can't seem to change the rate of the audio and video together. Either I get
> the audio to change rates properly, but then the something happens to the
> video or vise versa.
>
> I know this can be done because winamp has the in_dshow.dll filter that
> allows the playback of videos that can be used in conjuction with their dsp
> plugins (pitch change, tempo change, etc) without the video and audio
> getting out of synch.
>
> I am out of ideas on how to get this to work. Is there someone that can tell
> me exactly what I have to do to the audio and video streams in a filter in
> order to get a realtime pitch change to work with videos?
>
> Thanks in advance,
> gman

I'm not entirely sure if you want to speed up the video whilst the audio
pitch remains the same, or if you wish to change the pitch of the audio
whilst the video runs at normal speed. (Or something I've missed!)

Whichever you are trying to do involves essentially the same techniques.

There are two ways to do this (broadly), time domain and frequency domain.

The time domain solution is about resampling (for pitch change) and then
adding (duplicating) or removing segments of the audio signal to bring the
duration back to the original.

The frequency domain involves analysing the frequencies in the signal (with
Fourier Analysis), workign out what frequencies the new sample should have
and resynthesising the waveform. Usually this is done by something called
a phase vocoder which can estimate the frequencies more accurately than
simple fourier analysis.

Personally, I would buy in a solution. Ianier Munoz of chronotron has both
time and frequency domain solutions - the former is low resource and low
quality, the latter is higher quality but uses more processor.

If you want to write your own, a starting point is dspdimension which has a
lot of material on pitch shift including some source code.

Iain
--
Iain Downs (DirectShow MVP)
Software Product Consultant
www.idcl.co.uk
.



Relevant Pages

  • Re: How to properly block filter graph
    ... I guess my problem comes from my system to block the audio or video until I ... Is there perhaps a filter out there that does this for me? ... If you sink multiple streams, you should be carefull to not ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: Videoschnitt VOB-Dateien
    ... Audio und Video auf copy stellen. ... Try appending the scale filter to your filter list, ... Using SSE optimized IMDCT transform ...
    (de.comp.os.unix.linux.misc)
  • Re: VMR9 How to grab audio sample data
    ... > sample data from a video file for the audio stream using VMR9? ... This is purely for Video. ... The second way is to use the SampleGrabber filter and do the work outside ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: Mplayer and T23
    ... Dave Saville ... Opening video filter: ... Try appending the scale filter to your filter list, ... Unable to open audio: ...
    (comp.os.os2.multimedia)
  • Re: GraphEdit and MPEG2 files - incorrect playback
    ... However what it does is *block my thread in the codec* ... My source filter exposes 2 pins, audio and mpeg2; these are connected to an audio and a video codec respectively, putting PCM and video out. ... When it hangs up I can attach a debugger, and I find from a stack list that my worker thread has called into Receiveon the video filter which has then called into the ASF writer, which is doing a WaitForSingleObjectwhere handle points to an anonymous object. ...
    (microsoft.public.win32.programmer.directx.video)