Skip to content

Commit e040260

Browse files
committed
fix array transposition
1 parent 7bc24a4 commit e040260

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Architectures/Aligner/CodecAlignerDataset.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ def _cache_builder_process(self,
193193
print(f"Problem with an audio file: {path}")
194194
continue
195195

196+
if len(wave.shape) > 1: # the audio is in stereo, so we need to merge the channels.
197+
if len(wave[0]) == 2: # let's figure out whether the axes are switched, which seems to be the case sometimes
198+
wave = wave.transpose() # if yes, we switch the axes into the order librosa's to_mono function expects.
196199
wave = librosa.to_mono(wave)
197200

198201
if sr != assumed_sr:

0 commit comments

Comments
 (0)