Add readSlice function - #3
Open
reckjn wants to merge 4 commits into
Open
Conversation
#4) AudioFileReader is a Sequence over either container, chosen by inspecting the file rather than trusting its extension, so callers that only ever wanted samples stop caring which format they were handed. FlacReader decodes through a vendored dr_flac in CDrFlac; audio-file-compare exists to diff the two readers over the same material. The 9 AudioFileReaderTests cover the dispatch, slice repeatability and the FLAC fixtures in Tests/Flacs.
WavReader's block iterator writes one slot per frame rather than one per sample, so on a multi-channel file each channel overwrites the last at the same index and only the final one survives. Half the block — for stereo — is then left holding whatever the previous block put there, and the frame's other channels are gone. The float and double paths make the matching mistake at the other end, slicing from `frameIndex` where the buffer is indexed by sample, so they read from a point n-times too early and run short of the frames they promised. Every fixture was mono, where a frame and a sample are the same thing, which is why this survived. `readSlice` is unaffected: it strides by `bytesPerFrame` and returns the first channel by design. Found by the corpus migration's own check, comparing a stereo WAV against the FLAC made from it through this reader: the reference decoder called them identical and this reader disagreed at the second sample, which was the right channel of frame 0. The new fixture pair is stereo with different audio in each channel — the right is the left delayed 23 samples and attenuated — because dual-mono cannot distinguish a reader that interleaves from one that duplicates.
Interleave every channel a WAV block claims to carry
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.
No description provided.