def convertFsDirWavToWav(dirName, Fs, nC):

	types = (dirName+os.sep+'*.wav',) # the tuple of file types
	filesToProcess = []

	for files in types:
		filesToProcess.extend(glob.glob(files))		

	newDir = dirName + os.sep + "Fs" + str(Fs) + "_" + "NC"+str(nC)
	if os.path.exists(newDir) and newDir!=".":
		shutil.rmtree(newDir)	
	os.makedirs(newDir)	

	for f in filesToProcess:	
		_, wavFileName = ntpath.split(f)	
		command = "avconv -i \"" + f + "\" -ar " +str(Fs) + " -ac " + str(nC) + " \"" + newDir + os.sep + wavFileName + "\"";
		print command
		os.system(command)
This function converts the WAV files stored in a folder to WAV using a different sampling freq and number of channels.
dataset/ETHPy150Open tyiannak/pyAudioAnalysis/audioBasicIO.py/convertFsDirWavToWav