/// <summary> /// 时域分析 /// </summary> /// <param name="testData">测试波形</param> /// <param name="peakToPeak">峰峰值</param> /// <param name="rms">有效电平</param> /// <param name="dc">直流信号</param> /// <param name="rmsOfAc">AC的有效电平</param> /// <param name="max">最大值</param> /// <param name="min">最小值</param> public static void TimeDomainEstimate(double[] testData, out double peakToPeak, out double rms, out double dc, out double rmsOfAc, out double max, out double min) { TimeDomainEstimator estimator = new TimeDomainEstimator(); estimator.Estimate(testData, (uint)testData.Length); peakToPeak = estimator.GetPeakToPeak(); rms = estimator.GetRMS(); dc = estimator.GetDcPart(); rmsOfAc = estimator.GetAcPart(); max = estimator.GetMax(); min = estimator.GetMin(); }
/// <summary> /// 分析波形 /// </summary> /// <param name="testData">测试波形</param> /// <param name="sampleDelay">测试数据前面的无效数据长度</param> /// <param name="dataSize">有效测试波形长度</param> public override void Analyze(double[] testData, uint sampleDelay = 0, uint dataSize = 0) { double[] validTestData = GetValidTestData(testData, ref dataSize, sampleDelay); try { analyzer.Estimate(validTestData, dataSize); DataSize = dataSize; IsAnalyzed = true; } catch (Exception ex) { throw new SeeSharpAudioException(SeeSharpAudioErrorCode.RuntimeError, i18n.GetFStr("Runtime.RuntimeError", ex.Message), ex); } }