bmcfee / muda

A library for augmenting annotated audio data
ISC License
230 stars 33 forks source link

Pitch deformer breaks on unexpected namespace? #29

Closed justinsalamon closed 8 years ago

justinsalamon commented 8 years ago

I'm trying to use the LinearPitchShift deformer on a tag_open JAMS annotation. Code looks something like this:

audiopath = '101415-3-0-2.wav'
jamspath = '101415-3-0-2.jams'
jorig = muda.load_jam_audio(jamspath, audiopath)
pitch = muda.deformers.LinearPitchShift(n_samples=3, lower=-1, upper=1)
jpitch = []
for j in pitch.transform(jorig):
    jpitch.append(j)

If I try to do the same with the DRC deformer it seems to work OK, but with the pitch deformer I get:

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-48-1c0aa6d965af> in <module>()
      1 jpitch = []
----> 2 for j in pitch.transform(jorig):
      3     jpitch.append(j)

/usr/local/lib/python2.7/site-packages/muda/base.pyc in transform(self, jam)
    141 
    142         for state in self.states(jam):
--> 143             yield self._transform(jam, state)
    144 
    145     @property

/usr/local/lib/python2.7/site-packages/muda/base.pyc in _transform(self, jam, state)
    109 
    110         if hasattr(self, 'audio'):
--> 111             self.audio(jam_w.sandbox.muda, state)
    112 
    113         if hasattr(self, 'metadata'):

/usr/local/lib/python2.7/site-packages/muda/deformers/pitch.pyc in audio(mudabox, state)
     75         mudabox._audio['y'] = pyrb.pitch_shift(mudabox._audio['y'],
     76                                                mudabox._audio['sr'],
---> 77                                                state['n_semitones'])
     78 
     79     @staticmethod

/usr/local/lib/python2.7/site-packages/pyrubberband/pyrb.pyc in pitch_shift(y, sr, n_steps, rbargs)
    163     rbargs.setdefault('--pitch', n_steps)
    164 
--> 165     return __rubberband(y, sr, **rbargs)

/usr/local/lib/python2.7/site-packages/pyrubberband/pyrb.pyc in __rubberband(y, sr, **kwargs)
     64         arguments.extend([infile, outfile])
     65 
---> 66         subprocess.check_call(arguments)
     67 
     68         # Load the processed audio.

/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.pyc in check_call(*popenargs, **kwargs)
    533     check_call(["ls", "-l"])
    534     """
--> 535     retcode = call(*popenargs, **kwargs)
    536     if retcode:
    537         cmd = kwargs.get("args")

/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.pyc in call(*popenargs, **kwargs)
    520     retcode = call(["ls", "-l"])
    521     """
--> 522     return Popen(*popenargs, **kwargs).wait()
    523 
    524 

/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/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)
    708                                 p2cread, p2cwrite,
    709                                 c2pread, c2pwrite,
--> 710                                 errread, errwrite)
    711         except Exception:
    712             # Preserve original exception in case os.close raises.

/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/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)
   1325                         raise
   1326                 child_exception = pickle.loads(data)
-> 1327                 raise child_exception
   1328 
   1329 

OSError: [Errno 2] No such file or directory
bmcfee commented 8 years ago

namespaces shouldn't have any effect here; this actually looks like a repeat of #26 ; are you sure that you have rubberband-cli installed?

(DRC uses sox, not rubberband, so it may behave totally differently.)

justinsalamon commented 8 years ago

yes, installing rubberband-cli fixed it (in my case brew install rubberband). Would be nice to get a more helpful error message. Thanks!

bmcfee commented 8 years ago

Would be nice to get a more helpful error message. Thanks!

PR's always welcome! That one belongs on pyrubberband though.