Huawei .V3 Extention audio Play

 

相關dll下載 連接測試

 
 
using System;using System.IO;using System.Threading;using Alvas.Audio;using NAudio.Wave;namespace Test{    internal class Program    {        public static void Main(string[] args)        {                        //測試            playV3File(@"D:\1404033.v3");        }        public static void playV3File(string voxFile)        {            //設置採樣率            var samplesPerSec = 6000;            //將文件寫入臨時文件夾            var wavFile = Path.GetTempPath() + @"\"+Path.GetFileName(voxFile)+".tmp";            using (var br = new BinaryReader(File.OpenRead(voxFile)))            {                var format = AudioCompressionManager.GetPcmFormat(1, 16, samplesPerSec);                using (var ww = new WaveWriter(File.Create(wavFile), AudioCompressionManager.FormatBytes(format)))                {                    Vox.Vox2Wav(br, ww);                }            }            var audiodata = File.ReadAllBytes(wavFile);            File.Delete(wavFile);            using (var Stream = new MemoryStream(audiodata))            {                using (var wavFileReader = new WaveFileReader(Stream))                {                    using (var outputDevice = new WaveOutEvent())                    {                        outputDevice.Init(wavFileReader);                        outputDevice.Play();                        while (outputDevice.PlaybackState == PlaybackState.Playing) Thread.Sleep(100);                    }                }            }        }    }}
相關文章
相關標籤/搜索