extern crate flac; extern crate nom; extern crate hound; use flac::StreamReader; use std::fs::File; //use flac::StreamBuffer; fn main() { let filename = //"/Users/Jeremy/Downloads/Music/GATE ~Sore wa Akatsuki no you ni~/01 GATE ~Sore wa Akatsuki no you ni~.flac"; //"/Users/Jeremy/Downloads/Music/GATE ~Sore wa Akatsuki no you ni~/02 GATE ~Sore wa Akatsuki no you ni~ (TV size).flac"; //"/Users/Jeremy/Downloads/Music/GATE ~Sore wa Akatsuki no you ni~/03 GATE ~Sore wa Akatsuki no you ni~ (instrumental).flac"; //"/Users/Jeremy/Downloads/Music/Saenai Heroine no Sodatekata ED/01 Colorful..flac"; //"/Users/Jeremy/Downloads/Music/Saenai Heroine no Sodatekata ED/02 dim.flac"; //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/01 - Nuclear (Hands Up).flac"; //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/02 - Hoedown.flac"; //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/03 - Vancouver Beatdown.flac"; //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/04 - City 2 City ft Belle Humble.flac"; "/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/05 - Deadweight.flac"; //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/06 - Gorilla March.flac"; //"/Users/Jeremy/Downloads/Music/WEAVER - Yamada-kun/01 Kuchizuke Diamond.flac"; /* let bytes = include_bytes!( //"/Users/Jeremy/Downloads/Music/GATE ~Sore wa Akatsuki no you ni~/01 GATE ~Sore wa Akatsuki no you ni~.flac" //"/Users/Jeremy/Downloads/Music/GATE ~Sore wa Akatsuki no you ni~/02 GATE ~Sore wa Akatsuki no you ni~ (TV size).flac" //"/Users/Jeremy/Downloads/Music/GATE ~Sore wa Akatsuki no you ni~/03 GATE ~Sore wa Akatsuki no you ni~ (instrumental).flac" //"/Users/Jeremy/Downloads/Music/Saenai Heroine no Sodatekata ED/01 Colorful..flac" //"/Users/Jeremy/Downloads/Music/Saenai Heroine no Sodatekata ED/02 dim.flac" //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/01 - Nuclear (Hands Up).flac" //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/02 - Hoedown.flac" //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/03 - Vancouver Beatdown.flac" //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/04 - City 2 City ft Belle Humble.flac" //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/05 - Deadweight.flac" //"/Users/Jeremy/Downloads/Music/Zomboy - The Dead Symphonic EP/06 - Gorilla March.flac" //"/Users/Jeremy/Downloads/Music/WEAVER - Yamada-kun/01 Kuchizuke Diamond.flac" ); */ if let Ok(mut stream) = StreamReader::::from_file(filename) { //if let Ok(mut stream) = StreamBuffer::from_buffer(bytes) { let info = stream.info(); let spec = hound::WavSpec { channels: info.channels as u16, sample_rate: info.sample_rate, bits_per_sample: info.bits_per_sample as u16, }; let mut output = hound::WavWriter::create("test.wav", spec) .ok().expect("failed to create wav file"); for sample in stream.iter::() { output.write_sample(sample).ok().expect("failed to write sample"); } } }