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

◆ phoneme_regions()

Kakshya::RegionGroup MayaFlux::Yantra::phoneme_regions ( const PhonemeAnalysis & analysis,
uint32_t first_channel,
uint32_t last_channel,
std::string name = "phonemes" )
inlinenodiscard

One region per recognised phoneme, labelled with its ARPABET symbol.

A region covers the estimated sample range of its phoneme, see PhonemeEvent. Each carries phoneme_probability and phoneme_class.

Parameters
analysisThe analysis whose events become regions.
first_channelFirst channel the regions cover.
last_channelLast channel the regions cover, inclusive.
nameName of the group.

Definition at line 175 of file PhonemeAnalyzer.hpp.

177{
178 Kakshya::RegionGroup group(std::move(name));
179 for (const auto& event : analysis.events) {
180 if (event.end <= event.start) {
181 continue;
182 }
183 auto region = Kakshya::Region::audio_span(event.start, event.end - 1,
184 first_channel, last_channel, std::string(HubertPhonemeModel::label(event.phoneme)));
185 region.set(phoneme_probability, static_cast<double>(event.probability));
186 region.set(phoneme_class, event.phoneme);
187 group.add_region(region);
188 }
189 return group;
190}
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.
const Facet< uint32_t > phoneme_class
Region attribute: the class of the region's phoneme.
const Facet< double > phoneme_probability
Region attribute: the probability the network gave the region's phoneme.
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
std::vector< PhonemeEvent > events
The phonemes in order: every frame whose most probable class is a phoneme and differs from the frame ...

References MayaFlux::Kakshya::RegionGroup::add_region(), MayaFlux::Kakshya::Region::audio_span(), MayaFlux::Yantra::PhonemeAnalysis::events, MayaFlux::Yantra::HubertPhonemeModel::label(), phoneme_class, and phoneme_probability.

Here is the call graph for this function: