Mercurial > hg > env-test-daniele
view soxnorm.py @ 0:032bc65ebafc
added core components
author | George Fazekas <gyorgy.fazekas@eecs.qmul.ac.uk> |
---|---|
date | Wed, 06 Mar 2013 15:45:48 +0000 |
parents | |
children |
line wrap: on
line source
import dircache, subprocess, random from math import sin, cos, pi sourceDir = '.' def getFilesWav(): _dirlist = dircache.listdir(sourceDir) dirlist = [] for item in _dirlist: if item.split('.')[-1] == 'wav' and item.split('.')[0].split('_')[-1] != 'pad': dirlist.append(item) return dirlist def getFilesPad(): _dirlist = dircache.listdir(sourceDir + '/padded') dirlist = [] for item in _dirlist: if item.split('.')[-1] == 'wav' and item.split('.')[0].split('_')[-1] == 'pad': dirlist.append('./padded/%s'%item) return dirlist def soxNorm(infile): outfile = "%s%s" %("_", infile) com = "sox %s %s gain -n -6" %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() #-----------FX def mwChorus(infile): outfile = infile.split('.')[0] + '_chorus' + '.wav' com = 'MissWatson -plugin=aufx:bbMC:beBU -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def soxPad(infile): outfile = infile.split('.')[0] + '_pad' + '.wav' com = "sox %s %s pad 0 3" %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwDelay(infile): outfile = infile.split('.')[0] + '_echo' + '.wav' com = 'MissWatson -plugin=aufx:Pong:ExSl -parameter=0:0.2,1:40,2:-0.25,3:1,4:0.8,5:8000,6:0.01,7:0,8:0,9:0 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwDistortion(infile): outfile = infile.split('.')[0] + '_distortion' + '.wav' com = 'MissWatson -plugin=aufx:afs1:Aura -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwLoPass(infile): outfile = infile.split('.')[0] + '_lopass' + '.wav' com = 'MissWatson -plugin=aumf:FSim:FabF -parameter=1:0.5,5:2 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwHiPass(infile): outfile = infile.split('.')[0] + '_hipass' + '.wav' com = 'MissWatson -plugin=aumf:FSim:FabF -parameter=1:0.5,4:1,5:2 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwBandPass(infile): outfile = infile.split('.')[0] + '_bandpass' + '.wav' com = 'MissWatson -plugin=aumf:FSim:FabF -parameter=1:0.5,4:2,5:2 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwCompressor(infile): outfile = infile.split('.')[0] + '_compressor' + '.wav' com = 'MissWatson -plugin=aufx:dcmp:appl -parameter=0:-41,1:36,2:1,3:-120,4:0.03,5:0.03,6:0 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwComb(infile): outfile = infile.split('.')[0] + '_comb' + '.wav' com = 'MissWatson -plugin=aufx:CmFB:MNor -parameter=0:420,1:1,2:1,3:75,4:100,5:0 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwLeslie(infile): outfile = infile.split('.')[0] + '_leslie' + '.wav' com = 'MissWatson -plugin=aufx:mdaH:mdaX -parameter=0:2,1:50,2:60,3:70:4:60,5:70,6:450,7:0,8:50 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwRingMod(infile): outfile = infile.split('.')[0] + '_ringmod' + '.wav' com = 'MissWatson -plugin=aufx:mdaR:mdaX -parameter=0:1000,1:0,2:0 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwFuzz(infile): outfile = infile.split('.')[0] + '_fuzz' + '.wav' com = 'MissWatson -plugin=aufx:Pass:AuDa -parameter=0:0.4,1:14000,2:-5,3:1 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def soxGain(infile): outfile = infile.split('.')[0] + '_gain' + '.wav' com = "sox %s %s gain 5.8" %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwBitCrush(infile): outfile = infile.split('.')[0] + '_bitcrush' + '.wav' com = 'MissWatson -plugin=aufx:CRS1:Togu -parameter=1:0.25,2:0.5,3:0.5,4:1,5:0.5,6:0,7:0 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwMonoPhaser(infile): outfile = infile.split('.')[0] + '_monophaser' + '.wav' com = 'MissWatson -plugin=aufx:Phas:ExSl -parameter=0:0.85,1:0.75,2:0,3:1500,4:7000,5:10,6:0 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwStereoPhaser(infile): outfile = infile.split('.')[0] + '_stereophaser' + '.wav' com = 'MissWatson -plugin=aufx:Phas:ExSl -parameter=0:0.85,1:0.75,2:0,3:1500,4:7000,5:10,6:0.3 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def soxSpeedUp(infile): outfile = infile.split('.')[0] + '_speedup' + '.wav' com = "sox %s %s speed 1.2" %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def soxSpeedDown(infile): outfile = infile.split('.')[0] + '_speeddown' + '.wav' com = "sox %s %s speed 0.8" %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwDoppler(infile): outfile = infile.split('.')[0] + '_doppler' + '.wav' com = 'sox %s -n stat' %infile #print com #proc = subprocess.Popen(com,shell= True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) #proc.wait() #output = proc.stdout.read() #output = output.split('):') #output = output[1].split('Scaled') length = 600 #float(output[0]) * 100 print length com = 'MissWatson -plugin=aufx:DPAS:ksWV -parameter=5:%f -input-file=%s -output-file=%s' %(length, infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def soxTremolo(infile): outfile = infile.split('.')[0] + '_tremolo' + '.wav' com = "sox %s %s tremolo 6 75" %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwVibrato(infile): outfile = infile.split('.')[0] + '_vibrato' + '.wav' com = 'MissWatson -plugin=aumf:MAe8:Meld -parameter=0:0.15,1:0.78,3:0.12 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def soxPan(infile): _p = random.random() * 0.7 + 0.2 p = pi * (_p + 2) / 4 i = random.choice([-1, 1]) l = i * (cos(p) + sin(p)) r = i * (cos(p) - sin(p)) print [l, r] outfile = infile.split('.')[0] + '_pan' + '.wav' com = "sox %s %s remix 1v%f 2v%f" %(infile, outfile, l, r) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwReverb(infile): outfile = infile.split('_pad.')[0] + '_reverb' + '.wav' com = 'MissWatson -plugin=aufx:JzR3:DreP -parameter=0:0,1:0.86,2:20,3:75,4:1,5:1 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mlabRobot(infile): outfile = infile.split('.')[0] + '_robot' + '.wav' com = '''matlab -nodesktop -nosplash - nojvm -r "robotization('%s','%s')"'''%(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mlabWhisper(infile): outfile = infile.split('.')[0] + '_whisper' + '.wav' com = '''matlab -nodesktop -nosplash - nojvm -r "whisperization('%s','%s')"'''%(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwEnhancer(infile): outfile = infile.split('.')[0] + '_enhancer' + '.wav' com = 'MissWatson -plugin=aufx:SPVT:SPL1 -parameter=2:0.75,3:0.75,4:0.5,5:0.6,6:0.75,7:0.75,8:0.7,9:0,10:0.5 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwFlanger(infile): outfile = infile.split('.')[0] + '_flanger' + '.wav' com = 'MissWatson -plugin=aufx:Flan:Togu -parameter=1:0.5,2:0,3:0.75,4:0.6,5:0,6:0.75,7:1,8:0.55 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwGraindelay(infile): outfile = infile.split('_pad.')[0] + '_graindelay' + '.wav' com = 'MissWatson -plugin=aumf:+bub:SDHKu -parameter=0:233,1:48,2:85,3:18,4:50,6:0,7:0,8:0,10:20000,11:0,12:70 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() def mwPitchUp(infile): outfile = infile.split('.')[0] + '_pitchup' + '.wav' com = 'MissWatson -plugin=aufx:shft:Awsh -parameter=0:300,1:0,2:0,3:3,4:8 -input-file=%s -output-file=%s' %(infile, outfile) print com proc = subprocess.Popen(com,shell= True) proc.wait() #def mwPitchDown(infile): # outfile = infile.split('.')[0] + '_pitchdown' + '.wav' # com = 'MissWatson -plugin=aufx:shft:Awsh -parameter=0:-300,1:0,2:0,3:3,4:8 -input-file=%s -output-file=%s' %(infile, outfile) # print com # proc = subprocess.Popen(com,shell= True) # proc.wait() wav_files = getFilesWav() #wav_files = getFilesPad() print wav_files for item in wav_files: #print item #soxNorm(item) #mwChorus(item) #soxPad(item) #mwDelay(item) #mwDistortion(item) #mwLoPass(item) #mwHiPass(item) #mwBandPass(item) #mwCompressor(item) #mwComb(item) #mwLeslie(item) #mwRingMod(item) #mwFuzz(item) #soxGain(item) #mwBitCrush(item) #mwMonoPhaser(item) #mwStereoPhaser(item) #soxSpeedUp(item) #soxSpeedDown(item) #mwDoppler(item) #soxTremolo(item) #mwVibrato(item) #soxPan(item) #mwReverb(item) #mlabRobot(item) #mlabWhisper(item) #mwEnhancer(item) #mwFlanger(item) #mwGraindelay(item) mwPitchUp(item) ##mwPitchDown(item)