none
Finding .wav file length in c RRS feed

Answers

  • Hi, from what i have read, in here:

    http://forums.asp.net/t/1699477.aspx/1

    This code snippet shows how to get what you want, you pass the full path of the wav file as parameter.

    public double WaveHeaderIN(string spath)
            {
                FileStream fs = new FileStream(spath, FileMode.Open, FileAccess.Read);
    
                BinaryReader br = new BinaryReader(fs);
                length = (int)fs.Length - 8;
                fs.Position = 22;
                channels = br.ReadInt16();
                fs.Position = 24;
                samplerate = br.ReadInt32();
                fs.Position = 34;
    
                BitsPerSample = br.ReadInt16();
                DataLength = (int)fs.Length - 44;
                br.Close();
                fs.Close();
                return samplerate;
    
            }


    -

    Monday, January 21, 2013 2:57 PM