Foobar
Foobar

Reputation: 927

Convert wav to mulaw in Python

I'm opening a wav file and attempting to convert it into mulaw unsuccessfully. The mulaw is then sent to Twilio to play. The code is as follows:

 with wave.open('audio/test.wav', 'rb') as wav:
    raw_wav= wav.readframes(wav.getnframes())
    raw_ulaw = audioop.lin2ulaw(raw_wav, wav.getsampwidth())

The conversion does happen but the resulting mulaw is just static sound, no speech. Any help would be appreciated. Thanks.

Upvotes: 0

Views: 230

Answers (0)

Related Questions