Created
June 22, 2016 19:02
-
-
Save vrunoa/9bd0fc157a8209d1e01e848515b1a00a to your computer and use it in GitHub Desktop.
Converting android m4a to wav in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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