kaldi-native-fbank C++ API
Kaldi-compatible feature extraction C++ API
Loading...
Searching...
No Matches
feature-raw-audio-samples.h
Go to the documentation of this file.
1
18
27
28#ifndef KALDI_NATIVE_FBANK_CSRC_FEATURE_RAW_AUDIO_SAMPLES_H_
29#define KALDI_NATIVE_FBANK_CSRC_FEATURE_RAW_AUDIO_SAMPLES_H_
30
31#include <cstdint>
32#include <sstream>
33#include <string>
34#include <vector>
35
37
38namespace knf {
39
50
55 frame_opts.window_type = "rectangular";
56 frame_opts.dither = 0;
57 frame_opts.preemph_coeff = 0;
58 frame_opts.remove_dc_offset = false;
59 frame_opts.round_to_power_of_two = false;
60 frame_opts.snip_edges = true;
61 }
62
64 std::string ToString() const {
65 std::ostringstream os;
66 os << "frame_opts: \n";
67 os << frame_opts << "\n";
68 os << "\n";
69 return os.str();
70 }
71};
72
73std::ostream &operator<<(std::ostream &os, const RawAudioSamplesOptions &opts);
74
86 public:
89
92 : opts_(opts) {}
93
95 int32_t Dim() const {
96 return opts_.frame_opts.frame_length_ms * opts_.frame_opts.samp_freq / 1000;
97 }
98
100 bool NeedRawLogEnergy() const { return false; }
101
104 return opts_.frame_opts;
105 }
106
108 const RawAudioSamplesOptions &GetOptions() const { return opts_; }
109
112 void Compute(float unused_signal_raw_log_energy, float unused_vtln_warp,
113 std::vector<float> *signal_frame, float *feature);
114
115 private:
117};
118
119} // namespace knf
120
121#endif // KALDI_NATIVE_FBANK_CSRC_FEATURE_RAW_AUDIO_SAMPLES_H_
RawAudioSamplesOptions Options
Option type accepted by this computer.
Definition feature-raw-audio-samples.h:88
const FrameExtractionOptions & GetFrameOptions() const
Return the frame-extraction options.
Definition feature-raw-audio-samples.h:103
bool NeedRawLogEnergy() const
Always false: raw log energy is not used by this feature type.
Definition feature-raw-audio-samples.h:100
RawAudioSamplesComputer(const RawAudioSamplesOptions &opts)
Construct from the given options.
Definition feature-raw-audio-samples.h:91
int32_t Dim() const
Return the frame size in samples.
Definition feature-raw-audio-samples.h:95
const RawAudioSamplesOptions & GetOptions() const
Return the options this computer was constructed with.
Definition feature-raw-audio-samples.h:108
void Compute(float unused_signal_raw_log_energy, float unused_vtln_warp, std::vector< float > *signal_frame, float *feature)
Copy one frame of raw samples to feature; the two energy/vtln arguments are unused.
Waveform windowing and frame extraction.
This file is part of kaldi-native-fbank.
Definition feature-cmvn.h:42
std::ostream & operator<<(std::ostream &os, const FbankOptions &opts)
Write the options to the stream, one option per line.
Options for extracting frames from a waveform.
Definition feature-window.h:57
Options for framing raw audio samples.
Definition feature-raw-audio-samples.h:47
FrameExtractionOptions frame_opts
Options for frame extraction; see FrameExtractionOptions.
Definition feature-raw-audio-samples.h:49
std::string ToString() const
Return the options as a string.
Definition feature-raw-audio-samples.h:64
RawAudioSamplesOptions()
Construct with frame_opts set up for unprocessed samples: rectangular window, no dithering,...
Definition feature-raw-audio-samples.h:54