Update app.py
Browse files
app.py
CHANGED
@@ -14,10 +14,19 @@ try:
|
|
14 |
except ImportError as e:
|
15 |
print(f"AudioSeal could not be imported: {e}")
|
16 |
|
17 |
-
def extract_mfcc_features(waveform, sample_rate, n_mfcc=
|
18 |
-
mfcc_transform = T.MFCC(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
mfcc = mfcc_transform(waveform)
|
20 |
-
return mfcc.mean(dim=2)
|
21 |
|
22 |
def plot_spectrogram(waveform, sample_rate):
|
23 |
if waveform.ndim == 1:
|
|
|
14 |
except ImportError as e:
|
15 |
print(f"AudioSeal could not be imported: {e}")
|
16 |
|
17 |
+
def extract_mfcc_features(waveform, sample_rate, n_mfcc=40, n_mels=128, win_length=400, hop_length=160):
|
18 |
+
mfcc_transform = T.MFCC(
|
19 |
+
sample_rate=sample_rate,
|
20 |
+
n_mfcc=n_mfcc,
|
21 |
+
melkwargs={
|
22 |
+
'n_fft': 400,
|
23 |
+
'n_mels': n_mels,
|
24 |
+
'hop_length': hop_length,
|
25 |
+
'win_length': win_length
|
26 |
+
}
|
27 |
+
)
|
28 |
mfcc = mfcc_transform(waveform)
|
29 |
+
return mfcc.mean(dim=2)
|
30 |
|
31 |
def plot_spectrogram(waveform, sample_rate):
|
32 |
if waveform.ndim == 1:
|