Created
August 28, 2019 08:31
-
-
Save zjn0505/97b0cd9cc0564435b15c0b7ff3bd1aee to your computer and use it in GitHub Desktop.
Convert PCM to WAV.
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
| import sys | |
| import wave | |
| for arg in sys.argv[1:]: | |
| with open(arg, 'rb') as pcmfile: | |
| pcmdata = pcmfile.read() | |
| wavfile = wave.open(arg+'.wav', 'wb') | |
| # nchannels, sampwidth, framerate, nframes, comptype, compname | |
| wavfile.setparams((1, 2, 16000, 0, 'NONE', 'NONE')) | |
| wavfile.writeframes(pcmdata) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment