feat: add DSF (DSD Stream File) format support#638
Open
TianfangChang wants to merge 2 commits intoSerial-ATA:mainfrom
Open
feat: add DSF (DSD Stream File) format support#638TianfangChang wants to merge 2 commits intoSerial-ATA:mainfrom
TianfangChang wants to merge 2 commits intoSerial-ATA:mainfrom
Conversation
Add read/write support for Sony's DSF container format, which stores 1-bit DSD audio with an optional ID3v2 tag appended after the audio data. Implementation: - Parse DSD chunk header (magic, file size, metadata offset) - Parse fmt chunk (sample rate, channels, bits per sample, sample count) - Read ID3v2 tag by seeking to the metadata offset - Write ID3v2 tag at end of audio data and update header pointer - Map DSF channel types (mono through 5.1) to ChannelMask - Compute duration and bitrate from DSD sample count and rate Supported DSD sample rates: DSD64 (2.8MHz), DSD128 (5.6MHz), DSD256 (11.2MHz), DSD512 (22.5MHz). Tests cover property reading, ID3v2 tag reading, probe detection (both from buffer magic and file extension), and full roundtrip.
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.
Summary
Add read/write support for Sony's DSF container format — a common container for DSD (Direct Stream Digital) audio that stores 1-bit samples with an optional ID3v2 tag appended after the audio data.
ChannelMaskFileType::Dsfwith extension detection ("dsf") and magic byte detection (b"DSD ")Supported DSD sample rates: DSD64 (2.8 MHz), DSD128 (5.6 MHz), DSD256 (11.2 MHz), DSD512 (22.5 MHz).
Files
lofty/src/dsf/mod.rsDsfFilestruct withLoftyFilederivelofty/src/dsf/read.rslofty/src/dsf/properties.rsDsfPropertiesaudio propertieslofty/src/dsf/write_impl.rsid3/v2/write)lofty/tests/dsf_quick_test.rsTest plan
cargo test -p lofty --lib— 239 existing tests pass, zero regressionscargo test -p lofty --test dsf_quick_test— 5 DSF-specific tests pass