zoukankan      html  css  js  c++  java
  • 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);
    }
    }
    }
    }
    }
    }
     
  • 相关阅读:
    asp.net 启动关闭iis
    vue 界面关闭触发事件 ---实例销毁之前调用
    ElmentUI 设置禁止点击遮罩关闭 el-dialog 弹窗
    C#反射
    SQL Server 创建游标(cursor)
    文件解压缩
    文件流操作
    Linq查询
    C#线程 多线程 进程
    匿名类型和反射
  • 原文地址:https://www.cnblogs.com/czytcn/p/8306814.html
Copyright © 2011-2022 走看看