Hi, Brian it's me again. I tried to use the Dynamic range compression to deform some audio signal and met some error, could you help me figure it out? Thanks!
def augment_features(parent_dir,sub_dirs,file_ext="*.wav"):
for l, sub_dir in enumerate(sub_dirs):
for fn in glob.glob(os.path.join(parent_dir, sub_dir, file_ext)):
name = fn.split('/')[2].split('.')[0]
jam = jams.load('audio/7061-6-0-0_bgnoise0.jams')
muda.load_jam_audio(jam, fn)
#pitch shift1
pitch1 = muda.deformers.LinearPitchShift(n_samples=4,lower=-2,upper=2)
for i, jam_out in enumerate(pitch1.transform(jam)):
muda.save('audio1/test/'+name+'_p1_{:02d}.wav'.format(i),'audio1/test/'+name+'_p1_{:02d}.jams'.format(i), jam_out)
#pitch shift2
pitch2 = muda.deformers.LinearPitchShift(n_samples=4,lower=-4,upper=4)
for i, jam_out in enumerate(pitch2.transform(jam)):
muda.save('audio1/test/'+name+'_p2_{:02d}.wav'.format(i),'audio1/test/'+name+'_p2_{:02d}.jams'.format(i), jam_out)
#time stetching
tstretch = muda.deformers.LogspaceTimeStretch(n_samples=4,lower=-3.5,upper=3.5)
for i, jam_out in enumerate(tstretch.transform(jam)):
muda.save('audio1/test/'+name+'_ts_{:02d}.wav'.format(i),'audio1/test/'+name+'_ts_{:02d}.jams'.format(i), jam_out)
#DRC
drc = muda.deformers.DynamicRangeCompression(preset=['radio','film standard', 'speech', 'radio'])
for i, jam_out in enumerate(drc.transform(jam)):
muda.save('audio1/test/'+name+'_drc_{:02d}.wav'.format(0),'audio1/test/'+name+'_drc_{:02d}.jams'.format(0), jam_out)
parent_dir = "audio1"
for k in range(1,11):
fold_name = 'fold' + str(k)
augment_features(parent_dir,[fold_name])
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-16-9541ffff5e33> in <module>()
36 for k in range(1,11):
37 fold_name = 'fold' + str(k)
---> 38 augment_features(parent_dir,[fold_name])
<ipython-input-16-9541ffff5e33> in augment_features(parent_dir, sub_dirs, file_ext)
25 #DRC
26 drc = muda.deformers.DynamicRangeCompression(preset=['radio','film standard', 'speech', 'radio'])
---> 27 for i, jam_out in enumerate(drc.transform(jam)):
28 muda.save('audio1/test/'+name+'_drc_{:02d}.wav'.format(0),'audio1/test/'+name+'_drc_{:02d}.jams'.format(0), jam_out)
29 #for i, jam_out in enumerate(drc.transform(jam)):
/home/uri7910/anaconda2/envs/tensorflow011/lib/python2.7/site-packages/muda-0.1.2-py2.7.egg/muda/base.pyc in transform(self, jam)
142
143 for state in self.states(jam):
--> 144 yield self._transform(jam, state)
145
146 @property
/home/uri7910/anaconda2/envs/tensorflow011/lib/python2.7/site-packages/muda-0.1.2-py2.7.egg/muda/base.pyc in _transform(self, jam, state)
110
111 if hasattr(self, 'audio'):
--> 112 self.audio(jam_w.sandbox.muda, state)
113
114 if hasattr(self, 'metadata'):
/home/uri7910/anaconda2/envs/tensorflow011/lib/python2.7/site-packages/muda-0.1.2-py2.7.egg/muda/deformers/sox.pyc in audio(mudabox, state)
146 mudabox._audio['y'] = drc(mudabox._audio['y'],
147 mudabox._audio['sr'],
--> 148 state['preset'])
/home/uri7910/anaconda2/envs/tensorflow011/lib/python2.7/site-packages/muda-0.1.2-py2.7.egg/muda/deformers/sox.pyc in drc(y, sr, preset)
91 '''
92
---> 93 return __sox(y, sr, 'compand', *PRESETS[preset])
94
95
/home/uri7910/anaconda2/envs/tensorflow011/lib/python2.7/site-packages/muda-0.1.2-py2.7.egg/muda/deformers/sox.pyc in __sox(y, sr, *args)
57 arguments.extend(args)
58
---> 59 subprocess.check_call(arguments)
60
61 y_out, sr = psf.read(outfile)
/home/uri7910/anaconda2/envs/tensorflow011/lib/python2.7/subprocess.pyc in check_call(*popenargs, **kwargs)
534 check_call(["ls", "-l"])
535 """
--> 536 retcode = call(*popenargs, **kwargs)
537 if retcode:
538 cmd = kwargs.get("args")
/home/uri7910/anaconda2/envs/tensorflow011/lib/python2.7/subprocess.pyc in call(*popenargs, **kwargs)
521 retcode = call(["ls", "-l"])
522 """
--> 523 return Popen(*popenargs, **kwargs).wait()
524
525
/home/uri7910/anaconda2/envs/tensorflow011/lib/python2.7/subprocess.pyc in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags)
709 p2cread, p2cwrite,
710 c2pread, c2pwrite,
--> 711 errread, errwrite)
712 except Exception:
713 # Preserve original exception in case os.close raises.
/home/uri7910/anaconda2/envs/tensorflow011/lib/python2.7/subprocess.pyc in _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, to_close, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite)
1341 raise
1342 child_exception = pickle.loads(data)
-> 1343 raise child_exception
1344
1345
OSError: [Errno 2] No such file or directory