How to get duration of wav in torchaudio

Before I always use python wave package to calculate the wav duration, and use torchaudio for processing.
So how can I calculate the wav duration in torchaudio? Sorry I can’t find the API in pytorch documentation

thx

You can calculate the duration dividing the amount of elements of the audio by the samplerate.

1 Like