1
Vote

Audio.Duration returns incorrect length

description

In my C#.net application i am trying to find the length of the audio(mp3) file. The code i am using is

DirectoryInfo directory = new DirectoryInfo(@"C:\Users\Public\Music\Sample Music");
        FileInfo[] file = directory.GetFiles("*.mp3");

        foreach (FileInfo musicFile in file)
        {
            using (Id3.Mp3File mp3 = new Id3.Mp3File(musicFile.FullName))
                {
                    Debug.WriteLine("Filename :{0} Duration :{1}", musicFile.FullName, mp3.Audio.Duration);
                }
            }
This return incorrect length for some of the files. The Audio mode is stereo

comments