sva_samples/measure/
mod.rs1pub mod alias;
4pub mod bands;
5pub mod crest;
6pub mod envelope;
7pub mod formants;
8pub mod harmony;
9pub mod ledger;
10pub mod loudness;
11pub mod modulation;
12pub mod onsets;
13pub mod periodicity;
14pub mod pitch;
15pub mod self_similarity;
16pub mod sliding;
17pub mod spectrum;
18pub mod stereo;
19
20pub(crate) fn held(planes: &[&[f64]]) -> usize {
21 let len = planes
22 .first()
23 .expect("a reading reads at least one channel")
24 .len();
25 assert!(
26 planes.iter().all(|p| p.len() == len),
27 "a reading's channels are one length"
28 );
29 len
30}
31
32pub(crate) fn averaged(per_channel: Vec<Vec<f64>>) -> Vec<f64> {
34 let count = per_channel.len() as f64;
35 let mut each = per_channel.into_iter();
36 let mut out = each.next().unwrap_or_default();
37 for more in each {
38 for (sum, x) in out.iter_mut().zip(more) {
39 *sum += x;
40 }
41 }
42 out.iter_mut().for_each(|sum| *sum /= count);
43 out
44}
45
46#[derive(Clone, Copy, Debug, PartialEq, Eq)]
47pub enum Consumes {
48 ClosedForm,
49 Buffer,
50 Frames,
51}