meinardmueller/synctoolbox

Error running sync_audio_audio_full locally in macOS: Failed to execute rubberband

Closed this issue · 3 comments

I'm in a macOS Big Sur 11.2.3. The steps I followed:

  1. I created a Conda environment with Python 3.8
  2. Installed Sync Toolbox using pip install synctoolbox which worked correctly
  3. git clone https://github.com/meinardmueller/synctoolbox.git
  4. Installed Jupyter notebook
  5. Run sync_audio_audio_full

In the following cell:

!pip install pyrubberband
import pyrubberband as pyrb

pitch_shift_for_audio_1 = -opt_chroma_shift % 12
if pitch_shift_for_audio_1 > 6:
    pitch_shift_for_audio_1 -= 12
audio_1_shifted = pyrb.pitch_shift(audio_1, Fs, pitch_shift_for_audio_1)

# Pyrubberband expects the warping path to be given in audio samples.
# Here, we do the conversion and additionally clip values that are too large.
time_map = wp.T / feature_rate * Fs
time_map[time_map[:, 0] > len(audio_1), 0] = len(audio_1)
time_map[time_map[:, 1] > len(audio_2), 1] = len(audio_2)
audio_1_warped = pyrb.timemap_stretch(audio_1_shifted, Fs, time_map=time_map)

stereo_sonification = np.stack([audio_1_warped, audio_2], axis=0)
ipd.display(ipd.Audio(stereo_sonification, rate=Fs))

I'm getting this error:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
~/miniconda3/envs/joss_review_2/lib/python3.8/site-packages/pyrubberband/pyrb.py in __rubberband(y, sr, **kwargs)
     73 
---> 74         subprocess.check_call(arguments, stdout=DEVNULL, stderr=DEVNULL)
     75 

~/miniconda3/envs/joss_review_2/lib/python3.8/subprocess.py in check_call(*popenargs, **kwargs)
    358     """
--> 359     retcode = call(*popenargs, **kwargs)
    360     if retcode:

~/miniconda3/envs/joss_review_2/lib/python3.8/subprocess.py in call(timeout, *popenargs, **kwargs)
    339     """
--> 340     with Popen(*popenargs, **kwargs) as p:
    341         try:

~/miniconda3/envs/joss_review_2/lib/python3.8/subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
    857 
--> 858             self._execute_child(args, executable, preexec_fn, close_fds,
    859                                 pass_fds, cwd, env,

~/miniconda3/envs/joss_review_2/lib/python3.8/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
   1703                         err_msg = os.strerror(errno_num)
-> 1704                     raise child_exception_type(errno_num, err_msg, err_filename)
   1705                 raise child_exception_type(err_msg)

FileNotFoundError: [Errno 2] No such file or directory: 'rubberband'

The above exception was the direct cause of the following exception:

RuntimeError                              Traceback (most recent call last)
/var/folders/j_/672m867d1f30v0qyvsddt71058rw_j/T/ipykernel_27940/816051359.py in <module>
      5 if pitch_shift_for_audio_1 > 6:
      6     pitch_shift_for_audio_1 -= 12
----> 7 audio_1_shifted = pyrb.pitch_shift(audio_1, Fs, pitch_shift_for_audio_1)
      8 
      9 # Pyrubberband expects the warping path to be given in audio samples.

~/miniconda3/envs/joss_review_2/lib/python3.8/site-packages/pyrubberband/pyrb.py in pitch_shift(y, sr, n_steps, rbargs)
    255     rbargs.setdefault('--pitch', n_steps)
    256 
--> 257     return __rubberband(y, sr, **rbargs)

~/miniconda3/envs/joss_review_2/lib/python3.8/site-packages/pyrubberband/pyrb.py in __rubberband(y, sr, **kwargs)
     82 
     83     except OSError as exc:
---> 84         six.raise_from(RuntimeError('Failed to execute rubberband. '
     85                                     'Please verify that rubberband-cli '
     86                                     'is installed.'),

~/miniconda3/envs/joss_review_2/lib/python3.8/site-packages/six.py in raise_from(value, from_value)

RuntimeError: Failed to execute rubberband. Please verify that rubberband-cli is installed.

It seems that librosa's users reported a similar problem here. @ahnonay @yiitozer any advice?

openjournals/joss-reviews#3434

I saw that you discussed about it here but I don't have sudo status in this machine, neither in the linux ones I was planning to test the software on. I'm happy to move on and close this issue if you think there's no workaround in the near future since you already added a comment in the notebook explaining this. I just want to make sure that the error I'm getting is the same you expect and there's nothing else going on.

I confirm that the other cells in this notebook work fine for me.

We're planning on replacing the rubberband package with libtsm soon:
https://github.com/meinardmueller/libtsm

once we ensure that the libtsm package is stable. Hopefully, that's OK to keep the notebook as it is for now.

Ok, makes sense. Will close this then. Thanks!