Audacity 3.2.0
|
This implements a voice key, detecting either the next "ON" or "OFF" point. More...
#include <VoiceKey.h>
Public Member Functions | |
VoiceKey () | |
~VoiceKey () | |
sampleCount | OnForward (const WaveChannel &t, sampleCount start, sampleCount len) |
sampleCount | OnBackward (const WaveChannel &t, sampleCount start, sampleCount len) |
sampleCount | OffForward (const WaveChannel &t, sampleCount start, sampleCount len) |
sampleCount | OffBackward (const WaveChannel &t, sampleCount start, sampleCount len) |
void | CalibrateNoise (const WaveChannel &t, sampleCount start, sampleCount len) |
void | AdjustThreshold (double t) |
bool | AboveThreshold (const WaveChannel &t, sampleCount start, sampleCount len) |
void | SetKeyType (bool erg, bool scLow, bool scHigh, bool dcLow, bool dcHigh) |
Private Member Functions | |
double | TestEnergy (const WaveChannel &t, sampleCount start, sampleCount len) |
double | TestSignChanges (const WaveChannel &t, sampleCount start, sampleCount len) |
double | TestDirectionChanges (const WaveChannel &t, sampleCount start, sampleCount len) |
void | TestEnergyUpdate (double &prevErg, int length, const float &drop, const float &add) |
void | TestSignChangesUpdate (double ¤tsignchanges, int length, const float &a1, const float &a2, const float &z1, const float &z2) |
void | TestDirectionChangesUpdate (double ¤tdirectionchanges, int length, int &atrend, const float &a1, const float &a2, int &ztrend, const float &z1, const float &z2) |
Private Attributes | |
double | mWindowSize |
double | mThresholdAdjustment |
double | mEnergyMean |
double | mEnergySD |
double | mSignChangesMean |
double | mSignChangesSD |
double | mDirectionChangesMean |
double | mDirectionChangesSD |
double | mThresholdEnergy |
double | mThresholdSignChangesLower |
double | mThresholdSignChangesUpper |
double | mThresholdDirectionChangesLower |
double | mThresholdDirectionChangesUpper |
bool | mUseEnergy |
bool | mUseSignChangesLow |
bool | mUseSignChangesHigh |
bool | mUseDirectionChangesLow |
bool | mUseDirectionChangesHigh |
double | mSilentWindowSize |
double | mSignalWindowSize |
This implements a voice key, detecting either the next "ON" or "OFF" point.
Definition at line 33 of file VoiceKey.h.
VoiceKey::VoiceKey | ( | ) |
Definition at line 38 of file VoiceKey.cpp.
References AdjustThreshold(), mDirectionChangesMean, mDirectionChangesSD, mEnergyMean, mEnergySD, mSignalWindowSize, mSignChangesMean, mSignChangesSD, mSilentWindowSize, mUseDirectionChangesHigh, mUseDirectionChangesLow, mUseEnergy, mUseSignChangesHigh, mUseSignChangesLow, and mWindowSize.
VoiceKey::~VoiceKey | ( | ) |
Definition at line 66 of file VoiceKey.cpp.
bool VoiceKey::AboveThreshold | ( | const WaveChannel & | t, |
sampleCount | start, | ||
sampleCount | len | ||
) |
Definition at line 657 of file VoiceKey.cpp.
References mThresholdDirectionChangesLower, mThresholdDirectionChangesUpper, mThresholdEnergy, mThresholdSignChangesLower, mThresholdSignChangesUpper, mUseDirectionChangesHigh, mUseDirectionChangesLow, mUseEnergy, mUseSignChangesHigh, mUseSignChangesLow, TestDirectionChanges(), TestEnergy(), and TestSignChanges().
Referenced by OffBackward(), OffForward(), OnBackward(), and OnForward().
void VoiceKey::AdjustThreshold | ( | double | t | ) |
Definition at line 726 of file VoiceKey.cpp.
References mDirectionChangesMean, mDirectionChangesSD, mEnergyMean, mEnergySD, mSignChangesMean, mSignChangesSD, mThresholdAdjustment, mThresholdDirectionChangesLower, mThresholdDirectionChangesUpper, mThresholdEnergy, mThresholdSignChangesLower, and mThresholdSignChangesUpper.
Referenced by CalibrateNoise(), and VoiceKey().
void VoiceKey::CalibrateNoise | ( | const WaveChannel & | t, |
sampleCount | start, | ||
sampleCount | len | ||
) |
Definition at line 739 of file VoiceKey.cpp.
References AdjustThreshold(), WaveChannel::GetRate(), limitSampleBufferSize(), mDirectionChangesMean, mDirectionChangesSD, mEnergyMean, mEnergySD, mSignChangesMean, mSignChangesSD, mThresholdAdjustment, mWindowSize, staffpad::audio::simd::sqrt(), TestDirectionChanges(), TestEnergy(), TestSignChanges(), and XO().
sampleCount VoiceKey::OffBackward | ( | const WaveChannel & | t, |
sampleCount | start, | ||
sampleCount | len | ||
) |
Definition at line 518 of file VoiceKey.cpp.
References AboveThreshold(), AudacityMessageBox(), details::end(), WaveChannel::GetFloats(), WaveChannel::GetRate(), limitSampleBufferSize(), mSilentWindowSize, mThresholdDirectionChangesLower, mThresholdDirectionChangesUpper, mThresholdEnergy, mThresholdSignChangesLower, mThresholdSignChangesUpper, mUseDirectionChangesHigh, mUseDirectionChangesLow, mUseEnergy, mUseSignChangesHigh, mUseSignChangesLow, mWindowSize, sgn(), TestDirectionChanges(), TestDirectionChangesUpdate(), TestEnergy(), TestEnergyUpdate(), TestSignChanges(), TestSignChangesUpdate(), and XO().
sampleCount VoiceKey::OffForward | ( | const WaveChannel & | t, |
sampleCount | start, | ||
sampleCount | len | ||
) |
Definition at line 382 of file VoiceKey.cpp.
References AboveThreshold(), sampleCount::as_double(), AudacityMessageBox(), WaveChannel::GetFloats(), WaveChannel::GetRate(), limitSampleBufferSize(), mSilentWindowSize, mThresholdDirectionChangesLower, mThresholdDirectionChangesUpper, mThresholdEnergy, mThresholdSignChangesLower, mThresholdSignChangesUpper, mUseDirectionChangesHigh, mUseDirectionChangesLow, mUseEnergy, mUseSignChangesHigh, mUseSignChangesLow, mWindowSize, sgn(), TestDirectionChanges(), TestDirectionChangesUpdate(), TestEnergy(), TestEnergyUpdate(), TestSignChanges(), TestSignChangesUpdate(), and XO().
sampleCount VoiceKey::OnBackward | ( | const WaveChannel & | t, |
sampleCount | start, | ||
sampleCount | len | ||
) |
Definition at line 236 of file VoiceKey.cpp.
References AboveThreshold(), AudacityMessageBox(), details::end(), WaveChannel::GetFloats(), WaveChannel::GetRate(), limitSampleBufferSize(), mSilentWindowSize, mThresholdDirectionChangesLower, mThresholdDirectionChangesUpper, mThresholdEnergy, mThresholdSignChangesLower, mThresholdSignChangesUpper, mUseDirectionChangesHigh, mUseDirectionChangesLow, mUseEnergy, mUseSignChangesHigh, mUseSignChangesLow, mWindowSize, sgn(), TestDirectionChanges(), TestDirectionChangesUpdate(), TestEnergy(), TestEnergyUpdate(), TestSignChanges(), TestSignChangesUpdate(), and XO().
sampleCount VoiceKey::OnForward | ( | const WaveChannel & | t, |
sampleCount | start, | ||
sampleCount | len | ||
) |
Definition at line 84 of file VoiceKey.cpp.
References AboveThreshold(), AudacityMessageBox(), WaveChannel::GetFloats(), WaveChannel::GetRate(), limitSampleBufferSize(), mSignalWindowSize, mThresholdDirectionChangesLower, mThresholdDirectionChangesUpper, mThresholdEnergy, mThresholdSignChangesLower, mThresholdSignChangesUpper, mUseDirectionChangesHigh, mUseDirectionChangesLow, mUseEnergy, mUseSignChangesHigh, mUseSignChangesLow, mWindowSize, sgn(), TestDirectionChanges(), TestDirectionChangesUpdate(), TestEnergy(), TestEnergyUpdate(), TestSignChanges(), TestSignChangesUpdate(), and XO().
void VoiceKey::SetKeyType | ( | bool | erg, |
bool | scLow, | ||
bool | scHigh, | ||
bool | dcLow, | ||
bool | dcHigh | ||
) |
Definition at line 842 of file VoiceKey.cpp.
References mUseDirectionChangesHigh, mUseDirectionChangesLow, mUseEnergy, mUseSignChangesHigh, and mUseSignChangesLow.
|
private |
Definition at line 951 of file VoiceKey.cpp.
References sampleCount::as_double(), WaveChannel::GetBestBlockSize(), WaveChannel::GetFloats(), WaveChannel::GetMaxBlockSize(), limitSampleBufferSize(), and sgn().
Referenced by AboveThreshold(), CalibrateNoise(), OffBackward(), OffForward(), OnBackward(), and OnForward().
|
private |
Definition at line 1000 of file VoiceKey.cpp.
References sgn().
Referenced by OffBackward(), OffForward(), OnBackward(), and OnForward().
|
private |
Definition at line 854 of file VoiceKey.cpp.
References sampleCount::as_double(), WaveChannel::GetBestBlockSize(), WaveChannel::GetFloats(), WaveChannel::GetMaxBlockSize(), and limitSampleBufferSize().
Referenced by AboveThreshold(), CalibrateNoise(), OffBackward(), OffForward(), OnBackward(), and OnForward().
|
private |
Definition at line 887 of file VoiceKey.cpp.
References staffpad::vo::add().
Referenced by OffBackward(), OffForward(), OnBackward(), and OnForward().
|
private |
Definition at line 895 of file VoiceKey.cpp.
References sampleCount::as_double(), WaveChannel::GetBestBlockSize(), WaveChannel::GetFloats(), WaveChannel::GetMaxBlockSize(), limitSampleBufferSize(), and sgn().
Referenced by AboveThreshold(), CalibrateNoise(), OffBackward(), OffForward(), OnBackward(), and OnForward().
|
private |
Definition at line 938 of file VoiceKey.cpp.
References sgn().
Referenced by OffBackward(), OffForward(), OnBackward(), and OnForward().
|
private |
Definition at line 62 of file VoiceKey.h.
Referenced by AdjustThreshold(), CalibrateNoise(), and VoiceKey().
|
private |
Definition at line 63 of file VoiceKey.h.
Referenced by AdjustThreshold(), CalibrateNoise(), and VoiceKey().
|
private |
Definition at line 58 of file VoiceKey.h.
Referenced by AdjustThreshold(), CalibrateNoise(), and VoiceKey().
|
private |
Definition at line 59 of file VoiceKey.h.
Referenced by AdjustThreshold(), CalibrateNoise(), and VoiceKey().
|
private |
Definition at line 80 of file VoiceKey.h.
Referenced by OnForward(), and VoiceKey().
|
private |
Definition at line 60 of file VoiceKey.h.
Referenced by AdjustThreshold(), CalibrateNoise(), and VoiceKey().
|
private |
Definition at line 61 of file VoiceKey.h.
Referenced by AdjustThreshold(), CalibrateNoise(), and VoiceKey().
|
private |
Definition at line 79 of file VoiceKey.h.
Referenced by OffBackward(), OffForward(), OnBackward(), and VoiceKey().
|
private |
Definition at line 56 of file VoiceKey.h.
Referenced by AdjustThreshold(), and CalibrateNoise().
|
private |
Definition at line 68 of file VoiceKey.h.
Referenced by AboveThreshold(), AdjustThreshold(), OffBackward(), OffForward(), OnBackward(), and OnForward().
|
private |
Definition at line 69 of file VoiceKey.h.
Referenced by AboveThreshold(), AdjustThreshold(), OffBackward(), OffForward(), OnBackward(), and OnForward().
|
private |
Definition at line 65 of file VoiceKey.h.
Referenced by AboveThreshold(), AdjustThreshold(), OffBackward(), OffForward(), OnBackward(), and OnForward().
|
private |
Definition at line 66 of file VoiceKey.h.
Referenced by AboveThreshold(), AdjustThreshold(), OffBackward(), OffForward(), OnBackward(), and OnForward().
|
private |
Definition at line 67 of file VoiceKey.h.
Referenced by AboveThreshold(), AdjustThreshold(), OffBackward(), OffForward(), OnBackward(), and OnForward().
|
private |
Definition at line 76 of file VoiceKey.h.
Referenced by AboveThreshold(), OffBackward(), OffForward(), OnBackward(), OnForward(), SetKeyType(), and VoiceKey().
|
private |
Definition at line 75 of file VoiceKey.h.
Referenced by AboveThreshold(), OffBackward(), OffForward(), OnBackward(), OnForward(), SetKeyType(), and VoiceKey().
|
private |
Definition at line 72 of file VoiceKey.h.
Referenced by AboveThreshold(), OffBackward(), OffForward(), OnBackward(), OnForward(), SetKeyType(), and VoiceKey().
|
private |
Definition at line 74 of file VoiceKey.h.
Referenced by AboveThreshold(), OffBackward(), OffForward(), OnBackward(), OnForward(), SetKeyType(), and VoiceKey().
|
private |
Definition at line 73 of file VoiceKey.h.
Referenced by AboveThreshold(), OffBackward(), OffForward(), OnBackward(), OnForward(), SetKeyType(), and VoiceKey().
|
private |
Definition at line 54 of file VoiceKey.h.
Referenced by CalibrateNoise(), OffBackward(), OffForward(), OnBackward(), OnForward(), and VoiceKey().