mqa-identify 0.3.0

A minimal library, to check if a flac file has been encoded by/with MQA
Documentation

Description

A library for identifying MQA (Master Quality Authenticated) audio files, with an optional companion binary. Similar to mqaid (python) and MQA_identifier (C++).

Detection works by searching for the MQA magic word in the three least significant bit planes of the XOR of the two channels, over the first three seconds of audio. A match is strong evidence, not proof - the magic word may also appear in a non-MQA file by chance, though this is very unlikely. Files that cannot carry MQA at all, i.e. anything that is not stereo with at least 16 bits per sample, are reported as not MQA without being decoded.

Installation

cargo install mqa-identify

Binary Usage

mqa-identify path/to/file.flac path/to/directory

Directories are scanned recursively for .flac files. Paths that could not be checked are listed on stderr and cause a non-zero exit status.

Library Usage

The binary is a default feature, so disable it when depending on the library to avoid pulling in unnecessary dependencies:

# Cargo.toml
[dependencies]
mqa-identify = { version = "0.3", default-features = false }
let flac_file_path = PathBuf::from("path/to/flac/file");
match mqa_identify::identify_mqa(flac_file_path) {
    Ok(true) => println!("File is likely mqa encoded"),
    Ok(false) => println!("File is not mqa encoded"),
    Err(error) => println!("Error decoding file: {error}"),
}

identify_mqa_reader accepts any std::io::Read if you are not working with a file on disk.

License

MIT — see LICENSE.