I don't want to use any other apps (like sox) - I want to do this in pure Python. Installing needed Python libs is fine.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- Can we recover audio from MFCC coefficients?
- How to get the background from multiple images by
- Evil ctypes hack in python
If the WAV file is PCM-encoded then you can use
wave
. Open the source and destination files, read samples, average the channels, and write them out.I maintain an open source library, pydub, which make this pretty simple
One caveat: it uses ffmpeg to handle audio format conversions, but if you only use wav it can be pure python.