|
kaldi-native-fbank C++ API
Kaldi-compatible feature extraction C++ API
|
Options for the raw pitch extraction stage (kaldi's PitchExtractionOptions). More...
#include <feature-pitch.h>
Public Member Functions | |
| int32_t | NccfWindowSize () const |
| int32_t | NccfWindowShift () const |
Public Attributes | |
| float | samp_freq = 16000 |
| Waveform data sample frequency in Hz (must match the waveform). | |
| float | frame_shift_ms = 10.0 |
Frame shift in milliseconds. Kaldi --frame-shift. | |
| float | frame_length_ms = 25.0 |
Frame length in milliseconds. Kaldi --frame-length. | |
| float | preemph_coeff = 0.0 |
| Preemphasis coefficient (use is deprecated in kaldi; kept for parity). | |
| float | min_f0 = 50 |
Min F0 to search for (Hz). Kaldi --min-f0. | |
| float | max_f0 = 400 |
Max F0 to search for (Hz). Kaldi --max-f0. | |
| float | soft_min_f0 = 10.0 |
| Minimum f0, applied in a soft way; must not exceed min_f0. | |
| float | penalty_factor = 0.1 |
| Cost factor for F0 change (Viterbi inter-frame penalty). | |
| float | lowpass_cutoff = 1000 |
Cutoff frequency for the low-pass filter (Hz). Kaldi --lowpass-cutoff. | |
| float | resample_freq = 4000 |
| Frequency that we down-sample the signal to. | |
| float | delta_pitch = 0.005 |
| The pitch tolerance in pruning lags: the relative change in pitch that the algorithm measures (the lags are spaced in a geometric progression with ratio \( 1 + \mathrm{delta\_pitch} \)). | |
| float | nccf_ballast = 7000 |
| Increasing this factor reduces NCCF for quiet frames, helping ensure pitch continuity in unvoiced regions. | |
| int32_t | lowpass_filter_width = 1 |
| Integer that determines the filter width of the low-pass filter; more gives a sharper filter. | |
| int32_t | upsample_filter_width = 5 |
| Integer that determines the filter width when upsampling the NCCF. | |
| int32_t | max_frames_latency = 0 |
| The maximum number of frames of latency that we allow the pitch processing to introduce, for online operation. | |
| int32_t | frames_per_chunk = 0 |
| Only relevant for ComputeAndProcessKaldiPitch. | |
| bool | simulate_first_pass_online = false |
| Only relevant for ComputeAndProcessKaldiPitch, and only if frames_per_chunk is nonzero. | |
| int32_t | recompute_frame = 500 |
| Only relevant for online operation or when emulating online operation (e.g. | |
| bool | nccf_ballast_online = false |
| This is a "hidden config" used only for testing the online pitch extraction. | |
| bool | snip_edges = true |
| If false, the incomplete frames near the ending edge won't be snipped, so that the number of frames is the file size divided by the frame-shift. | |
Options for the raw pitch extraction stage (kaldi's PitchExtractionOptions).
Mirrors the flags of kaldi's compute-kaldi-pitch-feats / OnlinePitchFeature; see src/feat/pitch-functions.h.
|
inline |
|
inline |
| float knf::PitchExtractionOptions::delta_pitch = 0.005 |
The pitch tolerance in pruning lags: the relative change in pitch that the algorithm measures (the lags are spaced in a geometric progression with ratio \( 1 + \mathrm{delta\_pitch} \)).
Kaldi --delta-pitch.
| float knf::PitchExtractionOptions::frame_length_ms = 25.0 |
Frame length in milliseconds. Kaldi --frame-length.
| float knf::PitchExtractionOptions::frame_shift_ms = 10.0 |
Frame shift in milliseconds. Kaldi --frame-shift.
| int32_t knf::PitchExtractionOptions::frames_per_chunk = 0 |
Only relevant for ComputeAndProcessKaldiPitch.
If nonzero, we provide the input as chunks of this size. This affects the energy normalization which has a small effect on the resulting features, especially at the beginning of a file. For best compatibility with online operation, you might want to set this to a small value, like one frame. Kaldi --frames-per-chunk.
| float knf::PitchExtractionOptions::lowpass_cutoff = 1000 |
Cutoff frequency for the low-pass filter (Hz). Kaldi --lowpass-cutoff.
| int32_t knf::PitchExtractionOptions::lowpass_filter_width = 1 |
Integer that determines the filter width of the low-pass filter; more gives a sharper filter.
Kaldi --lowpass-filter-width.
| float knf::PitchExtractionOptions::max_f0 = 400 |
Max F0 to search for (Hz). Kaldi --max-f0.
| int32_t knf::PitchExtractionOptions::max_frames_latency = 0 |
The maximum number of frames of latency that we allow the pitch processing to introduce, for online operation.
If you set this to a large value, there would be no inaccuracy from the Viterbi traceback (but it might make you wait to see the pitch). Normalization right context is more relevant for online latency; you can leave this at zero. Kaldi --max-frames-latency.
| float knf::PitchExtractionOptions::min_f0 = 50 |
Min F0 to search for (Hz). Kaldi --min-f0.
| float knf::PitchExtractionOptions::nccf_ballast = 7000 |
Increasing this factor reduces NCCF for quiet frames, helping ensure pitch continuity in unvoiced regions.
Kaldi --nccf-ballast.
| bool knf::PitchExtractionOptions::nccf_ballast_online = false |
This is a "hidden config" used only for testing the online pitch extraction.
If true, we compute the signal root-mean-squared for the ballast term only up to the current frame, rather than the end of the current chunk of signal. This makes the output insensitive to the chunking, which is useful for testing purposes. Kaldi --nccf-ballast-online.
| float knf::PitchExtractionOptions::penalty_factor = 0.1 |
Cost factor for F0 change (Viterbi inter-frame penalty).
Kaldi --penalty-factor.
| float knf::PitchExtractionOptions::preemph_coeff = 0.0 |
Preemphasis coefficient (use is deprecated in kaldi; kept for parity).
Kaldi --preemphasis-coefficient.
| int32_t knf::PitchExtractionOptions::recompute_frame = 500 |
Only relevant for online operation or when emulating online operation (e.g.
when setting frames_per_chunk). This is the frame-index on which we recompute the NCCF (e.g. frame-index 500 = after 5 seconds); if the segment ends before this we do it when the segment ends. We do this by re-computing the signal average energy, which affects the NCCF via the "ballast term", scaling the resampled NCCF by a factor derived from the average change in the "ballast term", and re-doing the backtrace computation. Making this infinity would be the most exact, but would introduce unwanted latency at the end of long utterances, for little benefit. Kaldi --recompute-frame.
| float knf::PitchExtractionOptions::resample_freq = 4000 |
Frequency that we down-sample the signal to.
Must be more than twice lowpass_cutoff. Kaldi --resample-frequency.
| float knf::PitchExtractionOptions::samp_freq = 16000 |
Waveform data sample frequency in Hz (must match the waveform).
Kaldi --sample-frequency.
| bool knf::PitchExtractionOptions::simulate_first_pass_online = false |
Only relevant for ComputeAndProcessKaldiPitch, and only if frames_per_chunk is nonzero.
If true, we output the features as soon as they are available, which simulates the first-pass features you would get in online decoding. If false, the features you get will be the same as those available at the end of the utterance, after InputFinished() has been called (e.g. during lattice rescoring). Kaldi --simulate-first-pass-online.
| bool knf::PitchExtractionOptions::snip_edges = true |
If false, the incomplete frames near the ending edge won't be snipped, so that the number of frames is the file size divided by the frame-shift.
This makes different types of features give the same number of frames. Kaldi --snip-edges. (Note: unlike the other feature types, kaldi's pitch extractor defaults this to true.)
| float knf::PitchExtractionOptions::soft_min_f0 = 10.0 |
Minimum f0, applied in a soft way; must not exceed min_f0.
Kaldi --soft-min-f0.
| int32_t knf::PitchExtractionOptions::upsample_filter_width = 5 |
Integer that determines the filter width when upsampling the NCCF.
Kaldi --upsample-filter-width.