OnlinePitchFeature Class Reference

#include <pitch-functions.h>

Inheritance diagram for OnlinePitchFeature:
Collaboration diagram for OnlinePitchFeature:

Public Member Functions

 OnlinePitchFeature (const PitchExtractionOptions &opts)
 
virtual int32 Dim () const
 
virtual int32 NumFramesReady () const
 returns the feature dimension. More...
 
virtual BaseFloat FrameShiftInSeconds () const
 
virtual bool IsLastFrame (int32 frame) const
 Returns true if this is the last frame. More...
 
virtual void GetFrame (int32 frame, VectorBase< BaseFloat > *feat)
 Outputs the two-dimensional feature consisting of (pitch, NCCF). More...
 
virtual void AcceptWaveform (BaseFloat sampling_rate, const VectorBase< BaseFloat > &waveform)
 This would be called from the application, when you get more wave data. More...
 
virtual void InputFinished ()
 InputFinished() tells the class you won't be providing any more waveform. More...
 
virtual ~OnlinePitchFeature ()
 
- Public Member Functions inherited from OnlineFeatureInterface
virtual void GetFrames (const std::vector< int32 > &frames, MatrixBase< BaseFloat > *feats)
 This is like GetFrame() but for a collection of frames. More...
 
virtual ~OnlineFeatureInterface ()
 Virtual destructor. More...
 

Private Attributes

OnlinePitchFeatureImplimpl_
 

Detailed Description

Definition at line 300 of file pitch-functions.h.

Constructor & Destructor Documentation

◆ OnlinePitchFeature()

OnlinePitchFeature ( const PitchExtractionOptions opts)
explicit

Definition at line 1208 of file pitch-functions.cc.

1209  :impl_(new OnlinePitchFeatureImpl(opts)) { }
OnlinePitchFeatureImpl * impl_

◆ ~OnlinePitchFeature()

~OnlinePitchFeature ( )
virtual

Definition at line 1233 of file pitch-functions.cc.

References OnlinePitchFeature::impl_.

1233  {
1234  delete impl_;
1235 }
OnlinePitchFeatureImpl * impl_

Member Function Documentation

◆ AcceptWaveform()

void AcceptWaveform ( BaseFloat  sampling_rate,
const VectorBase< BaseFloat > &  waveform 
)
virtual

This would be called from the application, when you get more wave data.

Note: the sampling_rate is typically only provided so the code can assert that it matches the sampling rate expected in the options.

Implements OnlineBaseFeature.

Definition at line 1223 of file pitch-functions.cc.

References OnlinePitchFeatureImpl::AcceptWaveform(), and OnlinePitchFeature::impl_.

Referenced by OnlineFeaturePipeline::AcceptWaveform(), OnlineNnet2FeaturePipeline::AcceptWaveform(), kaldi::ComputeAndProcessKaldiPitch(), kaldi::ComputeKaldiPitch(), kaldi::ComputeKaldiPitchFirstPass(), kaldi::UnitTestDelay(), and kaldi::UnitTestPieces().

1225  {
1226  impl_->AcceptWaveform(sampling_rate, waveform);
1227 }
void AcceptWaveform(BaseFloat sampling_rate, const VectorBase< BaseFloat > &waveform)
OnlinePitchFeatureImpl * impl_

◆ Dim()

virtual int32 Dim ( ) const
inlinevirtual

Implements OnlineFeatureInterface.

Definition at line 304 of file pitch-functions.h.

304 { return 2; /* (NCCF, pitch) */ }

◆ FrameShiftInSeconds()

BaseFloat FrameShiftInSeconds ( ) const
virtual

Implements OnlineFeatureInterface.

Definition at line 1215 of file pitch-functions.cc.

References OnlinePitchFeatureImpl::FrameShiftInSeconds(), and OnlinePitchFeature::impl_.

1215  {
1216  return impl_->FrameShiftInSeconds();
1217 }
OnlinePitchFeatureImpl * impl_
BaseFloat FrameShiftInSeconds() const

◆ GetFrame()

void GetFrame ( int32  frame,
VectorBase< BaseFloat > *  feat 
)
virtual

Outputs the two-dimensional feature consisting of (pitch, NCCF).

You should probably post-process this using class OnlineProcessPitch.

Implements OnlineFeatureInterface.

Definition at line 1219 of file pitch-functions.cc.

References OnlinePitchFeatureImpl::GetFrame(), and OnlinePitchFeature::impl_.

Referenced by kaldi::ComputeKaldiPitch(), kaldi::ComputeKaldiPitchFirstPass(), and kaldi::UnitTestPieces().

1219  {
1220  impl_->GetFrame(frame, feat);
1221 }
OnlinePitchFeatureImpl * impl_
void GetFrame(int32 frame, VectorBase< BaseFloat > *feat)

◆ InputFinished()

void InputFinished ( )
virtual

InputFinished() tells the class you won't be providing any more waveform.

This will help flush out the last few frames of delta or LDA features (it will typically affect the return value of IsLastFrame.

Implements OnlineBaseFeature.

Definition at line 1229 of file pitch-functions.cc.

References OnlinePitchFeature::impl_, and OnlinePitchFeatureImpl::InputFinished().

Referenced by kaldi::ComputeAndProcessKaldiPitch(), kaldi::ComputeKaldiPitch(), kaldi::ComputeKaldiPitchFirstPass(), OnlineFeaturePipeline::InputFinished(), OnlineNnet2FeaturePipeline::InputFinished(), kaldi::UnitTestDelay(), and kaldi::UnitTestPieces().

1229  {
1230  impl_->InputFinished();
1231 }
OnlinePitchFeatureImpl * impl_

◆ IsLastFrame()

bool IsLastFrame ( int32  frame) const
virtual

Returns true if this is the last frame.

Frame indices are zero-based, so the first frame is zero. IsLastFrame(-1) will return false, unless the file is empty (which is a case that I'm not sure all the code will handle, so be careful). This function may return false for some frame if we haven't yet decided to terminate decoding, but later true if we decide to terminate decoding. This function exists mainly to correctly handle end effects in feature extraction, and is not a mechanism to determine how many frames are in the decodable object (as it used to be, and for backward compatibility, still is, in the Decodable interface).

Implements OnlineFeatureInterface.

Definition at line 1211 of file pitch-functions.cc.

References OnlinePitchFeature::impl_, and OnlinePitchFeatureImpl::IsLastFrame().

1211  {
1212  return impl_->IsLastFrame(frame);
1213 }
OnlinePitchFeatureImpl * impl_
bool IsLastFrame(int32 frame) const

◆ NumFramesReady()

int32 NumFramesReady ( ) const
virtual

returns the feature dimension.

Returns the total number of frames, since the start of the utterance, that are now available. In an online-decoding context, this will likely increase with time as more data becomes available.

Implements OnlineFeatureInterface.

Definition at line 1204 of file pitch-functions.cc.

Referenced by kaldi::ComputeKaldiPitch(), kaldi::ComputeKaldiPitchFirstPass(), and kaldi::UnitTestPieces().

1204  {
1205  return impl_->NumFramesReady();
1206 }
OnlinePitchFeatureImpl * impl_

Member Data Documentation

◆ impl_


The documentation for this class was generated from the following files: