1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
//! What the tuner's shaders read, as Zig structs: the only definition. The
//! shaders include GLSL generated from these (see sketchbook's `glsl.zig`).
//! No imports, so the shader build can compile this alone. The views' own
//! blocks are the scope module's (`scope.layouts`).
/// tuner.comp: the YIN window is the `tuner_window + tuner_lags` samples
/// ending at `end`, read like the other analyses (`offset`, `samples`).
pub const tuner_window = 2048;
pub const tuner_lags = 1700;
pub const TunerParams = extern struct {
offset: u32,
end: u32,
samples: u32,
rate: f32,
/// The pitch range searched.
min_freq: f32,
max_freq: f32,
/// YIN's absolute threshold on the normalised difference.
threshold: f32,
pad: u32 = 0,
pub const glsl = .{ .uniform = .{ .set = 2, .instance = "u" } };
};
/// What tuner.comp writes (std430, read back by the CPU).
pub const Pitch = extern struct {
/// Hz; 0 when nothing periodic was found.
freq: f32,
/// 1 minus YIN's normalised difference at the period: 1 is perfectly
/// periodic.
clarity: f32,
/// RMS of the window, dBFS.
level: f32,
/// The period in samples, interpolated.
period: f32,
};
|