- 
                Notifications
    You must be signed in to change notification settings 
- Fork 736
Closed
Description
🐛 Bug
torchaudio.info returns the info objects directly from the respective backend. Due to same property naming, users might forget to check how the metadata is calculated. This results in metadata being reported differently depending on which backend is reported.
E.g. sox calculates the length summed across channels whereas soundfile does this per channel (correct)
I would propose to add wrapper for the info objects that - independent of the backend - the most important metadata (length and rate) is identical.
Currently, the sox backend reports a missleading length and the rate parameter is of type float instead of int.
To Reproduce
path =  "any/wavfile.wav"
# soundfile
torchaudio.set_audio_backend("soundfile")
info = torchaudio.info(path)
print(si.length)
print(type(si.rate))
# sox
torchaudio.set_audio_backend("sox")
info = torchaudio.info(path)
print(si.length)
print(type(si.rate))Expected behavior
soundfile reports the correct metadata, sox should be corrected so that:
# sox
torchaudio.set_audio_backend("sox")
info = torchaudio.info(path)
print(si.length // si.channels)
print(int(si.rate))Environment
torchaudio==0.5.0 from pypi