Dialogic ADPCM VOX file di 6000 Hertz Wave GSM in Alvas.Audio
Domanda
Come convertire file di Dialogic ADPCM VOX 6000 campioni al secondo Wave GSM in Alvas.Audio ?
Soluzione
Si prega di consultare esempio e codice seguente
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();
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow