Spaces:
Runtime error
Runtime error
Hendrik Schroeter
commited on
Increase length of kitchen noise
Browse files- app.py +5 -4
- samples/dkitchen.wav +2 -2
app.py
CHANGED
|
@@ -48,10 +48,9 @@ def mix_at_snr(clean, noise, snr, eps=1e-10):
|
|
| 48 |
|
| 49 |
|
| 50 |
def mix_and_denoise(speech, speech_alt, noise, snr):
|
| 51 |
-
print(speech, noise, snr)
|
| 52 |
if noise is None:
|
| 53 |
noise = "samples/dkitchen.wav"
|
| 54 |
-
if speech is None or
|
| 55 |
speech = "samples/p232_013_clean.wav"
|
| 56 |
if speech_alt is not None and "none" not in speech_alt:
|
| 57 |
print("using speech_alt")
|
|
@@ -59,7 +58,9 @@ def mix_and_denoise(speech, speech_alt, noise, snr):
|
|
| 59 |
print(speech, noise, snr)
|
| 60 |
sr = config("sr", 48000, int, section="df")
|
| 61 |
speech, _ = load_audio(speech, sr)
|
|
|
|
| 62 |
noise, _ = load_audio(noise, sr)
|
|
|
|
| 63 |
speech, noise, noisy = mix_at_snr(speech, noise, snr)
|
| 64 |
enhanced = enhance(model, df, noisy)
|
| 65 |
lim = torch.linspace(0.0, 1.0, int(sr * 0.15)).unsqueeze(0)
|
|
@@ -200,14 +201,14 @@ inputs = [
|
|
| 200 |
]
|
| 201 |
examples = [
|
| 202 |
[
|
| 203 |
-
"samples/p232_013_clean.wav",
|
| 204 |
"none",
|
|
|
|
| 205 |
"samples/dkitchen.wav",
|
| 206 |
10,
|
| 207 |
],
|
| 208 |
[
|
| 209 |
-
"samples/p232_019_clean.wav",
|
| 210 |
"none",
|
|
|
|
| 211 |
"samples/dliving.wav",
|
| 212 |
10,
|
| 213 |
],
|
|
|
|
| 48 |
|
| 49 |
|
| 50 |
def mix_and_denoise(speech, speech_alt, noise, snr):
|
|
|
|
| 51 |
if noise is None:
|
| 52 |
noise = "samples/dkitchen.wav"
|
| 53 |
+
if speech is None or "none" in speech:
|
| 54 |
speech = "samples/p232_013_clean.wav"
|
| 55 |
if speech_alt is not None and "none" not in speech_alt:
|
| 56 |
print("using speech_alt")
|
|
|
|
| 58 |
print(speech, noise, snr)
|
| 59 |
sr = config("sr", 48000, int, section="df")
|
| 60 |
speech, _ = load_audio(speech, sr)
|
| 61 |
+
print(f"Loaded speech with shape {speech.shape}")
|
| 62 |
noise, _ = load_audio(noise, sr)
|
| 63 |
+
print(f"Loaded noise with shape {noise.shape}")
|
| 64 |
speech, noise, noisy = mix_at_snr(speech, noise, snr)
|
| 65 |
enhanced = enhance(model, df, noisy)
|
| 66 |
lim = torch.linspace(0.0, 1.0, int(sr * 0.15)).unsqueeze(0)
|
|
|
|
| 201 |
]
|
| 202 |
examples = [
|
| 203 |
[
|
|
|
|
| 204 |
"none",
|
| 205 |
+
"samples/p232_013_clean.wav",
|
| 206 |
"samples/dkitchen.wav",
|
| 207 |
10,
|
| 208 |
],
|
| 209 |
[
|
|
|
|
| 210 |
"none",
|
| 211 |
+
"samples/p232_019_clean.wav",
|
| 212 |
"samples/dliving.wav",
|
| 213 |
10,
|
| 214 |
],
|
samples/dkitchen.wav
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6bc229639249ce876bd40bbff15eae4553b7c15cdcf0b720ed814062b4956af6
|
| 3 |
+
size 2880044
|