Using Audacity, I have exported a mp3 file from a very short wav file.
Bringing the mp3 file back into Audacity and viewing the wav and mp3 together shows the files as different lengths with (mostly!) silent audio added at the beginning and end of the waveform. This is the same on both Windows and Mac.
They are also different lengths when using the NAudio API.
However, if I view in Sonic Visualiser on Windows, both the wav and mp3 files are the same length.
They are also the same length on the Mac when using AVFoundation API components.
I expect some difference in the sample amplitudes due to lossy encoding, but not the length of the file. Why do some tools and frameworks load the mp3 file incorrectly, having a different length and spurious audio sections at the beginning and end?
(The erroneous lengths are different in Audacity and NAudio by the way.)