Class for computing spectrogram features.
Definition at line 67 of file feature-spectrogram.h.
Function that computes one frame of spectrogram features from one frame of signal.
- Parameters
-
[in] | signal_raw_log_energy | The log-energy of the frame of the signal prior to windowing and pre-emphasis, or log(numeric_limits<float>::min()), whichever is greater. Must be ignored by this function if this class returns false from this->NeedsRawLogEnergy(). |
[in] | vtln_warp | This is ignored by this function, it's only needed for interface compatibility. |
[in] | signal_frame | One frame of the signal, as extracted using the function ExtractWindow() using the options returned by this->GetFrameOptions(). The function will use the vector as a workspace, which is why it's a non-const pointer. |
[out] | feature | Pointer to a vector of size this->Dim(), to which the computed feature will be written. |
Definition at line 47 of file feature-spectrogram.cc.
References VectorBase< Real >::ApplyFloor(), kaldi::ComputePowerSpectrum(), VectorBase< Real >::CopyFromVec(), VectorBase< Real >::Data(), VectorBase< Real >::Dim(), SpectrogramComputer::Dim(), SpectrogramOptions::energy_floor, SpectrogramOptions::frame_opts, KALDI_ASSERT, kaldi::Log(), SpectrogramComputer::log_energy_floor_, SpectrogramComputer::opts_, FrameExtractionOptions::PaddedWindowSize(), SpectrogramOptions::raw_energy, kaldi::RealFft(), SpectrogramOptions::return_raw_fft, SpectrogramComputer::srfft_, and kaldi::VecVec().
52 feature->Dim() == this->
Dim());
57 signal_raw_log_energy =
Log(std::max<BaseFloat>(
VecVec(*signal_frame, *signal_frame),
58 std::numeric_limits<float>::epsilon()));
61 srfft_->Compute(signal_frame->Data(),
true);
66 feature->CopyFromVec(*signal_frame);
72 SubVector<BaseFloat> power_spectrum(*signal_frame,
73 0, signal_frame->Dim() / 2 + 1);
75 power_spectrum.ApplyFloor(std::numeric_limits<float>::epsilon());
76 power_spectrum.ApplyLog();
78 feature->CopyFromVec(power_spectrum);
84 (*feature)(0) = signal_raw_log_energy;
void ComputePowerSpectrum(VectorBase< BaseFloat > *waveform)
SplitRadixRealFft< BaseFloat > * srfft_
#define KALDI_ASSERT(cond)
Real VecVec(const VectorBase< Real > &a, const VectorBase< Real > &b)
Returns dot product between v1 and v2.
FrameExtractionOptions frame_opts
BaseFloat log_energy_floor_
void RealFft(VectorBase< Real > *v, bool forward)
RealFft is a fourier transform of real inputs.