Spaces:
Runtime error
Runtime error
fix load audio from file
Browse files- audiodiffusion/mel.py +6 -3
audiodiffusion/mel.py
CHANGED
|
@@ -46,9 +46,12 @@ class Mel:
|
|
| 46 |
audio_file (str): must be a file on disk due to Librosa limitation or
|
| 47 |
raw_audio (np.ndarray): audio as numpy array
|
| 48 |
"""
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
def get_number_of_slices(self) -> int:
|
| 54 |
"""Get number of slices in audio.
|
|
|
|
| 46 |
audio_file (str): must be a file on disk due to Librosa limitation or
|
| 47 |
raw_audio (np.ndarray): audio as numpy array
|
| 48 |
"""
|
| 49 |
+
if audio_file is not None:
|
| 50 |
+
self.y, _ = librosa.load(
|
| 51 |
+
audio_file,
|
| 52 |
+
mono=True)
|
| 53 |
+
else:
|
| 54 |
+
self.y = raw_audio
|
| 55 |
|
| 56 |
def get_number_of_slices(self) -> int:
|
| 57 |
"""Get number of slices in audio.
|