Reading Information from an MP3 File

Environment: Visual Basic .NET

The Mp3Class has two properties:

  • ID3v1: The mp3.s ID3v1; this read-only property returns a Mp3Class.ID3v1TAG structure.
  • Mp3FileInfo: This property returns the System.IO.FileInfo of the current MP3 file.

and the following methods:

  • GetMPEGType() as MPEGType: Returns the Mpeg type of the current Mpeg file (MP3) as a Mp3Class.MPEGType enumeration.
  • GetLayer() as LayerType: Returns the Layer type of the current Mpeg file (MP3) as a Mp3Class.LayerType enumeration.
  • GetProtection() as ProtectionType: Returns the Protection type of the current MP3 file as a Mp3Class.ProtectionType enumeration.
  • IsVBR() as Boolean: Returns true if the MP3 is VBR.
  • GetXingHeader(): Returns a XingHeader structure.
  • For more information, see: http://www.multiweb.cz/twoinches/MP3inside.htm#MP3FileStructure.

  • GetBitrate() as Integer: Returns the bitrate of the current MP3 file in bits per second. If the file is VBR, it returns the average bitrate.
  • GetSamplingRateFreq() as Integer: Returns the sampling rate Frequency of the current MP3 file in Hz.
  • GetChannelMode() as ChannelMode: Returns the Channel mode of the current MP3 file as a Mp3Class.ChannelMode enumeration.
  • GetCopyRight() as CopyRight: Returns the Copyright type of the current MP3 file as a Mp3Class.CopyRight enumeration.
  • GetDuration() as Integer: Returns the duration of the current MP3 file in seconds.
  • GetDurationString() as String: Returns a string with the duration of the current MP3 file in the form of: hh:mm:ss.
  • GetGenreString(ByVal GenreID As Integer) As String: Returns the name of the genre that corresponds to the Current genreID.

I wrote a demo app that demonstrates the use of my class.

I collected all the information needed to write this class from:

Happy coding!!!

George Liaskos, T.E.I. of Piraeus, Automation Dep.

Downloads

Download demo project - 25 Kb
Download source code - 5 Kb



Comments

  • Nicely Done

    Posted by Todd on 10/22/2012 07:28am

    You have saved me hours. Thank you for your effort.

    Reply
  • mp3

    Posted by rudolfffw on 06/11/2007 01:04am

    Depok June 11, 2007.
    
    
    I am rudolf, I cant upload your source code .....so please send me the code to my email...
    
    Do you have code for made simple radio automation or music player build by VB 6, did you have please send.
    
    Thank you before
    
    Best regards,
    Rudolf
    
     email : rudolffw@yahoo.co.id

    Reply
  • reading information from an mp3 file

    Posted by sebinfrancis on 07/16/2005 01:24am

    i have created an mp3 player which play an mp3 file..now i want to play it using data streaming ... from the location itself...using createfile and readfile functions

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • On-demand Event Event Date: October 29, 2014 It's well understood how critical version control is for code. However, its importance to DevOps isn't always recognized. The 2014 DevOps Survey of Practice shows that one of the key predictors of DevOps success is putting all production environment artifacts into version control. In this webcast, Gene Kim discusses these survey findings and shares woeful tales of artifact management gone wrong! Gene also shares examples of how high-performing DevOps …

Most Popular Programming Stories

More for Developers

RSS Feeds