Huawei .V3 Extention audio Play

Posted 虫子樱桃の博客

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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);
}
}
}
}
}
}
 

以上是关于Huawei .V3 Extention audio Play的主要内容,如果未能解决你的问题,请参考以下文章

yugabyte 安装pg extention

UIAlertController+Extention

tip of Firefox extention foxyproxy

CLR Debug extention

swift extention具有循环索引elemnt的数组

Widget Extention开发笔记