adjust scaling
All checks were successful
Build legacy Nix package on Ubuntu / build (push) Successful in 4m30s

This commit is contained in:
Max Känner 2025-01-12 23:02:12 +01:00
parent 00bcaf7685
commit b353c943af

View File

@ -96,6 +96,12 @@ fn main() -> color_eyre::Result<()> {
// Chart::new_with_y_range(250, 50, 0.0, 16.0, 0.0, 255.0) // Chart::new_with_y_range(250, 50, 0.0, 16.0, 0.0, 255.0)
// .lineplot(&Shape::Bars(&plot_data[..])) // .lineplot(&Shape::Bars(&plot_data[..]))
// .display(); // .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(); let abs_data: Vec<_> = data.iter().map(|sample| sample.abs()).collect();
// calculate peak (raw level and peak level) // calculate peak (raw level and peak level)
let raw_level = abs_data.iter().sum::<f32>() / data.len() as f32; let raw_level = abs_data.iter().sum::<f32>() / data.len() as f32 * 256.0;
let peak_level = abs_data let peak_level = abs_data
.iter() .iter()
.max_by(|lhs, rhs| lhs.partial_cmp(rhs).unwrap_or(Ordering::Equal)) .max_by(|lhs, rhs| lhs.partial_cmp(rhs).unwrap_or(Ordering::Equal))