Skip to content

8. Other Functionalities

tyiannak edited this page Aug 10, 2016 · 4 revisions

Batch-convert Mp3 to Wav

Function convertDirMP3ToWav(dirName, Fs, nC, useMp3TagsAsName = False) converts all MP3 files of folder dirName to WAV files using the provided sampling rate (second argument) and number of channels (third argument). If the final argument (useMp3TagsAsName) is set to True then the output WAV files are named by the MP3-tags (artist and song title), otherwise the MP3 filename is used (with the .wav extension of course)

Command-line use example

python audioAnalysis.py dirMp3toWav -i MusicData/ -r 16000 -c 1

In addition, function convertFsDirWavToWav() can be used to convert a list of WAVs stored in a particular folder to a new list of the same signals at another sampling rate (WAV files again). Commnad-line example:

python audioAnalysis.py dirWavResample -i MusicData/ -r 8000 -c 1

The new files are stored under a new folder named Fs_Nc, e.g. Fs8000_NC1