diff --git a/src/main.rs b/src/main.rs index 6af186e..e4c94b4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -227,14 +227,12 @@ impl AudioSyncPacket { .unwrap_or(1.0) .max(1.0); let magnitude = fft_max.max(*previous_magnitude * 0.99); + info!("magnitude: {magnitude}"); *previous_magnitude = magnitude; for i in 0..fft_values.len() { fft_values_u8[i] = (fft_values[i] * f32::from(u8::MAX) / magnitude).saturating_as(); } - // calculate fft magnitude sum - let fft_magnitude_sum = real_fft_output.iter().sum::(); - let sample_smth = 0.8f32.mul_add(*previous_sample_smth, 0.2 * raw_level); *previous_sample_smth = sample_smth; @@ -243,7 +241,7 @@ impl AudioSyncPacket { sample_smth, peak_level, fft_values_u8, - fft_magnitude_sum, + magnitude, peak_frequency, )) }