diff --git a/src/main.rs b/src/main.rs index a6494f4..2e3d627 100644 --- a/src/main.rs +++ b/src/main.rs @@ -96,6 +96,12 @@ fn main() -> color_eyre::Result<()> { // Chart::new_with_y_range(250, 50, 0.0, 16.0, 0.0, 255.0) // .lineplot(&Shape::Bars(&plot_data[..])) // .display(); + let magnitude = data.fft_magnitude; + let sample_raw = data.sample_raw; + let sample_smth = data.sample_smth; + info!(" sample_raw: {}", sample_raw); + info!("sample_smth: {}", sample_smth); + info!(" magnitude: {}", magnitude); } } @@ -162,7 +168,7 @@ impl AudioSyncPacket { let abs_data: Vec<_> = data.iter().map(|sample| sample.abs()).collect(); // calculate peak (raw level and peak level) - let raw_level = abs_data.iter().sum::() / data.len() as f32; + let raw_level = abs_data.iter().sum::() / data.len() as f32 * 256.0; let peak_level = abs_data .iter() .max_by(|lhs, rhs| lhs.partial_cmp(rhs).unwrap_or(Ordering::Equal))