Spaces:
Runtime error
Runtime error
Hendrik Schroeter
commited on
Skip first 100ms
Browse files
app.py
CHANGED
|
@@ -52,16 +52,19 @@ def mix_at_snr(clean, noise, snr, eps=1e-10):
|
|
| 52 |
|
| 53 |
|
| 54 |
def mix_and_denoise(speech, speech_alt, noise, snr):
|
|
|
|
|
|
|
| 55 |
if noise is None:
|
| 56 |
noise = "samples/dkitchen.wav"
|
|
|
|
| 57 |
if speech is None or "none" in speech:
|
| 58 |
speech = "samples/p232_013_clean.wav"
|
| 59 |
if speech_alt is not None and "none" not in speech_alt:
|
| 60 |
print("using speech_alt")
|
| 61 |
speech = speech_alt
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
speech, _ = load_audio(speech, sr)
|
| 65 |
print(f"Loaded speech with shape {speech.shape}")
|
| 66 |
noise, _ = load_audio(noise, sr)
|
| 67 |
print(f"Loaded noise with shape {noise.shape}")
|
|
|
|
| 52 |
|
| 53 |
|
| 54 |
def mix_and_denoise(speech, speech_alt, noise, snr):
|
| 55 |
+
sr = config("sr", 48000, int, section="df")
|
| 56 |
+
print(speech, noise, snr)
|
| 57 |
if noise is None:
|
| 58 |
noise = "samples/dkitchen.wav"
|
| 59 |
+
sp_kwargs = {}
|
| 60 |
if speech is None or "none" in speech:
|
| 61 |
speech = "samples/p232_013_clean.wav"
|
| 62 |
if speech_alt is not None and "none" not in speech_alt:
|
| 63 |
print("using speech_alt")
|
| 64 |
speech = speech_alt
|
| 65 |
+
else:
|
| 66 |
+
sp_kwargs = {"frame_offset": 4800}
|
| 67 |
+
speech, _ = load_audio(speech, sr, **sp_kwargs)
|
| 68 |
print(f"Loaded speech with shape {speech.shape}")
|
| 69 |
noise, _ = load_audio(noise, sr)
|
| 70 |
print(f"Loaded noise with shape {noise.shape}")
|