Spaces:
Runtime error
Runtime error
Commit ·
d68daac
1
Parent(s): 2e21b83
fixed audio metadata bug
Browse files- preprocessing/dataset.py +6 -1
preprocessing/dataset.py
CHANGED
|
@@ -41,9 +41,14 @@ class SongDataset(Dataset):
|
|
| 41 |
self.audio_durations = [
|
| 42 |
meta.num_frames / meta.sample_rate for meta in audio_metadata
|
| 43 |
]
|
|
|
|
|
|
|
|
|
|
| 44 |
else:
|
| 45 |
self.audio_durations = audio_durations
|
| 46 |
-
|
|
|
|
|
|
|
| 47 |
self.audio_window_duration = int(audio_window_duration)
|
| 48 |
self.audio_start_offset = audio_start_offset
|
| 49 |
self.audio_window_jitter = audio_window_jitter
|
|
|
|
| 41 |
self.audio_durations = [
|
| 42 |
meta.num_frames / meta.sample_rate for meta in audio_metadata
|
| 43 |
]
|
| 44 |
+
self.sample_rate = audio_metadata[
|
| 45 |
+
0
|
| 46 |
+
].sample_rate # assuming same sample rate
|
| 47 |
else:
|
| 48 |
self.audio_durations = audio_durations
|
| 49 |
+
self.sample_rate = ta.info(
|
| 50 |
+
audio_paths[0]
|
| 51 |
+
).sample_rate # assuming same sample rate
|
| 52 |
self.audio_window_duration = int(audio_window_duration)
|
| 53 |
self.audio_start_offset = audio_start_offset
|
| 54 |
self.audio_window_jitter = audio_window_jitter
|