View Full Version : Stretch audio
vlada
16th May 2005, 21:06
Hello,
I'd like to ask you, if it's possible to stretch audio using AviSynth, while preserving original pitch? I didn't find a filter which can do this. So it seems I have to use SoundForge, Audition or Audacity to do it.
I'm writing an AVI to DVD conversion and I'd like to keep it as simple as possible. Do you have any suggestions how to do a 24 to 25 fps conversion as simple as possible, but maintaining highest quality.
Thank you,
Vlada
maksa
16th May 2005, 21:10
instead of AssumeFPS(25). That way you don't have to stretch audio at all.
Pozdrav, :)
By doing this you do unnecessary change actual frame counts and btw. in a brutal way. Just adding changeFPS() doubles 1 Frame per second (when doing 24to25fps convers.) means 1 stutter per second finally at 25fps DVD playback.
ConvertFPS() uses blending which we generally avoid if not necessary.
So without rising the audio tone you do this:
assumefps(25)
TimeStretch(tempo=(100.0*25.0)/23.976)
But the best way to do a typical 24 to 25 fps conversation is a simple speedup (Yes I know you dont want to rise the audio tone) by using:
assumefps(25,true).SSRC(48000)
maksa
16th May 2005, 23:13
By doing this you do unnecessary change actual frame counts and btw. in a brutal way. Just adding changeFPS() doubles 1 Frame per second (when doing 24to25fps convers.) means 1 stutter per second finally at 25fps DVD playback.
other conversions, 29.97 > 25 and vice versa? Movement will be faster or slower, so we had to use blending. ChangeFPS will insert the required 5 frames, but not all at once, so stutter is almost invisible, Convert will do blending (even better).
I've used Assume FPS before for 25>24, but using BeSweet (One of the options out of Avisynth - I do not process sound in Avisynth) was too much drag and the results from Convert were quite acceptable to me watching it on TV.
Just my 2c...
In case of 29,97 to 25 and vice versa the framerate differs that much that a "blended" conversion can be the way.
But we where talking about 24fps to 25fps and that little difference doesnt make it worth doing a blended conversation thats what I meant to say ;)
In case of a changefps() conversation you should use:AVISource("24fpsFilm.avi")
ChangeFPS(50).SeparateFields().SelectEvery(4,0,3).Weave() As this can be restored by usingTelecide(order=1,guide=2,post=0)
Decimate(25)
In case of 29,97fps input (real Video, NOT Telecined!) you "could" use ....DGBob(order=1).ConvertFPS(50).SeparateFields.SelectEvery(4,0,3).Weave()
both scripts do output an interlaced stream which will be encoded to mpeg2 afterwards ... you wont recognise these conversations on a PAL 50Hz 650Lines TV BUT youll need more bitrates when encoding interlaced stuff.
If you deal with a 29,97fps NTSC hybrid source (telecined and real video content in the same stream) then you should have a look at this function:
http://forum.doom9.org/showthread.php?s=&threadid=67161&
BUT in case of NTSC 29,97fps real video (59,94i fps) Sources I would leave them as they are and finally choosing authoring a NTSC DVD as maaany SAPs in PAL Land do the conversation to 25fps/50Hz by themselves or your TV Set even does know how to interprete NTSC Input-Signals :)
vlada
17th May 2005, 14:43
maksa> When doing a 24 to 25 fps conversion, the less destructive method is a speedup. Inserting 1 frame per second might cause a choppy video. Blending all 24 frames (like Vegas does) is even worse. Even TV broadcasting uses a video speedup and time-stretch of sound.
Kazdopadne diky :-)
incredible> Thank you for the reply. The command "TimeStretch(tempo=(100.0*25.0)/23.976)" is what I needed. It is an internal filter, right? Is the quality of the conversion O.K., compared to for example Audition, SoundForge or Audacity? Well I can try it, but I'm too lazy :-)
I don't think most people in Europe will have real NTSC video. When converting a telecined material to DVD, I would probably do telecide and then speedup to 25 fps. I don't like interlaced video at all. It is not a good solution for future IMO.
EDIT: AFAIK PAL DVD players are not doing a framerate conversion, they usually let you choose between a real NTSC (most TV can handle it) and PAL 60.
Vlada
Mug Funky
17th May 2005, 17:24
new DVD players often do a conversion, but it's REALLY poor quality (otherwise there'd be no reason to spend a minimum of $10,000 for a better conversion). most PAL TVs do NTSC, but almost all NTSC TVs don't do PAL (stupid! most of the world uses PAL!). however, if your output MUST be PAL, then blending+interlace is the only way to go for anything that isn't pure film.
speedup is okay, and it's best to do this without timestretch - timestretch destroys transients, and anyone musical enough to notice the pitch shift will also notice a tempo shift, so what's the point?
avisynth's timestretch is an implementation of the opensource "SoundTouch". it's pretty good. better than cooledit/audition, and miles better than soundforge (which is just bad at almost everything IMHO). the only thing that'll improve on soundtouch is WaveLab, and that's a bit pricey.
btw, transcoding lossy->lossy audio is evil. don't do it unless you have to, and if you have to, use a DTS track if possible as it'll take it better (it's barely compressed at all). i'd rather field-blend a video than decode ac3 and re-encode to ac3 - DVD has enough bitrate to take it so long as you encode interlaced with alternate-scan.
vlada
17th May 2005, 20:30
Mug Funky> Thanx a lot. I'm actually not doing a conversion, but I'm writing a guide how to do it. I know how bad is a conversion between 2 lossy audio formats, I read an article/comparison somebody posted at HydrogenAudio about it.
So you think changing pitch a little is better then to use TimeStretch? Maybe yes, because it is less then a half tone (1.04 compared to 1.06). But you need to do a lossy framerate conversion anyway. But it is probably less lossy then the TimeStretch conversion. Is it based on Fourrier transformation?
I'm trying to keep the guide as simple as possible, but I'm also trying to cover all cases.
Vlada
Originally posted by vlada
But it is probably less lossy then the TimeStretch conversion. Is it based on Fourrier transformation?
Nope, more like "based on Granular synthesis" - it chops the original audio into tiny bits and loops and crossfades those; if you change the tempo too much you'll get audible artifacts...
You can try it in realtime, there's both a SoundStretch plugin for WinAmp and Foobar2000, just feed in a DVD audio track and try it out... :)
np: Thomas Fehlmann - Rotenfaden (Visions of Blah)
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.