Skip to content

Commit e5491e9

Browse files
change the way to get audio duration
1 parent 3f8faa4 commit e5491e9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

chapters/en/chapter1/preprocessing.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ dataset. However, we can create one, filter based on the values in that column,
9595

9696
```py
9797
# use librosa to get example's duration from the audio file
98-
new_column = [librosa.get_duration(path=x) for x in minds["path"]]
98+
new_column = [librosa.get_duration(y=x['array'], sr=x['sampling_rate']) for x in minds['audio']]
9999
minds = minds.add_column("duration", new_column)
100100

101101
# use 🤗 Datasets' `filter` method to apply the filtering function

0 commit comments

Comments
 (0)