AcmNotPossible调用acmStreamOpen,naudio [英] AcmNotPossible calling acmStreamOpen, naudio

查看:327
本文介绍了AcmNotPossible调用acmStreamOpen,naudio的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试转换

PCM S16 LE (araw)
Mono, Sample rate 22050, Bit pr. sample 16 

PCM mulaw (PCM MU-LAW)
Mono, Sample rate 8000hz, Bit pr. sample is 8. 

WaveFormat.CreateMuLawFormat(8000,1)或什至更通用的WaveFormat.CreateCustomFormat,其中我已指定与源流相同的WaveFormatEncoding引发相同的异常.

WaveFormat.CreateMuLawFormat(8000,1) or even a more generic WaveFormat.CreateCustomFormat where I have specified the same WaveFormatEncoding as the source stream is throwing the same exception.

AcmNotPossible calling acmStreamOpen

我在这里想念东西吗?

任何线索都将不胜感激.

Any leads will be greatly appreciated.

推荐答案

ACM mu-law编码器期望其输入为16位.如果您使用mu或a-law,则采样率也可能很低.以下两行代码将创建一个零长度的PCM 16位流,并将其传递到WaveFormatConversionStream中,以将其转换为a-law.除非由于某些原因您没有在计算机上安装G.711编码器,否则它不应引发无法进行转换"错误.

The ACM mu-law encoder expects its input to be 16 bit. If you're working with mu or a-law, the sample rate is likely to be low as well. The following two lines of code will create a zero-length stream of PCM 16 bit and pass it into a WaveFormatConversionStream to convert it to a-law. It should not throw a "conversion not possible" error unless for some reason you don't have the G.711 encoder installed on your machine.

var s = new RawSourceWaveStream(new MemoryStream(), new WaveFormat(8000,16,1));
var c = new WaveFormatConversionStream(WaveFormat.CreateALawFormat(8000,1), s);

这篇关于AcmNotPossible调用acmStreamOpen,naudio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆