Measure a third-octave spectrum and channel levels for visualizations
The analyzer now keeps a full-rate mono PCM history and per-window left/right RMS and peaks. The FFT and all ballistics run on the reader side when a snapshot is taken, so the audio callback only appends samples: 31 bands with exact base-2 edges that partition the FFT bins, an ~85 ms window that follows the sample rate, time-based attack/fall/peak hold, and silence only after the PCM counter has stalled for longer than a few device callbacks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
038f0979af
commit
aabca327b2
3 files changed
+780
-11
No files matched your search
+3
-1
@@ -6,6 +6,7 @@
|
||||
|
||||
mod analyzer;
|
||||
mod opus;
|
||||
mod spectrum;
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
|
||||
@@ -15,6 +16,7 @@ use std::time::Duration;
|
||||
use rodio::{Decoder, DeviceSinkBuilder, Player, Source, stream::MixerDeviceSink};
|
||||
|
||||
pub use analyzer::AudioAnalysisSnapshot;
|
||||
pub use spectrum::{BAND_CENTERS_HZ, FLOOR_DB};
|
||||
|
||||
pub trait TrackReadSeek: std::io::Read + std::io::Seek + Send + Sync {}
|
||||
|
||||
@@ -453,7 +455,7 @@ fn handle(
|
||||
if let Some(out) = output.take() {
|
||||
out.player.stop();
|
||||
}
|
||||
shared.analysis.clear();
|
||||
shared.analysis.reset();
|
||||
playing.track_loaded = false;
|
||||
playing.base = Duration::ZERO;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user