各位大神好,c# 新手,这个是语音识别代码,基于微软 XBOX 的,不知道这个波束形成和置信度式子含义,求助!!!!
1、这个是置信度模块,具体式子这种到底什么原理???vs2010中的代码private void AudioSourceSoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
{
const double MinGradientWidth = 0.04;
double halfWidth = Math.Max((1 - e.ConfidenceLevel), MinGradientWidth) / 2;
this.sourceGsPre.Offset = Math.Max(this.sourceGsMain.Offset - halfWidth, 0);
this.sourceGsPost.Offset = Math.Min(this.sourceGsMain.Offset + halfWidth, 1);
sourceRotation.Angle = -e.Angle;
sourceAngleText.Text = string.Format(CultureInfo.CurrentCulture, Properties.Resources.SourceAngle, e.Angle.ToString("0", CultureInfo.CurrentCulture));
sourceConfidenceText.Text = string.Format(CultureInfo.CurrentCulture, Properties.Resources.SourceConfidence, e.ConfidenceLevel.ToString("0.00", CultureInfo.CurrentCulture));
}
这个是读线程模块,里头式子含义,急求!!!!新手。大神求帮忙
private void AudioReadingThread()
{
const double EnergyNoiseFloor = 0.2;
while (this.reading)
{
int readCount = audioStream.Read(audioBuffer, 0, audioBuffer.Length);
lock (this.energyLock)
{
for (int i = 0; i < readCount; i += 2)
{
short audioSample = BitConverter.ToInt16(audioBuffer, i);
this.accumulatedSquareSum += audioSample * audioSample;
++this.accumulatedSampleCount;
if (this.accumulatedSampleCount < SamplesPerColumn)
{
continue;
double meanSquare = this.accumulatedSquareSum / SamplesPerColumn;
double amplitude = Math.Log(meanSquare) / Math.Log(int.MaxValue);
this.energy[this.energyIndex] = Math.Max(0, amplitude - EnergyNoiseFloor) / (1 - EnergyNoiseFloor);
this.energyIndex = (this.energyIndex + 1) % this.energy.Length;
this.accumulatedSquareSum = 0;
this.accumulatedSampleCount = 0;
++this.newEnergyAvailable;
}
}
}
}