MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
SpeechSegmenter.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Extractor.hpp"
4
12
14
15/**
16 * @file SpeechSegmenter.hpp
17 * @brief Where speech is in a recording, with optionally how voiced each stretch is and its pitch.
18 */
19
20namespace MayaFlux::Yantra {
21
22/**
23 * @struct SpeechSettings
24 * @brief How speech runs are found and measured.
25 *
26 * The scan follows Silero's get_speech_timestamps: a run starts at threshold,
27 * ends after min_silence without speech, and is widened by padding on both
28 * sides. Runs shorter than min_speech are dropped. max_run caps one speech
29 * interval in samples, 0 for no cap. All lengths are in samples at 16 kHz.
30 *
31 * With measure on, each speech interval also gets a voiced fraction and a
32 * pitch from the waveform windows whose start lies in it. A window is voiced
33 * when its periodicity, divided by the share of pairs its lag can pair, is at
34 * least voicing_threshold. The threshold is a starting choice, not a measured
35 * one.
36 */
38 /** Speech probability at or above which speech starts. */
39 double threshold { 0.5 };
40 /** Shortest speech run kept, in samples. */
41 uint32_t min_speech { 4000 };
42 /** Shortest silence that ends a speech run, in samples. */
43 uint32_t min_silence { 1600 };
44 /** Samples added on each side of a speech run. */
45 uint32_t padding { 480 };
46 /** Longest speech interval in samples, 0 for no cap. */
47 uint32_t max_run { 0 };
48 /** Also measure the voiced fraction and pitch of each speech interval. */
49 bool measure { false };
50 /** Periodicity at or above which a window is voiced. */
51 double voicing_threshold { 0.5 };
52};
53
54/**
55 * @struct SpeechSegmenterConfig
56 * @brief Settings of a SpeechSegmenter.
57 *
58 * sample_rate states the rate of the input and is refused unless it is 16000,
59 * as the network runs at that rate only.
60 */
62 /** Sample rate in Hz of the input. Only 16000 is accepted. */
63 double sample_rate { static_cast<double>(SileroVadModel::sample_rate) };
64 /** How speech is found and measured. */
66};
67
68/**
69 * @struct SpeechSegmentation
70 * @brief Record of one SpeechSegmenter run, stored on the output's facets.
71 *
72 * speech holds the speech intervals as half open sample ranges. voiced_fraction
73 * and f0 are filled only when the run measured, one entry per interval: the
74 * share of its windows that are voiced, and the median frequency in Hz of the
75 * voiced ones, 0 when none is.
76 */
78 /** Settings the segmentation was produced under. */
80 /** Speech intervals, half open sample ranges. */
81 std::vector<std::pair<size_t, size_t>> speech;
82 /** Voiced share of each interval's windows, empty unless measured. */
83 std::vector<double> voiced_fraction;
84 /** Median frequency of each interval's voiced windows, empty unless measured. */
85 std::vector<double> f0;
86};
87
89
90/**
91 * @brief The interval scan settings of speech runs, for a recording of the given length.
92 *
93 * Scores are the probabilities of 512 sample chunks, and the leave threshold is
94 * the one IntervalExtractorConfig gives by default, as in Silero.
95 */
96[[nodiscard]] inline IntervalExtractorConfig speech_scan_settings(const SpeechSettings& speech, size_t samples)
97{
99 scan.scan.enter_threshold = speech.threshold;
100 scan.scan.samples_per_score = SileroVadModel::chunk_samples;
101 scan.scan.min_run = speech.min_speech;
102 scan.scan.min_gap = speech.min_silence;
103 scan.scan.padding = speech.padding;
104 scan.scan.max_run = speech.max_run;
105 scan.flush = true;
106 scan.length = static_cast<uint32_t>(samples);
107 return scan;
108}
109
110/**
111 * @struct SpeechVoicing
112 * @brief Voicing of each interval, as SpeechSegmentation holds it.
113 */
115 /** Voiced share of each interval's windows. */
116 std::vector<double> voiced_fraction;
117 /** Median frequency of each interval's voiced windows. */
118 std::vector<double> f0;
119};
120
121/**
122 * @brief The waveform analyzer settings the voicing measure uses at the given rate and hop.
123 *
124 * Unbiased periodicity, so that one voicing threshold serves every pitch.
125 */
126[[nodiscard]] inline WaveformAnalyzerConfig voicing_analyzer_config(double sample_rate, uint32_t hop = 256)
127{
128 WaveformAnalyzerConfig settings;
129 settings.sample_rate = sample_rate;
130 settings.hop_size = hop;
131 settings.unbiased_periodicity = true;
132 return settings;
133}
134
135/**
136 * @brief The stretches of a recording where the waveform is voiced.
137 * @param analyzer Analyzer built from voicing_analyzer_config with the same hop.
138 * @param samples One channel of samples.
139 * @param threshold Periodicity at or above which a window is voiced.
140 * @param hop Hop of the analyzer. Each voiced window stands for the hop samples around its centre.
141 * @return Sorted [start, end) pairs, voiced windows that touch joined.
142 */
143[[nodiscard]] inline std::vector<std::pair<size_t, size_t>> voiced_intervals(StandardWaveformAnalyzer& analyzer,
144 std::span<const double> samples, double threshold, uint32_t hop)
145{
146 if (samples.size() < WaveformAnalyzerConfig {}.window_size || hop == 0) {
147 return {};
148 }
149 const auto analysis = analyzer.analyze_waveform(
150 std::vector<Kakshya::DataVariant> { std::vector<double>(samples.begin(), samples.end()) });
151 if (analysis.channels.empty()) {
152 return {};
153 }
154 const auto& waveform = analysis.channels[0];
155
156 std::vector<size_t> cells;
157 for (size_t window = 0; window < waveform.periodicity.size() && window < waveform.window_positions.size(); ++window) {
158 if (waveform.periodicity[window] >= threshold) {
159 const auto& [first, last] = waveform.window_positions[window];
160 const size_t centre = (first + last) / 2;
161 cells.push_back(centre >= hop / 2 ? centre - hop / 2 : 0);
162 }
163 }
165 Kinesis::Discrete::intervals_from_window_starts(cells, hop, samples.size()));
166}
167
168/**
169 * @brief Voiced share and median frequency of the waveform windows that start in each interval.
170 * @param analyzer Analyzer built from voicing_analyzer_config.
171 * @param samples One channel of samples.
172 * @param speech Half open sample intervals.
173 * @param voicing_threshold Periodicity at or above which a window is voiced.
174 * @return One entry per interval; 0 for an interval holding no windows or no voiced window.
175 */
176[[nodiscard]] inline SpeechVoicing measure_voicing(StandardWaveformAnalyzer& analyzer, std::span<const double> samples,
177 const std::vector<std::pair<size_t, size_t>>& speech, double voicing_threshold)
178{
179 SpeechVoicing voicing;
180 voicing.voiced_fraction.assign(speech.size(), 0.0);
181 voicing.f0.assign(speech.size(), 0.0);
182 if (speech.empty() || samples.size() < WaveformAnalyzerConfig {}.window_size) {
183 return voicing;
184 }
185
186 const auto analysis = analyzer.analyze_waveform(
187 std::vector<Kakshya::DataVariant> { std::vector<double>(samples.begin(), samples.end()) });
188 if (analysis.channels.empty()) {
189 return voicing;
190 }
191 const auto& waveform = analysis.channels[0];
192
193 std::vector<size_t> starts;
194 starts.reserve(waveform.window_positions.size());
195 for (const auto& position : waveform.window_positions) {
196 starts.push_back(position.first);
197 }
199 waveform.periodicity, starts, speech, voicing_threshold);
200
201 std::vector<double> voiced_frequency;
202 std::vector<size_t> voiced_starts;
203 for (size_t window = 0; window < starts.size() && window < waveform.periodicity.size(); ++window) {
204 if (waveform.periodicity[window] >= voicing_threshold) {
205 voiced_frequency.push_back(waveform.frequency[window]);
206 voiced_starts.push_back(starts[window]);
207 }
208 }
209 voicing.f0 = Kinesis::Discrete::interval_median(voiced_frequency, voiced_starts, speech);
210 return voicing;
211}
212
213/**
214 * @class SpeechSegmenter
215 * @brief The speech intervals of a whole mono 16 kHz recording.
216 *
217 * Runs Silero VAD over the recording and thresholds its probabilities into
218 * speech intervals. With SpeechSettings::measure it also runs a
219 * WaveformAnalyzer once over the recording and reports, per interval, the
220 * share of voiced windows and their median frequency. Without it no waveform
221 * analysis is made.
222 *
223 * Voiced means periodic in the 70 to 400 Hz band, which a hum or a sung note
224 * also is; the speech intervals are what say the sound is speech.
225 *
226 * OutputType selects the output: Kakshya::RegionGroup (one region per speech
227 * interval, the default) or std::vector<Kakshya::DataVariant> (the speech
228 * audio, concatenated). The facet SpeechSegmentation is always set. Blocking,
229 * one channel, not in the default registry. It must not run on the audio thread.
230 */
231template <ComputeData InputType = std::vector<Kakshya::DataVariant>, ComputeData OutputType = Kakshya::RegionGroup>
232class SpeechSegmenter : public Extractor<InputType, OutputType> {
233public:
238
239 static constexpr Target target = targets::vulkan;
240
241 /**
242 * @brief Construct from the weights of the speech network.
243 * @param vad_weights Tensors of Silero VAD at 16 kHz, as in silero_vad_16k.safetensors.
244 * @param config Segmentation settings.
245 * @throws std::invalid_argument When diagnose refuses the config, or the weights are refused by the network.
246 */
248 : m_vad(vad_weights, vad_settings(config))
249 {
250 if (const std::string reason = diagnose(config); !reason.empty()) {
252 std::source_location::current(), "SpeechSegmenter: {}", reason);
253 }
254 this->set_config(std::move(config));
255 }
256
257 [[nodiscard]] ConfigRefs configs() const override
258 {
259 return this->stored_configs(supports {});
260 }
261
262 [[nodiscard]] ExtractionType get_extraction_type() const override
263 {
265 }
266
267 /**
268 * @brief Why a config cannot be segmented with.
269 * @return The reason, empty when usable.
270 */
271 [[nodiscard]] static std::string diagnose(const SpeechSegmenterConfig& config)
272 {
273 if (config.sample_rate != static_cast<double>(SileroVadModel::sample_rate)) {
274 return std::format("sample_rate {} is not the {} Hz the network runs at; convert the input first, for example with Kinesis::Discrete::resample",
276 }
277 if (!std::isfinite(config.speech.voicing_threshold) || config.speech.voicing_threshold <= 0.0) {
278 return "voicing_threshold must be finite and greater than 0";
279 }
280 const auto scan = speech_scan_settings(config.speech, 0);
282 }
283
284 /**
285 * @brief Segment samples under the given settings, without the Datum wrapper.
286 * @param samples One channel of 16 kHz samples.
287 * @param config Settings for this call; the stored config is not used or changed.
288 * @return The record of the run.
289 * @throws std::invalid_argument When diagnose refuses the config.
290 */
291 SpeechSegmentation segment(std::span<const double> samples, const SpeechSegmenterConfig& config)
292 {
293 if (const std::string reason = diagnose(config); !reason.empty()) {
295 std::source_location::current(), "SpeechSegmenter: {}", reason);
296 }
297
299 record.config = config;
300 if (samples.empty()) {
301 return record;
302 }
303 find_speech(samples, config, record);
304 if (config.speech.measure) {
305 measure_speech(samples, config, record);
306 }
307 return record;
308 }
309
310 /**
311 * @brief Type-safe segmentation.
312 * @return The record of the run.
313 */
315 {
316 const auto result = this->apply_operation(data);
317 const auto* record = result.facets.template get<SpeechSegmentation>();
318 if (record == nullptr) {
320 std::source_location::current(), "Speech segmentation produced no result");
321 }
322 return *record;
323 }
324
326 {
327 return this->extract_segments(input_type { data });
328 }
329
330 /**
331 * @brief One while a device is up, zero otherwise.
332 */
333 static float fitness(const input_type& /*input*/)
334 {
336 }
337
338protected:
339 [[nodiscard]] std::string get_extractor_name() const override
340 {
341 return "SpeechSegmenter";
342 }
343
345 {
346 try {
347 const auto& cfg = this->template config<SpeechSegmenterConfig>();
348
349 auto [channels, info] = OperationHelper::extract_structured_double(const_cast<input_type&>(input));
350 if (channels.size() != 1) {
352 std::source_location::current(), "SpeechSegmenter analyses one channel and was given {}", channels.size());
353 }
354 const std::span<const double> samples { channels[0].data(), channels[0].size() };
355
356 const SpeechSegmentation record = segment(samples, cfg);
357 output_type output = build_output(record, samples, info);
358 output.metadata = input.metadata;
359 output.facets = input.facets;
360 output.facets.set(record);
361 return output;
362 } catch (const std::exception& e) {
363 MF_ERROR(Journal::Component::Yantra, Journal::Context::ComputeMatrix, "Speech segmentation failed: {}", e.what());
364 output_type error_result {};
365 error_result.metadata = input.metadata;
366 error_result.facets = input.facets;
367 return error_result;
368 }
369 }
370
371private:
373 {
374 VadAnalyzerConfig settings;
375 settings.flush_tail = true;
376 settings.sample_rate = config.sample_rate;
377 return settings;
378 }
379
380 void find_speech(std::span<const double> samples, const SpeechSegmenterConfig& cfg, SpeechSegmentation& record)
381 {
382 m_vad.reset();
383 const auto probabilities = m_vad.analyze_speech(
384 std::vector<Kakshya::DataVariant> { std::vector<double>(samples.begin(), samples.end()) })
385 .probabilities;
386 if (probabilities.empty()) {
387 return;
388 }
389
390 Eigen::MatrixXd scores(static_cast<Eigen::Index>(probabilities.size()), 1);
391 for (size_t chunk = 0; chunk < probabilities.size(); ++chunk) {
392 scores(static_cast<Eigen::Index>(chunk), 0) = probabilities[chunk];
393 }
394 m_intervals.set_config(speech_scan_settings(cfg.speech, samples.size()));
395 const auto intervals = m_intervals.extract_intervals(scores);
396 if (!intervals.channels.empty()) {
397 record.speech = intervals.channels[0].intervals;
398 }
399 }
400
401 void measure_speech(std::span<const double> samples, const SpeechSegmenterConfig& cfg, SpeechSegmentation& record)
402 {
403 if (!m_waveform) {
405 }
406 auto voicing = measure_voicing(*m_waveform, samples, record.speech, cfg.speech.voicing_threshold);
407 record.voiced_fraction = std::move(voicing.voiced_fraction);
408 record.f0 = std::move(voicing.f0);
409 }
410
411 output_type build_output(const SpeechSegmentation& record, std::span<const double> samples, DataStructureInfo& info)
412 {
413 if constexpr (std::is_same_v<OutputType, Kakshya::RegionGroup>) {
414 ChannelIntervals intervals;
415 intervals.intervals = record.speech;
416 output_type output;
417 output.data = interval_regions(intervals, 0, 0, "speech");
418 return output;
419 } else {
420 std::vector<std::vector<double>> channel { Kinesis::Discrete::slice_intervals(samples, record.speech) };
421 return this->convert_result(channel, info);
422 }
423 }
424
427 std::optional<StandardWaveformAnalyzer> m_waveform;
428};
429
430/// Regions: one region per speech interval
432
433/// Audio: the speech intervals, concatenated
435
436} // 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.
Runs of a score sequence that stay above a threshold, found on the GPU in order.
Runs of a score sequence that stay above a threshold, found in order as a stream, for MayaFlux::Kines...
Voice activity probability per 32 ms chunk from a learned network, run on the GPU.
Time-domain descriptors of a waveform computed on the GPU, exactly, with no fp64 on the device.
void set(T value)
Stores a struct under its type identity.
Definition Facets.hpp:107
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 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 constexpr uint32_t sample_rate
Sample rate in Hz the network was trained and runs at.
static constexpr uint32_t chunk_samples
void find_speech(std::span< const double > samples, const SpeechSegmenterConfig &cfg, SpeechSegmentation &record)
static float fitness(const input_type &)
One while a device is up, zero otherwise.
output_type build_output(const SpeechSegmentation &record, std::span< const double > samples, DataStructureInfo &info)
SpeechSegmentation extract_segments(const InputType &data)
static VadAnalyzerConfig vad_settings(const SpeechSegmenterConfig &config)
Extractor< InputType, OutputType > base_type
void measure_speech(std::span< const double > samples, const SpeechSegmenterConfig &cfg, SpeechSegmentation &record)
output_type extract_implementation(const input_type &input) override
Pure virtual extraction implementation - derived classes implement this.
Supports< SpeechSegmenterConfig > supports
ConfigRefs configs() const override
The base view of the config structs this operation holds.
ExtractionType get_extraction_type() const override
Gets the extraction type category for this extractor.
SpeechSegmenter(const Kakshya::TensorSet &vad_weights, SpeechSegmenterConfig config={})
Construct from the weights of the speech network.
static std::string diagnose(const SpeechSegmenterConfig &config)
Why a config cannot be segmented with.
std::string get_extractor_name() const override
Get extractor-specific name (derived classes override this).
SpeechSegmentation segment(std::span< const double > samples, const SpeechSegmenterConfig &config)
Segment samples under the given settings, without the Datum wrapper.
SpeechSegmentation extract_segments(const input_type &data)
Type-safe segmentation.
The speech intervals of a whole mono 16 kHz recording.
WaveformAnalysis analyze_waveform(const input_type &data)
Type-safe waveform analysis.
@ ComputeMatrix
Compute operations (Yantra - algorithms, matrices, DSP).
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
std::string diagnose_interval_scan(const IntervalScanConfig &config)
Why a config cannot be scanned.
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 > > intervals_from_window_starts(const std::vector< size_t > &window_starts, uint32_t window_size, size_t data_size)
Build [start, end) intervals from window start indices.
Definition Extract.cpp:147
std::vector< double > interval_share_above(std::span< const double > values, std::span< const size_t > positions, const std::vector< std::pair< size_t, size_t > > &intervals, double threshold)
Share of the values inside each interval that are at or above a threshold.
Definition Extract.cpp:94
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< double > interval_median(std::span< const double > values, std::span< const size_t > positions, const std::vector< std::pair< size_t, size_t > > &intervals)
Median of the values inside each interval.
Definition Extract.cpp:110
void threshold(std::span< const float > gray, std::span< float > dst, float value)
Global threshold writing into caller-supplied buffer.
Definition PixelOps.cpp:194
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
VadAnalyzer< std::vector< Kakshya::DataVariant >, Eigen::MatrixXd > StandardVadAnalyzer
Standard VAD analyzer: DataVariant -> MatrixXd.
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.
IntervalExtractor< Eigen::MatrixXd, std::vector< std::vector< double > > > MatrixIntervalExtractor
Matrix interval extractor: the MatrixXd an analyzer returns, one score channel per column -> interval...
Kinesis::Discrete::IntervalScanConfig interval_scan_config(const IntervalScanSettings &settings, uint32_t length)
The host scan configuration of one column's settings over a stream of the given length.
IntervalExtractorConfig speech_scan_settings(const SpeechSettings &speech, size_t samples)
The interval scan settings of speech runs, for a recording of the given length.
SpeechSegmenter< std::vector< Kakshya::DataVariant >, Kakshya::RegionGroup > RegionSpeechSegmenter
Regions: one region per speech interval.
WaveformAnalyzer< std::vector< Kakshya::DataVariant >, Eigen::MatrixXd > StandardWaveformAnalyzer
Standard waveform analyzer: DataVariant -> MatrixXd.
SpeechSegmenter< std::vector< Kakshya::DataVariant >, std::vector< Kakshya::DataVariant > > AudioSpeechSegmenter
Audio: the speech intervals, concatenated.
SpeechVoicing measure_voicing(StandardWaveformAnalyzer &analyzer, std::span< const double > samples, const std::vector< std::pair< size_t, size_t > > &speech, double voicing_threshold)
Voiced share and median frequency of the waveform windows that start in each interval.
std::vector< std::reference_wrapper< const OperationConfig > > ConfigRefs
Borrowed views of the configs an operation holds.
Kakshya::RegionGroup interval_regions(const ChannelIntervals &intervals, uint32_t first_channel, uint32_t last_channel, std::string name="intervals")
One region per interval, spanning the given channels.
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
Organizes related signal regions into a categorized collection.
Named tensors that belong together, such as a model's weights or I/O.
Definition Tensor.hpp:167
uint32_t window_size
Analysis window length in samples.
Definition Analyzer.hpp:64
uint32_t hop_size
Distance between successive windows in samples.
Definition Analyzer.hpp:66
std::vector< std::pair< size_t, size_t > > intervals
Intervals of one channel, half open sample ranges in stream order.
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
Settings of an IntervalExtractor.
std::vector< double > f0
Median frequency of each interval's voiced windows, empty unless measured.
std::vector< double > voiced_fraction
Voiced share of each interval's windows, empty unless measured.
SpeechSegmenterConfig config
Settings the segmentation was produced under.
std::vector< std::pair< size_t, size_t > > speech
Speech intervals, half open sample ranges.
Record of one SpeechSegmenter run, stored on the output's facets.
double sample_rate
Sample rate in Hz of the input.
SpeechSettings speech
How speech is found and measured.
Settings of a SpeechSegmenter.
double threshold
Speech probability at or above which speech starts.
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.
uint32_t min_speech
Shortest speech run kept, in samples.
uint32_t padding
Samples added on each side of a speech run.
double voicing_threshold
Periodicity at or above which a window is voiced.
uint32_t min_silence
Shortest silence that ends a speech run, in samples.
How speech runs are found and measured.
std::vector< double > voiced_fraction
Voiced share of each interval's windows.
std::vector< double > f0
Median frequency of each interval's voiced windows.
Voicing of each interval, as SpeechSegmentation holds it.
The config structs an operation class accepts, declared as using supports.
A set of (device, runtime) pairs.
bool flush_tail
Also run the partial chunk left at the end of each call, padded with zeros.
double sample_rate
Sample rate in Hz of the input.
Settings of a VadAnalyzer.
std::vector< ChannelWaveform > channels
bool unbiased_periodicity
Report the strength of the chosen lag divided by the share of window pairs that lag has,...
double sample_rate
Samples per second of the analysed signal.
Settings of a WaveformAnalyzer.