MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ extract_implementation()

template<ComputeData InputType = std::vector<Kakshya::DataVariant>, ComputeData OutputType = Kakshya::RegionGroup>
output_type MayaFlux::Yantra::SpeechSegmenter< InputType, OutputType >::extract_implementation ( const input_type & input)
inlineoverrideprotectedvirtual

Pure virtual extraction implementation - derived classes implement this.

Parameters
inputInput data with metadata
Returns
Raw extraction output before scope processing

Implements MayaFlux::Yantra::Extractor< InputType, OutputType >.

Definition at line 344 of file SpeechSegmenter.hpp.

345 {
346 try {
347 const auto& cfg = this->template config<SpeechSegmenterConfig>();
348
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
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());
365 error_result.metadata = input.metadata;
366 error_result.facets = input.facets;
367 return error_result;
368 }
369 }
#define MF_ERROR(comp, ctx,...)
const Config & config() const
The stored config struct of type Config, or its defaults when none was set.
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...
output_type build_output(const SpeechSegmentation &record, std::span< const double > samples, DataStructureInfo &info)
SpeechSegmentation segment(std::span< const double > samples, const SpeechSegmenterConfig &config)
Segment samples under the given settings, without the Datum wrapper.
The speech intervals of a whole mono 16 kHz recording.