In order to protect the copyright of the musicians, there is a special storage of the copyright instructions in the MP3 file. Many MP3 player software provides the ability to hide information in the MP3 file, then where is this information stored? How to get this information? This article will provide you with a module that gets MP3 information.
First, define a public type MP3TAG as follows:
Public Type Mp3tag Artist As String 'Artist storage singer information Album As String' Album storage album Album information Title As String 'Title storing title information Year As String' Year store's information Comments As String 'Comments store notes information Genre As Integer' Genre storage Music style sequence End Type
Then, define a function that gets MP3 information, it will return this, the code is as follows:
Public Function GetMp3Tag (FName As String) As Mp3tag Dim Artist As String Dim Album As String Dim Title As String Dim Year As String Dim Comments As String Dim Genre As Integer If FName = "" Then Exit Function
IF Dir (FNAME) = "" THEN EXIT FUNCTION DIM FILENUM AS INTEGER
Filenum = freefile 'gets a free file number
DIM STRINPUT AS STRING
Open Filenum 'open files in binary form IF LOF (filenum) <128 Then Close Filenum EXIT FUNCTION END IF SEK FILENUM, LOF (Filenum) - 127' Put the file pointer to the MP3 information STRINPUT = SPACE 3) GET FileNum, Strinput
If STRINPUT <> "tag", if there is no information ID, close the file close filenum goto Done: end if strinput = space (30) get filenum, STRINPUT TITLE = TRIM (STRINPUT) STRINPUT = Space (30) Get FileNum ,, strInput Artist = Trim (strInput) strInput = Space (30) Get FileNum,, strInput Album = Trim (strInput) strInput = Space (4) Get FileNum,, strInput Year = Trim (strInput) strInput = Space (30) Get FileNum,, strInput Comments = Trim (strInput) strInput = Space (1) Get FileNum,, strInput Genre = Asc (strInput) Done: GetMp3Tag.Title = Title GetMp3Tag.Artist = Artist GetMp3Tag.Album = Album GetMp3Tag.Year = Year GetMp3Tag .Year = comments if genre <0 or genre> 254 Then gene = 12 getmp3tag.genre = cint (genre) Close Filenum
End function Note: MP3 files are limited to music style, with a total of 254 species. GENRE returns only the serial number of the MP3 style, and the specific location is required, here I list all types in constant forms, each type is separated from "|".
Private const sgenrematrix = "blues | Classic Rock | Country | DANCE | DISCO | FUNK | GRUNGE |" _ "HIP-HOP | JAZ | METAL | New Age | Oldies | Other | POP | R & B | RAP | Reggae | ROCK | TECHNO | " _" Industrial | ALTERNATIVE | SKA | Death Metal | PRANKS | Soundtrack | EURO-TECHNO | " _" Ambient | Trip Hop | Vocal | JAZZ FUNK | Fusion | Trance | Classical | Instrumental | ACID | __ "House | Game | Sound Clip | Gospel | Noise | Alt. Rock | Bass | Soul | Punk | Space | Meditative |" _ "Instrumental Pop | Instrumental Rock | Ethnic | Gothic | DARKWAVE | Techno-Industrial | Electronic | _ "POP-FOLK | EURODANCE | DREAM | Southern Rock | COMEDY | CULT | Gangsta Rap | Top 40 | Christian Rap |" _ "POP / PUNK | JUNGLE | NATIVE AMERICAN | Cabaret | New Wave | Phychedelic | RAVE | ShowTunes | Trailer | " _" LO-FI | TRIBAL | ACID PUNK | ACID JAZ | POLKA | RETRO | MUSICAL | ROCK & ROLL | HARD ROCK | FOLK | " _" FOLK / ROCK | National FOLK | SWING | FAST-Fusion | BEBOB | LATIN | Revival | Celtic | Blue Grass | " _" Avantegarde | Gothic Rock | Progressive Rock | Psychidelic Rock | Symphonic Rock | Slow Rock | " _" BIG BAND | Chorus | EAS y listening | ACOUSTIC | Humour | Speech | CHANSON | OPERA | Chamber Music | " _" Sonata | Symphony | Booty Bass | Primus | Porn Groove | Satire | Slow Jam | Club | Tango | Samba | FOLKLORE | " _" Ballad | Power Ballad | Rhythmic Soul | FreeStyle | Duet | Punk Rock | Drum Sol | A Capella | EURO-HOUSE | _ "Dance Hall | Goa | Drum & Bass | Club-House | Hardcore | TERROR | Indie | BRIT POP | Negerpunk | POLSK PUNK | " _" Beat | Christian Gangsta Rap | Heavy Metal | Black Metal | Crossover | COMTEPORARY Christian | " _" Christian Rock | Merengue | Salsa | TRASH METAL | Anime | JPOP | SYNTH POP "