Return the audio filename when decoding fails due to corrupt files
MEMBER
Hi ! The audio data don't always exist as files on disk - the blobs are often stored in the Arrow files. For now I'd suggest disabling decoding with `.cast_column("audio", Audio(decode=False))` and apply your own decoding that handles corrupted files (maybe to filter them out ?)

cc @sanchit-gandhi since it's related to our discussion about allowing users to make decoding return `None` and show a warning when there are corrupted files
2023-06-14T12:17:36Z
https://github.com/huggingface/datasets/issues/5947#issuecomment-1591081260
https://api.github.com/repos/huggingface/datasets/issues/5947
IC_kwDODunzps5e1fks
https://api.github.com/repos/huggingface/datasets/issues/comments/1591081260/reactions
2023-06-14T12:17:36Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1591081260
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
NONE
Thanks @lhoestq, I wasn't aware of the decode flag. It makes more sense as you say to show a warning when there are corrupted files together with some metadata of the file that allows to filter them from the dataset.

My workaround was to catch the LibsndfileError and generate a dummy audio with an unsual sample rate to filter it later. However returning `None` seems better. 

`try:
    array, sampling_rate = sf.read(file)
except sf.LibsndfileError:
    print("bad file")
    array = np.array([0.0])
    sampling_rate = 99.000` 


2023-06-14T12:44:02Z
https://github.com/huggingface/datasets/issues/5947#issuecomment-1591121455
https://api.github.com/repos/huggingface/datasets/issues/5947
IC_kwDODunzps5e1pYv
https://api.github.com/repos/huggingface/datasets/issues/comments/1591121455/reactions
2023-06-14T12:45:01Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1591121455
https://avatars.githubusercontent.com/u/8949105?v=4
https://api.github.com/users/wetdog/events{/privacy}
https://api.github.com/users/wetdog/followers
https://api.github.com/users/wetdog/following{/other_user}
https://api.github.com/users/wetdog/gists{/gist_id}
https://github.com/wetdog
wetdog
MDQ6VXNlcjg5NDkxMDU=
https://api.github.com/users/wetdog/orgs
https://api.github.com/users/wetdog/received_events
https://api.github.com/users/wetdog/repos
https://api.github.com/users/wetdog/starred{/owner}{/repo}
https://api.github.com/users/wetdog/subscriptions
User
https://api.github.com/users/wetdog
public
### Feature request

Return the audio filename when the audio decoding fails. Although currently there are some checks for mp3 and opus formats with the library version there are still cases when the audio decoding could fail, eg. Corrupt file. 

### Motivation

When you try to load an object file dataset and the decoding fails you can't know which file is corrupt
```

raise LibsndfileError(err, prefix="Error opening {0!r}: ".format(self.name))
soundfile.LibsndfileError: Error opening <_io.BytesIO object at 0x7f5ab7e38290>: Format not recognised.
```

### Your contribution

Make a PR to Add exceptions for LIbsndfileError to return the audio filename or path when soundfile decoding fails.