public void Analyze() { IMDType imdType = (IMDType)Enum.Parse(typeof(IMDType), comboBox_imdType.Text); // double frequency1, frequency2, amplitudeRatio, imd; // SeeSharpTools.JY.Audio.AudioAnalyzer.AnalyzeDualToneWave(readWaveform, sampleRate, imdType, out frequency1, out frequency2, out amplitudeRatio, out imd); _analyzer.SetAnalyzeParam(_globalInfo.AITask.GetSampleRate(), imdType); _analyzer.Analyze(_testData, _globalInfo.DelaySamples, _analyzeSize); }
/// <summary> /// 分析双音色波形 /// </summary> /// <param name="testData">测试波形</param> /// <param name="sampleRate">采样率</param> /// <param name="imdType">IMD类型</param> /// <param name="frequency1">第一频率</param> /// <param name="frequency2">第二频率</param> /// <param name="amplitudeRatio">幅度比</param> /// <param name="IMDInDb">IMD数值(dB)</param> public static void AnalyzeDualToneWave(double[] testData, double sampleRate, IMDType imdType, out double frequency1, out double frequency2, out double amplitudeRatio, out double IMDInDb) { DualToneAnalyzer analyzer = new DualToneAnalyzer(); analyzer.SetImdType((ImdType)imdType); analyzer.SetDataSampleRate(sampleRate); analyzer.Analyze(testData, (uint)testData.Length); frequency1 = analyzer.GetFrequency1(); frequency2 = analyzer.GetFrequency2(); amplitudeRatio = analyzer.GetAmplitudeRatioF1toF2(); IMDInDb = analyzer.GetIMD(); }