I'm trying to convert u-law audio into 16 bit 8khz raw audio in python using audioop.ulaw2lin(ulaw_audio_bytes, 2)
.
The resulting bytes object has the right size, however if I write it to a wave file as 16 bit 8khz raw audio, the result is double speed with medium to low frequency noise and quite low overall volume.
The same audio processed by ulaw2lin with width 1 and saved to as a 8bit 8khz wav file sounds ok (modulo the limitations of the representation and the need to convert to unsigned ints needed by 8bit wav).
What am I missing? In principle I should achieve better quality audio with a 16bit representation.
EDIT: this was being done with in PyVoip.. see my answer below for explanation.