sdatkinson / AudioDSPTools

A library of basic audio DSP tools
MIT License
35 stars 10 forks source link

Use rational numbers for resampler phase #15

Closed sdatkinson closed 7 months ago

sdatkinson commented 7 months ago

Using doubles in the resampler risks fp errors accumulating over time. This results in either lost samples (like #13) or could result in extra samples, which would cause the container's latency to slowly grow over time (ballpark 1 sample per hour, so a rate of 1e-8...not bad, but it coudl be perfect).

to fix, replace usage of mPhase as doubles with rationals (e.g. track their numerators and denominator explicitly).