簡體   English   中英

NAdio ImaAdpcm輸入重新采樣AcmNotPossible錯誤

[英]NAdio ImaAdpcm input re sampling AcmNotPossible error

我正在嘗試將音頻流編碼為IMA ADPCM,這是我的代碼。

public Byte[] EncodeDVI(Byte[] source)
        {
            var resampleStream = new AcmStream(new WaveFormat(11025, 16, 1), new ImaAdpcmWaveFormat(11025, 16, 1));
            Buffer.BlockCopy(source, 0, resampleStream.SourceBuffer, 0, source.Length);

            int sourceBytesConverted = 0;
            var convertedBytes = resampleStream.Convert(source.Length, out sourceBytesConverted);
            if (sourceBytesConverted != source.Length)
            {
                Console.WriteLine("We didn't convert everything {0} bytes in, {1} bytes converted");
            }

            var converted = new byte[convertedBytes];
            Buffer.BlockCopy(resampleStream.DestBuffer, 0, converted, 0, convertedBytes);

            return converted;
        }

每次我運行代碼時,都會收到此錯誤“ NAudio.MmException:'AcmNotPossible調用acmStreamOpen'”

ACM編解碼器只能執行有限數量的轉換。 您可以使用NAudio演示應用程序來更詳細地研究系統上安裝了哪些ACM編解碼器以及它們之間可以轉換的內容。

我懷疑在這種情況下,可能不支持您的采樣率。 我已經寫了格式轉換的更詳細的指南在這里 ,這也解釋了,有時候你需要使你的轉換在幾個階段。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM