Photon Voice v2.53

Public Member Functions | Protected Attributes | Properties | List of all members
AudioUtil.VoiceDetectorCalibration< T > Class Template Reference

Calibration Utility for Voice Detector More...

Inherits IProcessor< T >.

Public Member Functions

 VoiceDetectorCalibration (IVoiceDetector voiceDetector, ILevelMeter levelMeter, int samplingRate, int channels)
 Create new VoiceDetectorCalibration instance. More...
 
void Calibrate (int durationMs, Action< float > onCalibrated=null)
 Start calibration. More...
 
T[] Process (T[] buf)
 Process a frame of data. More...
 
void Dispose ()
 

Protected Attributes

int calibrateCount
 

Properties

bool IsCalibrating [get]
 

Detailed Description

Calibration Utility for Voice Detector

. Using this audio processor, you can calibrate the IVoiceDetector.Threshold.

Constructor & Destructor Documentation

◆ VoiceDetectorCalibration()

VoiceDetectorCalibration ( IVoiceDetector  voiceDetector,
ILevelMeter  levelMeter,
int  samplingRate,
int  channels 
)

Create new VoiceDetectorCalibration instance.

Parameters
voiceDetectorVoice Detector to calibrate.
levelMeterLevel Meter to look at for calibration.
samplingRateSampling rate of the audio signal (in Hz).
channelsNumber of channels in the audio signal.

Member Function Documentation

◆ Calibrate()

void Calibrate ( int  durationMs,
Action< float >  onCalibrated = null 
)

Start calibration.

Parameters
durationMsDuration of the calibration procedure (in milliseconds).
onCalibratedOptional callback that is called after calibration is complete.

This activates the Calibration process. It will reset the given LevelMeter's AccumAvgPeakAmp (accumulated average peak amplitude), and when the duration has passed, use it for the VoiceDetector's detection threshold.

◆ Process()

T [] Process ( T[]  buf)

Process a frame of data.

Parameters
bufBuffer containing input data
Returns
Buffer containing output data or null if frame has been discarded (VAD)

Implements IProcessor< T >.