Как конвертировать ADPCM в WAV в Windows?

1541
chwi

У меня есть следующий формат кадра моих данных ADPCM

Формат кадра ADPCM

# byte | Contents ---------------------------------------------------------- 0 | Encoder state: LSByte of 1st PCM value in frame 1 | Encoder state: MSByte of 1st PCM value in frame 2 | Encoder state: ADPSM step table index 3 - 258 | ADPCM encoded 16 bit PCM values 

Как я могу декодировать этот сигнал ADPCM в звуковой WAV-формат в Windows 7? Я попытался получить решение для Python, но теперь я пойду на все.

0

1 ответ на вопрос

0
chwi

With python:

import wave import sys import audioop import binascii # Get the fragments of ADPCM data: # Here, blocks is an array of 259byte data represented as strings which is parsed # from the ADPCM data file, write this according to the structure of your ADPCM file block = getAdpcmFragments(adpcm_file_path) #Set parameters for the wavefile according to your audio stream wave_file = wave.open(wave_file_path, 'wb') wave_file.setparams((2,2,16000, 0, 'NONE', 'NONE')) # Using ASCII to Binary from the binascii lib to convert strings represented as e.g # 4A, 6F etc into actual binary values. Then I am writing the linear PCM data from # adpcm2lin to the wav-file. state = None for this in block: pcm, state = audioop.adpcm2lin(binascii.a2b_hex(this), 4, state) wave_file.writeframes(pcm) 
что такое функция - getAdpcmFragments (имя файла)? Определяемые пользователем? Satarupa Guha 6 лет назад 0