vhs-decode
vhs-decode copied to clipboard
Hifi-decode speed mismatch
There seems to be a slight issue with the output from hifi-decode not beeing entirely correct speed-wise
From discord:
09:11]rewolf: @oln I'm currently looking into the HiFi (mis-)alignement topic for sync captures, and I found something interesting. What I did was I added some code to hifi decode to record the hifi-rf-input stream position and the corresponding decoded audio output position. The good news is there is no sudden jumps or anything like that. But there is a (tiny) speed mismatch that leads to outputting less than expected decoded samples. The image shows the error accumulating over the course of that 27 min (PAL) tape, about 70ms in total.
I did a bit of math: the rf was sampled at 10MSps (8Bit) and for every 10000000 samples going into hifi decode, I would have expected to get 192000 (stereo) samples out. But its actually more like 191991.9 (rounded to one decimal), so about 8-ish samples short ...
Any idea where this comes from?
If I correct the hifi output by this drift, it seems to align with the linear audio I recorded, which would make fully automated alignment possible.
I attached the patch and added file for recording those positions just as a reference (based off fa841d0c389bc96e5c1aeafc754cc66f066524ac).
[14:38] VideoMem: I don't remember it well if i did that or not, but it could be the rational aproximation in the resampling. There are two resampling stages.
One from input samplerate to ~8MHz and other at the end from ~8Mhz to audio rate. (endret)
[14:39]VideoMem: That's seems to be the accumulated error of the two
[14:53]VideoMem: I'll try omitting the rationalization of the scale factor and do the resampling by floating point.
@VideoMem I'll try omitting the rationalization of the scale factor and do the resampling by floating point. [17:29]rewolf: ahh yes, I was running into the same "rounding" issues when doing the auto alignment app, and I resorted to fractional math to get the error down predictable (endret)
[17:30]rewolf: I did some "back of the envelope" calculations here https://gitlab.com/wolfre/vhs-decode-auto-audio-align/-/blob/main/VhsDecodeAutoAudioAlign/Interpolation/ProjectionMisc.cs?ref_type=heads#L211 concerning the rounding error. maybe that gives some ideas
Pretty sure the bug is here
limit_denominator(1000) there is losing precision.
The value of all max denominator limits should be increased.
This should be solved on #119