0

I download mp3 from url(e.g. http://xxxx.mp3) using response = urllib2.urlopen(url) html = response.read(). How can I convert it into wav and also save the data in memory in variable without saving it to local files and read it out again?

Weiming
  • 37
  • 6
  • Have you tried one of these? https://stackoverflow.com/questions/3049572/how-to-convert-mp3-to-wav-in-python – fikr4n May 26 '16 at 00:46
  • I am using google app engine managed vm to decode mp3, which can be said as an external server. so the time is not an issue. – Weiming May 26 '16 at 05:32

1 Answers1

0

This seems a bit late. Anyway, You can solve that by :

  1. call the mp3 file by AudioSegment function.
  2. convert the mp3 file to wav form and save it in a variable.

see the code:-

from pydub import AudioSegment
sound = AudioSegment.from_mp3(mp3_form) # 1
wav_form = sound.export(format="wav")   # 2