In the uncompressed situation I know I need to read the wav header, pull out the number of channels, bits, and sample rate and work it out from there: (channels) * (bits) *
Yes, There is a free library that can be used to get time duration of Audio file. This library also provides many more functionalities.
TagLib
TagLib is distributed under the GNU Lesser General Public License (LGPL) and Mozilla Public License (MPL).
I implemented below code that returns time duration in seconds.
using TagLib.Mpeg;
public static double GetSoundLength(string FilePath)
{
AudioFile ObjAF = new AudioFile(FilePath);
return ObjAF.Properties.Duration.TotalSeconds;
}