IanB
10th March 2003, 03:30
Dear all,
I would like to float the idea that Audio sampling rate be held internally in floating point format to minimise accumulated rounding errors.
When dealing with long .AVI files particularly with low sample rate audio (11025, 8000) it requires special tricks to avoid lip sync problems. The difficulty manifests itself as the integer rounding error accumulates over time. i.e. :-
A 1 unit diffference in a 11025/second audio stream over 1 Hour (3600 seconds) has an accumulated rounding error of 326.53 milliseconds, which is quite noticable (8KhZ has 450mS/Hour error). There are many tricks like tweaking the video rate or supersampling the audio to a very high rate on input, but resampling multiple times causes distortion and is best avoided.
The principle players AssumeFPS(sync_audio=true) and ResampleAudio() already use doubles internally for these calculations.
I have examined the source code and the changes required would be minimal apart from the evil public "int audio_samples_per_second;" in avisynth.h affecting all plugins already using that class member. Some tricky OO overlaying and new methods could avoid this but could make things a little messy.
Thoughts?
IanB
I would like to float the idea that Audio sampling rate be held internally in floating point format to minimise accumulated rounding errors.
When dealing with long .AVI files particularly with low sample rate audio (11025, 8000) it requires special tricks to avoid lip sync problems. The difficulty manifests itself as the integer rounding error accumulates over time. i.e. :-
A 1 unit diffference in a 11025/second audio stream over 1 Hour (3600 seconds) has an accumulated rounding error of 326.53 milliseconds, which is quite noticable (8KhZ has 450mS/Hour error). There are many tricks like tweaking the video rate or supersampling the audio to a very high rate on input, but resampling multiple times causes distortion and is best avoided.
The principle players AssumeFPS(sync_audio=true) and ResampleAudio() already use doubles internally for these calculations.
I have examined the source code and the changes required would be minimal apart from the evil public "int audio_samples_per_second;" in avisynth.h affecting all plugins already using that class member. Some tricky OO overlaying and new methods could avoid this but could make things a little messy.
Thoughts?
IanB