import os import sys from pydub import AudioSegment if len(sys.argv) < 2: exit(1) m4afn = sys.argv[1] wavfn = m4afn[:-3] + 'wav' # Load the m4a file audio = AudioSegment.from_file(m4afn, format="m4a") # Export the audio as a wav file audio.export(wavfn, format="wav")