7 releases

0.1.0 Aug 19, 2024
0.0.6 Jul 24, 2024
0.0.4 Jun 9, 2024
0.0.3 May 28, 2024

#671 in Audio

Download history 144/week @ 2024-08-17 23/week @ 2024-08-24 14/week @ 2024-08-31 6/week @ 2024-09-07 8/week @ 2024-09-14 18/week @ 2024-09-21 9/week @ 2024-09-28 2/week @ 2024-10-05 11/week @ 2024-10-12 2/week @ 2024-10-19 19/week @ 2024-11-02 15/week @ 2024-11-09 35/week @ 2024-11-16 17/week @ 2024-11-23 14/week @ 2024-11-30

86 downloads per month
Used in 2 crates (via quadio-core)

CC0-1.0 OR MIT OR Apache-2.0

30KB
662 lines

Structures and Routines for Reading and Writing WAV Cue Points and Metadata

Primarily intended for manipulating Quake sound effect loops, this library can read and write WAV "cue " chunks as well as associated data stored in "LIST" chunks. This is a low-level library in the sense that it is the consumer's responsibility to ensure that WAV files created with the library are compatible with the requirements for software using the created files.

Changelog

0.1.0:

  • First release for public consumption
  • Made public constants crate-private (shouldn't be needed by consumers)

License

Triple-licensed under MIT / Apache 2.0 / CC0 (your choice)


lib.rs:

Structures and routines for reading and writing cue points and cue metadata from/to existing WAV files.

The general flow for reading data is to create a ChunkReader wrapping a cursor (Read + Seek implementation) pointing at the start of a WAV file, or WAV data in a larger archive file. Chunks are read as blocks of bytes; chunks tagged as "cue " can be parsed with parse_cue_points and chunks tagged with "LIST" can be processed with extract_labeled_text_from_list. Subsequent processing of the WAV's sample data can be performed by another library of your choosing after restoring the cursor from the reader.

The general flow for writing data is to create a ChunkWriter wrapping a cursor (Read + Seek + Write implementation) pointing at the start of a WAV file. For writing valid WAV files, the existing WAV file should contain "fmt " and "data" chunks in the correct order. It is not recommended for WAV files in larger archives, as data is expected to be appended to the end of the file, resulting in overwritten archive entries or a corrupted archive. Chunks are provided by creating CuePoint and LabeledText instances provided to the writer through its append methods.

Note

This library was developed based on sketchy documentation (e.g. there appears to be no consensus on whether the offset referenced in a cue point is given in samples, frames, or bytes) and was intended primarily for use with Quake and Quake sourceports for looped sound effects. There is no guarantee the files generated by this library will work with any other software, nor is there any guarantee that any file generated will work with Quake and all Quake-derived sourceports.

No runtime deps