wav-dwt 0.2.1

An experimental implementation of the A Trous Wavelet Decomposition algorithms for audio instead of images
Documentation
use wav_dwt::recompose::RecomposableWaveletLayers;
use wav_dwt::transform::ATrousTransform;
use wav_dwt::wav::{read_wav_file, write_wav_file};
use wav_dwt::Kernel;

fn main() {
    let (wav_spec, wav) = read_wav_file("audio.wav").unwrap();
    let input_length = wav.len();
    let transform = ATrousTransform::new(wav, 40, Kernel::B3SplineKernel);

    let recomposed = transform
        .into_iter()
        .map(|item| {
            let filename = format!(
                "layer{}.wav",
                if let Some(scale) = item.pixel_scale {
                    scale.to_string()
                } else {
                    "".to_string()
                }
            );

            write_wav_file(
                &filename,
                item.clone().buffer.data.into_raw_vec_and_offset().0,
                wav_spec,
            );

            item
        })
        .recompose_into_data(input_length);

    write_wav_file(
        "output.wav",
        recomposed.into_raw_vec_and_offset().0,
        wav_spec,
    );
}