use quiver::prelude::*;
fn main() {
let sample_rate = 44100.0;
let mut patch = Patch::new(sample_rate);
let vco = patch.add("vco", Vco::new(sample_rate));
let output = patch.add("output", StereoOutput::new());
patch.connect(vco.out("saw"), output.in_("left")).unwrap();
patch.set_output(output.id());
patch.compile().unwrap();
println!(
"The smallest Quiver patch: {} module(s), {} cable(s)",
patch.node_count(),
patch.cable_count()
);
let samples = (sample_rate * 0.5) as usize;
let mut peak = 0.0_f64;
for _ in 0..samples {
let (left, _right) = patch.tick();
peak = peak.max(left.abs());
}
println!("Generated {samples} samples, peak amplitude: {peak:.2}V");
println!("\nThat's it: add -> connect -> compile -> tick.");
println!("See first_patch.rs for a full voice with envelope + filter shaping.");
}