Skip to content

Instantly share code, notes, and snippets.

@vrunoa
Created June 22, 2016 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vrunoa/9bd0fc157a8209d1e01e848515b1a00a to your computer and use it in GitHub Desktop.
Save vrunoa/9bd0fc157a8209d1e01e848515b1a00a to your computer and use it in GitHub Desktop.
Converting android m4a to wav in python
for i, m4a_buffer in enumerate(m4a_buffers):
f = tempfile.NamedTemporaryFile(dir=voice_datadir, suffix="."+input_audio_extension, prefix="%s_%d"%(username,i), delete=True)
f.write(m4a_buffers[i])
f.seek(0, os.SEEK_END)
chunk = AudioSegment.from_file(f.name, "mp4")
chunk.export("%s_%d.wav"%(username,i), format="wav")
Copy link

ghost commented Jul 23, 2018

Thank you for sharing this code,
Can you please help me understand what do you mean with "m4a_buffers"
Are you creating a list of frames by parsing the m4a file based on it's sample rate? if that's the case, how do you do that ? if not , can you help me implement that code ?
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment