|
kaldi-native-fbank C++ API
Kaldi-compatible feature extraction C++ API
|
Streaming pitch extraction with post-processing (kaldi's OnlinePitchFeature + OnlineProcessPitch). More...
#include <feature-pitch.h>
Public Member Functions | |
| OnlinePitch (const PitchExtractionOptions &opts, const ProcessPitchOptions &popts={}) | |
| Construct with the given extraction and post-processing options. | |
| ~OnlinePitch () | |
| int32_t | Dim () const |
| float | FrameShiftInSeconds () const |
| int32_t | NumFramesReady () const |
| bool | IsLastFrame (int32_t frame) const |
| std::vector< float > | GetFrame (int32_t frame) const |
| Return the frame-th feature vector. | |
| void | AcceptWaveform (float sampling_rate, const float *waveform, int32_t n) |
| Add waveform samples to the extractor. | |
| void | InputFinished () |
| Tell the extractor no more waveform will be added; this flushes out the last frames and fixes the features of all frames. | |
Streaming pitch extraction with post-processing (kaldi's OnlinePitchFeature + OnlineProcessPitch).
This is the streaming interface of kaldi's compute-and-process-kaldi-pitch-feats: it consumes waveform chunks and produces the processed pitch features (by default 3-dimensional: POV, normalized-log-pitch, delta-pitch).
Usage mirrors OnlineMfcc: feed the waveform with AcceptWaveform(), call InputFinished() when no more data is coming, then read frames with GetFrame(). Frames may become available before InputFinished() (with latency: see normalization_right_context and max_frames_latency), and InputFinished() flushes the remainder.
Features for a given frame may be revised as more data arrives (the Viterbi traceback and the normalization window settle over time), except for the delta-pitch noise which is drawn once per frame. After InputFinished(), the features are final and stable.
|
explicit |
Construct with the given extraction and post-processing options.
| [in] | opts | Raw pitch extraction options. |
| [in] | popts | Post-processing options; at least one of the add_* flags must be true. |
| knf::OnlinePitch::~OnlinePitch | ( | ) |
| void knf::OnlinePitch::AcceptWaveform | ( | float | sampling_rate, |
| const float * | waveform, | ||
| int32_t | n ) |
Add waveform samples to the extractor.
| [in] | sampling_rate | Sample rate of the waveform in Hz; must match opts.samp_freq. |
| [in] | waveform | Pointer to a 1-D array of n samples. |
| [in] | n | Number of samples in waveform. |
| int32_t knf::OnlinePitch::Dim | ( | ) | const |
| float knf::OnlinePitch::FrameShiftInSeconds | ( | ) | const |
| std::vector< float > knf::OnlinePitch::GetFrame | ( | int32_t | frame | ) | const |
Return the frame-th feature vector.
The frame is computed on demand and cached internally; calling this repeatedly for the same frame returns the same values (as long as frame < NumFramesReady()).
| [in] | frame | Frame index, must be < NumFramesReady(). |
| void knf::OnlinePitch::InputFinished | ( | ) |
Tell the extractor no more waveform will be added; this flushes out the last frames and fixes the features of all frames.
| bool knf::OnlinePitch::IsLastFrame | ( | int32_t | frame | ) | const |
| int32_t knf::OnlinePitch::NumFramesReady | ( | ) | const |