Пример #1
0
        public void ShowResult()
        {
            ArrayPair <double, double> responses = _analyzer.GetResponse();

            easyChart_response.Plot(responses.XData, responses.YData);
            ArrayPair <double, double> thds = _analyzer.GetTHD();

            easyChart_thd.Plot(thds.XData, thds.YData);
        }
Пример #2
0
//        public static void AnalyzeMultiToneWave(double[] testWave)
//        {
//
//        }
        /// <summary>
        /// 分析LogChirp波形
        /// </summary>
        /// <param name="testData">测试波形</param>
        /// <param name="refWaveform">参考波形</param>
        /// <param name="sampleRate">采样率</param>
        /// <param name="responseX">频响的频率值</param>
        /// <param name="responseY">频响的功率值</param>
        /// <param name="thdX">谐波失真的频率值</param>
        /// <param name="thdY">谐波失真的值</param>
        public static void AnalyzeLogChripWave(double[] testData, Waveform.LogChirpWaveform refWaveform, double sampleRate,
                                               out double[] responseX, out double[] responseY, out double[] thdX, out double[] thdY)
        {
            LogChirpAnalyzer analyzer = new LogChirpAnalyzer();

            ManagedAudioLibrary.LogChirpWaveform rawWaveform =
                refWaveform.GetRawWaveform() as ManagedAudioLibrary.LogChirpWaveform;
            analyzer.SetDataDelayCounts(AnalyzePathDelay(testData, refWaveform.GetWaveData()));
            analyzer.SetDataSampleRate(sampleRate);
            analyzer.SetReferenceWaveform(rawWaveform);
            analyzer.Analyze(testData, (uint)testData.Length);
            responseX = new double[analyzer.GetLengthOfResponse()];
            responseY = new double[analyzer.GetLengthOfResponse()];
            thdX      = new double[analyzer.GetLengthOfThd()];
            thdY      = new double[analyzer.GetLengthOfThd()];
            analyzer.GetThd(thdX, thdY);
            analyzer.GetResponse(responseX, responseY);
        }