Spaces:
Sleeping
Sleeping
Commit
·
4f7d68b
1
Parent(s):
d60a776
Fix issue where chunk length is 0
Browse files- remfx/datasets.py +7 -5
remfx/datasets.py
CHANGED
@@ -206,11 +206,13 @@ class EffectDataset(Dataset):
|
|
206 |
# Split audio file into chunks, resample, then apply random effects
|
207 |
self.proc_root.mkdir(parents=True, exist_ok=True)
|
208 |
for num_chunk in tqdm(range(self.total_chunks)):
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
random_file_choice
|
213 |
-
|
|
|
|
|
214 |
random_chunk = random.choice(chunks)
|
215 |
resampled_chunk = torchaudio.functional.resample(
|
216 |
random_chunk, orig_sr, sample_rate
|
|
|
206 |
# Split audio file into chunks, resample, then apply random effects
|
207 |
self.proc_root.mkdir(parents=True, exist_ok=True)
|
208 |
for num_chunk in tqdm(range(self.total_chunks)):
|
209 |
+
chunks = []
|
210 |
+
while len(chunks) == 0:
|
211 |
+
random_dataset_choice = random.choice(self.files)
|
212 |
+
random_file_choice = random.choice(random_dataset_choice)
|
213 |
+
chunks, orig_sr = create_sequential_chunks(
|
214 |
+
random_file_choice, self.chunk_size
|
215 |
+
)
|
216 |
random_chunk = random.choice(chunks)
|
217 |
resampled_chunk = torchaudio.functional.resample(
|
218 |
random_chunk, orig_sr, sample_rate
|