Hi,
I am using torchaudio to load and save audio files but the number of samples seems to be wrong.
Here is my code:
path_audio = 'example.mp3'
save_path = 'example_new.mp3'

#show info about file
print(torchaudio.info(path_audio))
Output: AudioMetaData(sample_rate=16000, num_frames=90432, num_channels=1, bits_per_sample=0, encoding=MP3)

#load example file
audio_tuple = torchaudio.load(path_audio)
audio = audio_tuple[0]
samplerate = audio_tuple[1]

print(audio.shape[1])
Output: 89856 #why is this different from info?

#cut audio to 1 second @ 16kHz
audio = audio[:,0:16000]

#check
print(audio.shape[1])
Output: 16000

#save audio and get info of saved file
torchaudio.save(save_path, audio, samplerate)
print(torchaudio.info(save_path))
Output: AudioMetaData(sample_rate=16000, num_frames=17280, num_channels=1, bits_per_sample=0, encoding=MP3) #why is this not 1600?

#load saved file:
reloaded_audio_tuple = torchaudio.load(save_path)
reloaded_audio = reloaded_audio_tuple[0] 
print(reloaded_audio.shape)
Output: torch.Size([1, 16704]) #this should be 16000! 

As you can see the output file has too many samples. They have not been added to the end of the file so i can’t just cut the file again. Can someone help me?
Thx!