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: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • QA teams don't have time to test everything yet they can't afford to ship buggy code. Learn how Coverity can help organizations shrink their testing cycles and reduce regression risk by focusing their manual and automated testing based on the impact of change.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds