YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix normalize divide by 0 error
Ezra Ellette75a4c331b54c
diff --git a/screenpipe-audio/src/audio_processing.rs b/screenpipe-audio/src/audio_processing.rsindex 25011e15d..0e2f03615 100644--- a/screenpipe-audio/src/audio_processing.rs+++ b/screenpipe-audio/src/audio_processing.rs@@ -8,8 +8,13 @@ pub fn normalize_v2(audio: &[f32]) -> Vec<f32> {.iter().fold(0.0f32, |max, &sample| max.max(sample.abs()));- let target_rms = 0.2; // Adjust as needed- let target_peak = 0.95; // Adjust as needed+ // Return the original audio if it's completely silent+ if rms == 0.0 || peak == 0.0 {+ return audio.to_vec();+ }++ let target_rms = 0.2;+ let target_peak = 0.95;let rms_scaling = target_rms / rms;let peak_scaling = target_peak / peak;