1

I have the following frame format of my ADPCM data

The frame format of the ADPCM is

# 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

How can I decode this ADPCM signal into a audible .wav-format in Windows 7? I have tried getting a solution for python but now I will go for anything.

chwi
  • 286

1 Answers1

0

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)
chwi
  • 286