MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
PhonemeExtractor.hpp
Go to the documentation of this file.
1#pragma once
2
4#include "Extractor.hpp"
5
11
13
14/**
15 * @file PhonemeExtractor.hpp
16 * @brief The phonemes of a whole recording: speech is found first, then the phoneme network runs on each speech interval.
17 */
18
19namespace MayaFlux::Yantra {
20
21/**
22 * @enum PhonemeSelection
23 * @brief Which recognised phonemes the output holds.
24 */
25enum class PhonemeSelection : uint8_t {
26 ALL, ///< Every recognised phoneme
27 VOWELS, ///< Vowel phonemes only
28 CONSONANTS ///< Phonemes that are not vowels
29};
30
31/**
32 * @struct VoicingGate
33 * @brief Trims vowel ranges to the stretches where the waveform is periodic.
34 *
35 * Vowels are periodic and most consonants are not, so a vowel range that
36 * strays into a burst or a fricative loses that part. A voiced consonant such
37 * as m or n is periodic too and is not removed. Off by default, because it
38 * runs a waveform analysis over the whole recording. It acts on the audio and
39 * region outputs when the selection is VOWELS; records, which describe what
40 * was recognised, and the other selections are not changed.
41 *
42 * A window is voiced when its periodicity, divided by the share of pairs its
43 * lag can pair, is at least threshold. A voiced window stands for the hop
44 * samples around its centre, so a smaller hop gives finer edges at more cost.
45 * The threshold is a starting choice, not a measured one.
46 */
48 /** Trim vowel ranges to voiced stretches. */
49 bool enabled { false };
50 /** Periodicity at or above which a window is voiced. */
51 double threshold { 0.5 };
52 /** Samples between waveform windows. */
53 uint32_t hop { 64 };
54};
55
56/**
57 * @struct PhonemeExtractorConfig
58 * @brief Settings of a PhonemeExtractor.
59 *
60 * sample_rate states the rate of the input and is refused unless it is 16000,
61 * as the networks run at that rate only. speech is passed to the
62 * SpeechSegmenter, except that max_run is held to what one call of the phoneme
63 * network accepts and measure is ignored. merge_adjacent joins output ranges
64 * that touch, for slicing. gate trims vowel ranges to voiced stretches.
65 */
67 /** Which phonemes the output holds, as a PhonemeSelection value. */
69 /** Sample rate in Hz of the input. Only 16000 is accepted. */
70 double sample_rate { static_cast<double>(SileroVadModel::sample_rate) };
71 /** Join output ranges that touch, so a run of phonemes is one range. */
72 bool merge_adjacent { false };
73 /** How speech is found. */
75 /** Trims vowel ranges to voiced stretches. */
77};
78
79MF_DESCRIBE(PhonemeExtractorConfig)
80
81/**
82 * @brief The segmenter settings a PhonemeExtractorConfig implies.
83 *
84 * Runs are capped at HubertPhonemeModel::max_samples so that each speech
85 * interval fits one call of the phoneme network, and measures are off.
86 */
88{
89 SpeechSegmenterConfig segmenter;
90 segmenter.sample_rate = config.sample_rate;
91 segmenter.speech = config.speech;
92 segmenter.speech.measure = false;
93 if (segmenter.speech.max_run == 0 || segmenter.speech.max_run > HubertPhonemeModel::max_samples) {
95 }
96 return segmenter;
97}
98
99/**
100 * @struct PhonemeExtraction
101 * @brief Record of one PhonemeExtractor run, stored on the output's facets.
102 *
103 * speech holds the speech intervals, as half open sample ranges of the whole
104 * recording. events holds every recognised phoneme, whatever the selection, in
105 * recording order, and segments gives for each the index of its speech
106 * interval. The sample, start and end of an event count from the start of the
107 * recording; its frame counts from the start of its speech interval.
108 */
110 /** Settings the extraction was produced under. */
112 /** Speech intervals, half open sample ranges of the recording. */
113 std::vector<std::pair<size_t, size_t>> speech;
114 /** Every recognised phoneme, in recording order. */
115 std::vector<PhonemeEvent> events;
116 /** For each event, the index of the speech interval it lies in. */
117 std::vector<uint32_t> segments;
118 /** Voiced stretches of the recording, filled only when the gate trimmed vowels. */
119 std::vector<std::pair<size_t, size_t>> voiced;
120};
121
123
124/**
125 * @brief Field layout of the records a PhonemeExtractor gives: the phoneme record layout with the speech interval index added.
126 *
127 * segment is the index of the speech interval the phoneme lies in, the same as
128 * PhonemeExtraction::segments.
129 */
131{
132 auto layout = phoneme_record_layout();
133 layout.add_field<uint32_t>("segment");
134 return layout;
135}
136
137/**
138 * @class PhonemeExtractor
139 * @brief The phonemes of a whole mono 16 kHz recording, with the pauses between speech taken out.
140 *
141 * Finds speech with a SpeechSegmenter, then runs the phoneme network once on each
142 * speech interval, so no call exceeds its 30 s limit and nothing runs on
143 * silence. Phoneme ranges are estimates (PhonemeEvent). Pauses shorter than
144 * min_silence stay inside a range.
145 *
146 * OutputType selects the output: Kakshya::CompositeArray (records, the
147 * default), Kakshya::RegionGroup (regions) or std::vector<Kakshya::DataVariant>
148 * (audio of the selected phonemes). Blocking, one channel, not in the default
149 * registry. It must not run on the audio thread.
150 */
151template <ComputeData InputType = std::vector<Kakshya::DataVariant>, ComputeData OutputType = Kakshya::CompositeArray>
152class PhonemeExtractor : public Extractor<InputType, OutputType> {
153public:
158
159 static constexpr Target target = targets::vulkan;
160
161 /**
162 * @brief Construct from the weights of both networks.
163 * @param vad_weights Tensors of Silero VAD at 16 kHz, as in silero_vad_16k.safetensors.
164 * @param phoneme_weights Tensors of the HuBERT phoneme network, as in hubert_base_phoneme_en.safetensors.
165 * @param config Extraction settings.
166 * @throws std::invalid_argument When diagnose refuses the config, or either weight set is refused by its network.
167 */
170 , m_phonemes(phoneme_weights, phoneme_settings(config))
171 {
172 if (const std::string reason = diagnose(config); !reason.empty()) {
174 std::source_location::current(), "PhonemeExtractor: {}", reason);
175 }
176 this->set_config(std::move(config));
177 }
178
179 [[nodiscard]] ConfigRefs configs() const override
180 {
181 return this->stored_configs(supports {});
182 }
183
184 [[nodiscard]] ExtractionType get_extraction_type() const override
185 {
187 }
188
189 /**
190 * @brief Why a config cannot be extracted with.
191 * @return The reason, empty when usable.
192 */
193 [[nodiscard]] static std::string diagnose(const PhonemeExtractorConfig& config)
194 {
195 if (config.gate.enabled && (!std::isfinite(config.gate.threshold) || config.gate.threshold <= 0.0 || config.gate.hop == 0)) {
196 return "gate threshold must be finite and greater than 0, and its hop greater than 0";
197 }
199 }
200
201 /**
202 * @brief Type-safe phoneme extraction.
203 * @return The record of the run.
204 */
206 {
207 const auto result = this->apply_operation(data);
208 const auto* record = result.facets.template get<PhonemeExtraction>();
209 if (record == nullptr) {
211 std::source_location::current(), "Phoneme extraction produced no result");
212 }
213 return *record;
214 }
215
216 PhonemeExtraction extract_phonemes(const InputType& data)
217 {
218 return this->extract_phonemes(input_type { data });
219 }
220
221 /**
222 * @brief One while a device is up, zero otherwise.
223 */
224 static float fitness(const input_type& /*input*/)
225 {
227 }
228
229protected:
230 [[nodiscard]] std::string get_extractor_name() const override
231 {
232 return "PhonemeExtractor";
233 }
234
236 {
237 try {
238 const auto& cfg = this->template config<PhonemeExtractorConfig>();
239 if (const std::string reason = diagnose(cfg); !reason.empty()) {
241 std::source_location::current(), "PhonemeExtractor: {}", reason);
242 }
243
244 auto [channels, info] = OperationHelper::extract_structured_double(const_cast<input_type&>(input));
245 if (channels.size() != 1) {
247 std::source_location::current(), "PhonemeExtractor analyses one channel and was given {}", channels.size());
248 }
249 const std::span<const double> samples { channels[0].data(), channels[0].size() };
250
252 record.config = cfg;
253 if (!samples.empty()) {
254 record.speech = m_speech.segment(samples, speech_segmenter_config(cfg)).speech;
255 recognise_phonemes(samples, record);
256 if (gate_applies(cfg)) {
257 record.voiced = find_voiced(samples, cfg);
258 }
259 }
260
261 const auto rows = selected_rows(record);
262 output_type output = build_output(record, rows, samples, info);
263 output.metadata = input.metadata;
264 output.facets = input.facets;
265 output.facets.set(record);
266 return output;
267 } catch (const std::exception& e) {
268 MF_ERROR(Journal::Component::Yantra, Journal::Context::ComputeMatrix, "Phoneme extraction failed: {}", e.what());
269 output_type error_result = empty_output();
270 error_result.metadata = input.metadata;
271 error_result.facets = input.facets;
272 return error_result;
273 }
274 }
275
276private:
278 {
279 PhonemeAnalyzerConfig settings;
281 settings.sample_rate = config.sample_rate;
282 return settings;
283 }
284
285 static bool gate_applies(const PhonemeExtractorConfig& cfg)
286 {
287 return cfg.gate.enabled && static_cast<PhonemeSelection>(cfg.method) == PhonemeSelection::VOWELS;
288 }
289
290 std::vector<std::pair<size_t, size_t>> find_voiced(std::span<const double> samples, const PhonemeExtractorConfig& cfg)
291 {
292 if (!m_waveform || m_waveform_hop != cfg.gate.hop) {
294 m_waveform_hop = cfg.gate.hop;
295 }
296 return voiced_intervals(*m_waveform, samples, cfg.gate.threshold, cfg.gate.hop);
297 }
298
299 struct Piece {
300 size_t start;
301 size_t end;
302 size_t row;
303 };
304
305 static std::vector<Piece> pieces_of(const PhonemeExtraction& record, const std::vector<size_t>& rows)
306 {
307 const bool gated = gate_applies(record.config);
308 std::vector<Piece> pieces;
309 for (const size_t row : rows) {
310 const auto& event = record.events[row];
311 if (event.end <= event.start) {
312 continue;
313 }
314 if (!gated) {
315 pieces.push_back({ event.start, event.end, row });
316 continue;
317 }
318 for (const auto& [start, end] : Kinesis::Discrete::intersect_intervals({ { event.start, event.end } }, record.voiced)) {
319 pieces.push_back({ start, end, row });
320 }
321 }
322 return pieces;
323 }
324
325 void recognise_phonemes(std::span<const double> samples, PhonemeExtraction& record)
326 {
327 for (uint32_t index = 0; index < record.speech.size(); ++index) {
328 const auto [first, last] = record.speech[index];
329 if (last <= first || last > samples.size() || last - first < HubertPhonemeModel::frame_span) {
330 continue;
331 }
332 const auto part = samples.subspan(first, last - first);
333 const auto analysis = m_phonemes.analyze_phonemes(
334 std::vector<Kakshya::DataVariant> { std::vector<double>(part.begin(), part.end()) });
335 for (auto event : analysis.events) {
336 event.sample += first;
337 event.start += first;
338 event.end += first;
339 record.events.push_back(event);
340 record.segments.push_back(index);
341 }
342 }
343 }
344
345 static bool is_selected(const PhonemeEvent& event, PhonemeSelection selection)
346 {
347 switch (selection) {
353 default:
354 return true;
355 }
356 }
357
358 static std::vector<size_t> selected_rows(const PhonemeExtraction& record)
359 {
360 const auto selection = static_cast<PhonemeSelection>(record.config.method);
361 std::vector<size_t> rows;
362 for (size_t row = 0; row < record.events.size(); ++row) {
363 if (is_selected(record.events[row], selection)) {
364 rows.push_back(row);
365 }
366 }
367 return rows;
368 }
369
371 {
372 if constexpr (CompositeArrayData<OutputType>) {
374 } else {
375 return output_type {};
376 }
377 }
378
379 output_type build_output(const PhonemeExtraction& record, const std::vector<size_t>& rows,
380 std::span<const double> samples, DataStructureInfo& info)
381 {
382 if constexpr (CompositeArrayData<OutputType>) {
384 std::vector<std::vector<double>> columns(8);
385 for (const size_t row : rows) {
386 const auto& event = record.events[row];
387 columns[0].push_back(static_cast<double>(event.phoneme));
388 columns[1].push_back(static_cast<double>(event.frame));
389 columns[2].push_back(static_cast<double>(event.sample));
390 columns[3].push_back(static_cast<double>(event.start));
391 columns[4].push_back(static_cast<double>(event.end));
392 columns[5].push_back(static_cast<double>(event.probability));
393 columns[6].push_back(HubertPhonemeModel::is_vowel(event.phoneme) ? 1.0 : 0.0);
394 columns[7].push_back(static_cast<double>(record.segments[row]));
395 }
396 output_type output = this->convert_result(columns, info);
397 for (size_t k = 0; k < rows.size(); ++k) {
398 output.data.set_text(k, "phoneme", HubertPhonemeModel::label(record.events[rows[k]].phoneme));
399 }
400 return output;
401 } else if constexpr (std::is_same_v<OutputType, Kakshya::RegionGroup>) {
402 Kakshya::RegionGroup group("phonemes");
403 for (const auto& piece : pieces_of(record, rows)) {
404 const auto& event = record.events[piece.row];
405 auto region = Kakshya::Region::audio_span(piece.start, piece.end - 1, 0, 0,
406 std::string(HubertPhonemeModel::label(event.phoneme)));
407 region.set(phoneme_probability, static_cast<double>(event.probability));
408 region.set(phoneme_class, event.phoneme);
409 group.add_region(region);
410 }
411 output_type output;
412 output.data = std::move(group);
413 return output;
414 } else {
415 std::vector<std::pair<size_t, size_t>> ranges;
416 for (const auto& piece : pieces_of(record, rows)) {
417 ranges.emplace_back(piece.start, piece.end);
418 }
419 if (record.config.merge_adjacent) {
420 ranges = Kinesis::Discrete::merge_intervals(ranges);
421 }
422 std::vector<std::vector<double>> channel { Kinesis::Discrete::slice_intervals(samples, ranges) };
423 return this->convert_result(channel, info);
424 }
425 }
426
429 std::optional<StandardWaveformAnalyzer> m_waveform;
430 uint32_t m_waveform_hop { 0 };
431};
432
433/// Records: one Composite record per selected phoneme
435
436/// Regions: one region per selected phoneme
438
439/// Audio: the audio of the selected phonemes, concatenated
441
442} // namespace MayaFlux::Yantra
#define MF_ERROR(comp, ctx,...)
#define MF_DESCRIBE(...)
Requests a generated member description for a struct at namespace scope.
Definition Describe.hpp:14
Discrete sequence extraction primitives for MayaFlux::Kinesis.
Modern, digital-first extractor framework for Maya Flux.
Which phoneme is spoken near each 20 ms frame of an utterance, from a learned network run on the GPU.
Where speech is in a recording, with optionally how voiced each stretch is and its pitch.
void set(T value)
Stores a struct under its type identity.
Definition Facets.hpp:107
Owns a sequence of values that share a CompositeLayout.
Shared field description and byte layout for a CompositeArray.
Definition Composite.hpp:60
bool is_initialized() const
Check if compiler is initialized.
void set_config(Config config)
Stores a config struct, whole, under its own type.
output_type apply_operation(const input_type &input)
Public synchronous execution interface.
ConfigRefs stored_configs(Supports< Configs... >) const
The stored configs among those listed, in listed order.
output_type convert_result(std::vector< std::vector< double > > &result_data, DataStructureInfo &metadata)
Convert processed double data back to OutputType using metadata and optional callback.
Template-flexible extractor base with instance-defined I/O types.
Definition Extractor.hpp:98
static bool is_vowel(uint32_t index) noexcept
Whether a class is a vowel phoneme.
static std::string_view label(uint32_t index) noexcept
Name of a class: the ARPABET symbol of a phoneme, or a bracketed name for the others.
static constexpr uint32_t frame_span
Samples one frame's features are computed from.
static constexpr size_t max_samples
Longest utterance one call accepts, 30 s.
static std::tuple< NumericChannels, DataStructureInfo > extract_structured_double(T &compute_data)
Extract structured double data from Datum container or direct ComputeData with automatic container ha...
static std::string diagnose(const PhonemeExtractorConfig &config)
Why a config cannot be extracted with.
PhonemeExtraction extract_phonemes(const InputType &data)
ExtractionType get_extraction_type() const override
Gets the extraction type category for this extractor.
static PhonemeAnalyzerConfig phoneme_settings(const PhonemeExtractorConfig &config)
static std::vector< size_t > selected_rows(const PhonemeExtraction &record)
Supports< PhonemeExtractorConfig > supports
static bool gate_applies(const PhonemeExtractorConfig &cfg)
std::string get_extractor_name() const override
Get extractor-specific name (derived classes override this).
ConfigRefs configs() const override
The base view of the config structs this operation holds.
static float fitness(const input_type &)
One while a device is up, zero otherwise.
void recognise_phonemes(std::span< const double > samples, PhonemeExtraction &record)
static std::vector< Piece > pieces_of(const PhonemeExtraction &record, const std::vector< size_t > &rows)
output_type extract_implementation(const input_type &input) override
Pure virtual extraction implementation - derived classes implement this.
PhonemeExtractor(const Kakshya::TensorSet &vad_weights, const Kakshya::TensorSet &phoneme_weights, PhonemeExtractorConfig config={})
Construct from the weights of both networks.
Extractor< InputType, OutputType > base_type
static bool is_selected(const PhonemeEvent &event, PhonemeSelection selection)
output_type build_output(const PhonemeExtraction &record, const std::vector< size_t > &rows, std::span< const double > samples, DataStructureInfo &info)
PhonemeExtraction extract_phonemes(const input_type &data)
Type-safe phoneme extraction.
std::vector< std::pair< size_t, size_t > > find_voiced(std::span< const double > samples, const PhonemeExtractorConfig &cfg)
The phonemes of a whole mono 16 kHz recording, with the pauses between speech taken out.
static constexpr uint32_t sample_rate
Sample rate in Hz the network was trained and runs at.
static std::string diagnose(const SpeechSegmenterConfig &config)
Why a config cannot be segmented with.
An owning array of schema-bearing Composite elements.
Definition DataSpec.hpp:43
@ ComputeMatrix
Compute operations (Yantra - algorithms, matrices, DSP).
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
std::vector< double > slice_intervals(std::span< const double > data, const std::vector< std::pair< size_t, size_t > > &intervals)
Copy data from a set of half-open intervals into a flat vector.
Definition Extract.cpp:63
std::vector< std::pair< size_t, size_t > > merge_intervals(const std::vector< std::pair< size_t, size_t > > &intervals)
Merge overlapping or adjacent half-open intervals.
Definition Extract.cpp:14
std::vector< std::pair< size_t, size_t > > intersect_intervals(const std::vector< std::pair< size_t, size_t > > &first, const std::vector< std::pair< size_t, size_t > > &second)
Parts covered by both of two sets of half-open intervals.
Definition Extract.cpp:39
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.
ExtractionType
Categories of extraction operations for discovery and organization.
Definition Extractor.hpp:47
@ PATTERN_BASED
Extract based on pattern recognition.
Definition Extractor.hpp:51
SpeechSegmenterConfig speech_segmenter_config(const PhonemeExtractorConfig &config)
The segmenter settings a PhonemeExtractorConfig implies.
PhonemeExtractor< std::vector< Kakshya::DataVariant >, Kakshya::RegionGroup > RegionPhonemeExtractor
Regions: one region per selected phoneme.
std::vector< std::pair< size_t, size_t > > voiced_intervals(StandardWaveformAnalyzer &analyzer, std::span< const double > samples, double threshold, uint32_t hop)
The stretches of a recording where the waveform is voiced.
PhonemeExtractor< std::vector< Kakshya::DataVariant >, Kakshya::CompositeArray > StandardPhonemeExtractor
Records: one Composite record per selected phoneme.
SpeechSegmenter< std::vector< Kakshya::DataVariant >, Kakshya::RegionGroup > RegionSpeechSegmenter
Regions: one region per speech interval.
const Facet< uint32_t > phoneme_class
Region attribute: the class of the region's phoneme.
Kakshya::CompositeLayout phoneme_extraction_layout()
Field layout of the records a PhonemeExtractor gives: the phoneme record layout with the speech inter...
PhonemeSelection
Which recognised phonemes the output holds.
@ CONSONANTS
Phonemes that are not vowels.
@ HELD_CLASSES
Three columns of 0 or 1: whether the frame's centre lies in the estimated range of a vowel,...
PhonemeAnalyzer< std::vector< Kakshya::DataVariant >, Eigen::MatrixXd > StandardPhonemeAnalyzer
Standard phoneme analyzer: DataVariant -> MatrixXd.
Kakshya::CompositeLayout phoneme_record_layout()
Field layout of the records a PhonemeAnalyzer with Composite output gives, one record per recognised ...
PhonemeExtractor< std::vector< Kakshya::DataVariant >, std::vector< Kakshya::DataVariant > > AudioPhonemeExtractor
Audio: the audio of the selected phonemes, concatenated.
const Facet< double > phoneme_probability
Region attribute: the probability the network gave the region's phoneme.
std::vector< std::reference_wrapper< const OperationConfig > > ConfigRefs
Borrowed views of the configs an operation holds.
WaveformAnalyzerConfig voicing_analyzer_config(double sample_rate, uint32_t hop=256)
The waveform analyzer settings the voicing measure uses at the given rate and hop.
std::pair< std::shared_ptr< Kriya::BufferPipeline >, std::shared_ptr< Buffers::AudioBuffer > > record(const std::shared_ptr< Kakshya::DynamicSoundStream > &stream, uint32_t input_channel, double seconds, std::optional< uint32_t > monitor, uint32_t channel)
Record a live input channel into a stream for a number of seconds.
Definition Rigs.cpp:262
void add_region(const Region &region)
Organizes related signal regions into a categorized collection.
static Region audio_span(uint64_t start_frame, uint64_t end_frame, uint32_t start_channel, uint32_t end_channel, const std::string &label="")
Create a Region representing a span in audio (frames and channels).
Definition Region.hpp:196
Named tensors that belong together, such as a model's weights or I/O.
Definition Tensor.hpp:167
Stores a scoped enum in its underlying integer type.
std::optional< Kakshya::CompositeLayout > composite_layout
Dimensions, modality, source type, and optional Composite field schema.
T data
The actual computation data.
Definition DataIO.hpp:64
Facets facets
Typed results that travel with the data, read by type.
Definition DataIO.hpp:68
std::unordered_map< std::string, std::any > metadata
Associated metadata.
Definition DataIO.hpp:67
Input/Output container for computation pipeline data flow with structure preservation.
Definition DataIO.hpp:63
Settings every extractor family accepts.
Definition Extractor.hpp:75
Reflect::EnumByte< PhonemeMethod > method
Values reported as the output data, as a PhonemeMethod value.
double sample_rate
Sample rate in Hz of the input.
Settings of a PhonemeAnalyzer.
uint32_t phoneme
Class of the phoneme, 0 to HubertPhonemeModel::phonemes - 1.
One phoneme the network recognised.
std::vector< uint32_t > segments
For each event, the index of the speech interval it lies in.
std::vector< PhonemeEvent > events
Every recognised phoneme, in recording order.
std::vector< std::pair< size_t, size_t > > voiced
Voiced stretches of the recording, filled only when the gate trimmed vowels.
PhonemeExtractorConfig config
Settings the extraction was produced under.
std::vector< std::pair< size_t, size_t > > speech
Speech intervals, half open sample ranges of the recording.
Record of one PhonemeExtractor run, stored on the output's facets.
double sample_rate
Sample rate in Hz of the input.
bool merge_adjacent
Join output ranges that touch, so a run of phonemes is one range.
VoicingGate gate
Trims vowel ranges to voiced stretches.
SpeechSettings speech
How speech is found.
Reflect::EnumByte< PhonemeSelection > method
Which phonemes the output holds, as a PhonemeSelection value.
Settings of a PhonemeExtractor.
double sample_rate
Sample rate in Hz of the input.
SpeechSettings speech
How speech is found and measured.
Settings of a SpeechSegmenter.
bool measure
Also measure the voiced fraction and pitch of each speech interval.
uint32_t max_run
Longest speech interval in samples, 0 for no cap.
How speech runs are found and measured.
The config structs an operation class accepts, declared as using supports.
A set of (device, runtime) pairs.
bool enabled
Trim vowel ranges to voiced stretches.
uint32_t hop
Samples between waveform windows.
double threshold
Periodicity at or above which a window is voiced.
Trims vowel ranges to the stretches where the waveform is periodic.