View Full Version : How to use fractional audio resampling?
ChiDragon
18th June 2007, 03:07
Hz = audiorate
offset = -1
AssumeSampleRate(Hz+offset).ResampleAudio(Hz)
I would normally use this, but in my current case I need an offset between -1 and -2. How could I implement this using ResampleAudio's fractional resampling? I can't even figure out how to duplicate my current results using it. I tried ResampleAudio(Hz*Hz,Hz+offset), but that just freezes VDub.
IanB
19th June 2007, 07:54
Hz = audiorate()
offset = -1
ResampleAudio(Hz*Hz,Hz-offset).AssumeSampleRate(Hz)or with cunning misuse of AssumeFPS to turn a float into a rational pairHz = AudioRate()
offset = -1.625 # Fractions are okay
T=Blankclip().AssumeFPS(Hz-offset)
Num=T.FrameRateNumerator()
Den=T.FrameRateDenominator()
ResampleAudio(Num, Den).AssumeSampleRate(Hz)
ChiDragon
19th June 2007, 12:01
The former also hangs VDub, while the latter complains about invalid arguments to ResampleAudio. :confused:
IanB
19th June 2007, 14:00
What is the actual value of Hz? 48k^2 is just a bit more than 2^31 Oops! It chokes. I tried with 44100 and it works. 44k1^2 is just less than 2^31
What version of Avisynth are you running? You need 2.56 for the fractional resampling option. And you will need 2.57 to get good results from the AssumeFPS trick.
ChiDragon
20th June 2007, 00:36
Yeah, Hz is 48000, so I guess the first one can't be used, but the second should work? I'm using 2.57.
IanB
20th June 2007, 03:26
:script: complete!
ChiDragon
20th June 2007, 09:49
Ack, sorry. I was using this in a function and I forgot to give ResampleAudio the clip to work on. :o Could've sworn it did the same thing when I tried it outside of the function but I guess I messed something else up then... Got the second working perfectly now though, thanks!
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.