Rikorose / DeepFilterNet

Noise supression using deep filtering
https://huggingface.co/spaces/hshr/DeepFilterNet2
Other
2.11k stars 196 forks source link

RuntimeError: Couldn't find appropriate backend to handle uri <noisy_audio_file> and format None. #579

Closed jurihock closed 2 weeks ago

jurihock commented 2 weeks ago

Steps to reproduce:

Error log:

jurihock commented 2 weeks ago

Finally, I adapted the external_usage.py example to suit my needs and use soundfile paired with resampy, to load and save the audio files.

Something like this:

import numpy as np
import resampy
import soundfile

from df.enhance import enhance, init_df

model, state, _ = init_df()

x, sr = soundfile.read('x.wav', always_2d=True)

x = x if sr == state.sr() else resampy.resample(x, sr, state.sr())
sr = state.sr()

x = x.astype(np.float32).T
x = torch.from_numpy(x)

y = enhance(model, state, x)

y = y.detach().cpu().numpy()
y = np.squeeze(y.T)

soundfile.write('y.wav', y, sr)