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