mandipgoswami commited on
Commit
b32f177
·
verified ·
1 Parent(s): 53f67cb

Delete benchmarks/dereverb_sisdr

Browse files
benchmarks/dereverb_sisdr/README.md DELETED
@@ -1,8 +0,0 @@
1
- # Dereverberation baseline (SI-SDRi)
2
-
3
- Toy pipeline for generating reverberant speech by convolving clean speech with an RIR, and applying a naive magnitude shrinkage baseline.
4
-
5
- Usage: place a short `samples/clean.wav` (not included) and run:
6
- ```bash
7
- python baseline_dereverb.py
8
- ```
 
 
 
 
 
 
 
 
 
benchmarks/dereverb_sisdr/README.md~ DELETED
@@ -1,8 +0,0 @@
1
- # Dereverberation baseline (SI-SDRi)
2
-
3
- Toy pipeline for generating reverberant speech by convolving clean speech with an RIR, and applying a naive magnitude shrinkage baseline.
4
-
5
- Usage: place a short `samples/clean.wav` (not included) and run:
6
- ```bash
7
- python baseline_dereverb.py
8
- ```
 
 
 
 
 
 
 
 
 
benchmarks/dereverb_sisdr/baseline_dereverb.py DELETED
@@ -1,34 +0,0 @@
1
- # benchmarks/dereverb_sisdr/baseline_dereverb.py
2
- import numpy as np, soundfile as sf
3
- from pathlib import Path
4
-
5
- ROOT = Path(__file__).resolve().parents[2]
6
- CLEAN = ROOT / "samples" / "clean.wav" # user-provided
7
- RIR = ROOT / "samples" / "rir_000053.wav" # example path
8
-
9
- def convolve(x, h):
10
- return np.convolve(x, h)[:len(x)]
11
-
12
- def sisdr(ref, est, eps=1e-8):
13
- ref = ref - np.mean(ref); est = est - np.mean(est)
14
- s = np.dot(est, ref) * ref / (np.dot(ref, ref) + eps)
15
- e = est - s
16
- return 10*np.log10((np.dot(s,s)+eps)/(np.dot(e,e)+eps))
17
-
18
- def main():
19
- if not CLEAN.exists():
20
- raise SystemExit(f"Missing CLEAN wav: {CLEAN}")
21
- if not RIR.exists():
22
- raise SystemExit(f"Missing example RIR: {RIR}")
23
- x, sr = sf.read(CLEAN, dtype="float32")
24
- if x.ndim > 1: x = x[:,0]
25
- h, _ = sf.read(RIR, dtype="float32")
26
- if h.ndim > 1: h = h[:,0]
27
- y = convolve(x, h)
28
- # naive baseline: shrink magnitude in time (toy)
29
- y_hat = y * 0.9
30
- print("SI-SDR (rev):", sisdr(x, y))
31
- print("SI-SDR (est):", sisdr(x, y_hat))
32
-
33
- if __name__ == "__main__":
34
- main()