bshall / knn-vc

Voice Conversion With Just Nearest Neighbors
https://bshall.github.io/knn-vc/
Other
450 stars 65 forks source link

SoX effect fails on Windows with SoundFile backend #5

Closed Zuellni closed 1 year ago

Zuellni commented 1 year ago
Traceback (most recent call last):
  File "\.cache\torch\hub\bshall_knn-vc_master\matcher.py", line 72, in get_matching_set
    feats.append(self.get_features(p, weights=self.weighting if weights is None else weights, vad_trigger_level=vad_trigger_level))
  File "\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "\.cache\torch\hub\bshall_knn-vc_master\matcher.py", line 105, in get_features
    waveform_reversed, sr = apply_effects_tensor(x_front_trim, sr, [["reverse"]])
  File "\lib\site-packages\torchaudio\_internal\module_utils.py", line 73, in wrapped
    raise RuntimeError(f"{func.__module__}.{func.__name__} {message}")
RuntimeError: torchaudio.sox_effects.sox_effects.apply_effects_tensor requires sox extension, but TorchAudio is not compiled with it. Please build TorchAudio with libsox support.

It seems to work correctly after patching the apply_effects_tensor method since reverse is the only effect used but probably not the most elegant solution.

torchaudio.sox_effects.apply_effects_tensor = lambda waveform, sample_rate, _: (
    torch.flip(waveform, (-1,)),
    sample_rate,
)
RF5 commented 1 year ago

I have pushed a fix which implements roughly this. The sox apply_effects_tensor is no longer used and so it might work better on windows now. However certain training functions will likely still not work on windows.