Ejemplo n.º 1
0
        /// <summary>
        /// 从Wav文件读取波形数据
        /// </summary>
        /// <param name="path">文件路径</param>
        /// <param name="channelCount">通道个数</param>
        /// <returns>波形数据</returns>
        public static double[] FromWavFile(string path, out int channelCount)
        {
            WavReader reader = new WavReader();

            reader.ReadFile(path);
            double[] waveData = new double[reader.GetTotalPoints()];
            reader.GetCopyOfData(waveData);
            channelCount = reader.GetChannelCounts();
            return(waveData);
        }