Repository navigation
fix(packs): every FLAC conversion is read back, and installing again repairs the damaged ones - #44
Merged
Merged
Conversation
…repairs the damaged ones
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Packs that ship WAV are stored as FLAC after download. On some 24-bit audio, flacenc 0.5.1 misjudges what a subframe will cost and writes frames of megabytes that decode to noise or not at all. Two notes of VCSL's harmonica (a default pack) come out at 438 MB and 339 MB from 600 KB WAVs; Apple's decoder refuses them, and symphonia reads 196,085 samples instead of 200,181, 146,927 of them wrong. It is deterministic: the same file encodes the same way on one thread.
What changes:
transcode_flacreads each conversion back with symphonia (the decoder playback uses) and compares it with the samples. When the FLAC is larger than the samples it holds, or does not read back exactly, the file is encoded again verbatim (raw samples inside FLAC), which always works.claudius-packs install --defaults(noted in the changelog).Neither of flacenc's settings avoids it on its own: exact bit counting fixes the harmonica (571 KB) but blows up a synthetic tone of 40 harmonics at 784 Hz (168 MB from 132 KB), which the defaults encode at 2x its size.
How I checked:
afconvert.cargo xtask cipasses.