-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The waveform is offset than actual. #8
Comments
My work around is :
|
prevents undersampling; still getting a weird offset, related to #8
makes sure we're not leaving samples unprocessed as vDSP_desamp only works in strides. We keep the unprocessed samples in the running buffer for the next assets reads. We still have a small buffer potentially at the end which we'll need to consume to really parse the entire track. Coming soon. #8, #12
@DamonChen117 thanks for submitting this. You're totally right, the code is missing a hwole bunch of samples in bigger files especially. Working on a fix currently. Almost there. I introduced a running buffer now, which makes sure all samples are getting processed. While your solution looks like it will "catch up" on the lost samples, it only fills them with 0. With the running buffer now it's ensured that all samples are weighted correctly. Currently just missing to process the final samples from file end and once I added that it should be good to go. As a side effect this also fixes #12 already. |
There may be unprocessed samples in the sample buffer after finalizing the initial processing-while-reading. This would also result in less-than-required pixels being rendered. We backfill the missing buffer to be a multiple of samplesPerPixel so vDSP_desamp will consume all of them. finishes #8, #12
in the func
There is a line:
let samplesPerPixel = max(1, sampleCount(from: assetReader) / targetSampleCount)
samplesPerPixel is a Int, so it ignore Decimal, and it result there Is offset for waveform, and it accumulate the offset for each call to process.
The text was updated successfully, but these errors were encountered: