Spaces:
Runtime error
Runtime error
Matthijs Hollemans
commited on
Commit
·
339c0eb
1
Parent(s):
d773ef7
limit audio length
Browse files
app.py
CHANGED
|
@@ -22,6 +22,9 @@ def process_audio(sampling_rate, waveform):
|
|
| 22 |
if sampling_rate != 16000:
|
| 23 |
waveform = librosa.resample(waveform, orig_sr=sampling_rate, target_sr=16000)
|
| 24 |
|
|
|
|
|
|
|
|
|
|
| 25 |
# make PyTorch tensor
|
| 26 |
waveform = torch.tensor(waveform)
|
| 27 |
return waveform
|
|
|
|
| 22 |
if sampling_rate != 16000:
|
| 23 |
waveform = librosa.resample(waveform, orig_sr=sampling_rate, target_sr=16000)
|
| 24 |
|
| 25 |
+
# limit to 30 seconds
|
| 26 |
+
waveform = waveform[:16000*30]
|
| 27 |
+
|
| 28 |
# make PyTorch tensor
|
| 29 |
waveform = torch.tensor(waveform)
|
| 30 |
return waveform
|