Skip to content

Swift package for reading, and writing RIFF files, including WAV files.

License

Notifications You must be signed in to change notification settings

orchetect/SwiftRIFF

Repository files navigation

SwiftRIFF

Platforms - macOS | iOS | tvOS | watchOS | visionOS Swift 6.0 Xcode 16 License: MIT

Swift package for Apple platforms for performant parsing, reading, and writing of RIFF files.

Feature Set

This package currently offers:

  • a lightweight abstraction for parsing chunks in RIFF-based files, and overwriting chunks in existing files
  • abstractions for some file specifications that use RIFF as their underlying file format (such as WAV files)

At present, baseline functionality is implemented and unit tested. The initial goal of this library is to offer a mechanism to read the structure of RIFF files, with very limited mechanisms for writing. In the future, a full set of methods for authoring and writing to RIFF files would be added to the library ideally.

Library Structure

  • SwiftRIFF: umbrella package target loads all package modules including additional file specification abstractions (ie: WAV)
  • SwiftRIFFCore: package target offers the basic RIFFFile type which allows parsing any generic RIFF-based file
    • Custom RIFF chunk abstractions may be built by adopting the RIFFFileChunk protocol and passing these custom types into the RIFFFile parser so it can identify them during parsing (For an example, see the WAVFile type and its chunk implementation)
  • SwiftRIFFWAV: WAV file specification abstraction (which uses RIFF as its underlying file structure)

Installation

Swift Package Manager (SPM)

Add this package to your Xcode project or Swift package using https://github.com/orchetect/SwiftRIFF as the URL.

Documentation / Examples

There is no format documentation at this time, but most types and methods in the package have inline documentation to help explain their purpose.

See the Examples folder for a quick way to get started with parsing RIFF files.

See the SwiftRIFFWAV package target for a blueprint of how to implement your own custom abstractions for RIFF-based files and chunks.

Roadmap

These features are not yet implemented, but are planned for the future. There is no timeline for these additions, but they may be added on an as-needed basis.

  • RIFF files

    • Authoring new RIFF files
    • Replacing RIFF file chunk with chunk of different byte length
    • Adding new chunks to RIFF files
    • Removing chunks from RIFF files
  • Broadcast Wave (BWAV): Implement abstractions for additional known chunk types (iXML, qlty, mext, levl, link, axml)

  • Implement RF64

  • Implement RIF2 (New 64-bit Cubase 13/Nuendo 13 file format)

Author

Coded by a bunch of 🐹 hamsters in a trenchcoat that calls itself @orchetect.

License

Licensed under the MIT license. See LICENSE for details.

Sponsoring

If you enjoy using SwiftRiff and want to contribute to open-source financially, GitHub sponsorship is much appreciated. Feedback and code contributions are also welcome.

Community & Support

Please do not email maintainers for technical support. Several options are available for issues and questions:

  • Questions and feature ideas can be posted to Discussions.
  • If an issue is a verifiable bug with reproducible steps it may be posted in Issues.

Contributions

Contributions are welcome. Posting in Discussions first prior to new submitting PRs for features or modifications is encouraged.

About

Swift package for reading, and writing RIFF files, including WAV files.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Languages