The previous .git directory was found gutted (only info/ remained), so history is unrecoverable locally. This commit restores version control with the tree exactly as it stands: the working app, the preview-tracks launcher on the artist hero, the scrollable-track-previews design bundle (docs + approved mockups), and the Phase 0 validation artifacts.
18 lines
721 B
Rust
18 lines
721 B
Rust
//! Print an ASCII preview of a file's waveform shape.
|
|
//! cargo run -p player --example wf -- "C:\path\to\file.flac"
|
|
|
|
fn main() {
|
|
let path = std::path::PathBuf::from(std::env::args().nth(1).expect("usage: wf <file>"));
|
|
let t = std::time::Instant::now();
|
|
let peaks = player::compute_waveform(&path, 80);
|
|
println!("{} buckets in {:?}", peaks.len(), t.elapsed());
|
|
let glyphs = [' ', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'];
|
|
let bars: String = peaks
|
|
.iter()
|
|
.map(|&v| glyphs[((v * 8.0) as usize).min(8)])
|
|
.collect();
|
|
println!("{bars}");
|
|
let flat = peaks.iter().filter(|&&v| v > 0.95).count();
|
|
println!("buckets >0.95: {flat}/{}", peaks.len());
|
|
}
|