hodaun 0.2.1

Audio IO and synthesis
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::fs::File;

use hodaun::*;

fn main() {
    let mut output = OutputDeviceMixer::with_default_device().unwrap();

    // Write to a WAV file
    let source = SineWave::new(Letter::C.oct(4)).amplify(0.5).take(2);
    let file = File::create("example.wav").unwrap();
    wav::write_source(file, source, output.sample_rate() as u32).unwrap();

    // Read from a WAV file
    let file = File::open("example.wav").unwrap();
    let source = wav::WavSource::new(file).unwrap().resample::<Mono>();
    output.add(source);
    output.play_blocking().unwrap();
}