문제

How to convert Dialogic ADPCM VOX file 6000 samples per second to Wave GSM in Alvas.Audio?

도움이 되었습니까?

해결책

Please see example and code below

private static void Vox2Gsm(string voxFile, string wavFile)
{
    int samplesPerSec = 6000;
    IntPtr format = AudioCompressionManager.GetPcmFormat(1, 16, samplesPerSec);
    MemoryStream ms = new MemoryStream();
    BinaryReader br = new BinaryReader(File.OpenRead(voxFile));
    WaveWriter ww = new WaveWriter(ms, AudioCompressionManager.FormatBytes(format));
    Vox.Vox2Wav(br, ww);
    br.Close();
    WaveReader wr = new WaveReader(ms);
    byte[] data = wr.ReadData();
    wr.Close();
    ww.Close();
    IntPtr formatGsm = AudioCompressionManager.GetCompatibleFormat(format, AudioCompressionManager.Gsm610FormatTag);
    byte[] dataGsm = AudioCompressionManager.Convert(format, formatGsm, data, false);
    WaveWriter wwGsm = new WaveWriter(File.Create(wavFile), AudioCompressionManager.FormatBytes(formatGsm));
    wwGsm.WriteData(dataGsm);
    wwGsm.Close();
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top