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 peaks;
14pub mod periodicity;
15pub mod pitch;
16pub mod self_similarity;
17pub mod sliding;
18pub mod spectrum;
19pub mod stereo;
20pub(crate) mod stiff;
21
22pub(crate) fn held(planes: &[&[f64]]) -> usize {
23 let len = planes
24 .first()
25 .expect("a reading reads at least one channel")
26 .len();
27 assert!(
28 planes.iter().all(|p| p.len() == len),
29 "a reading's channels are one length"
30 );
31 len
32}
33
34pub(crate) fn averaged(per_channel: Vec<Vec<f64>>) -> Vec<f64> {
36 let count = per_channel.len() as f64;
37 let mut each = per_channel.into_iter();
38 let mut out = each.next().unwrap_or_default();
39 for more in each {
40 for (sum, x) in out.iter_mut().zip(more) {
41 *sum += x;
42 }
43 }
44 out.iter_mut().for_each(|sum| *sum /= count);
45 out
46}
47
48#[derive(Clone, Copy, Debug, PartialEq, Eq)]
49pub enum Consumes {
50 ClosedForm,
51 Buffer,
52 Frames,
53}