dbTalk Databases Forums  

MP3 ID3 tags: anyone know how to include in access database?

comp.database.ms-access comp.database.ms-access


Discuss MP3 ID3 tags: anyone know how to include in access database? in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
gilles
 
Posts: n/a

Default MP3 ID3 tags: anyone know how to include in access database? - 11-05-2003 , 04:03 PM






I would like to create a music database using the information in the
MP3 ID3 tags (v1 and v2). Is it possible to capture those tags and
spread them in different fields in an Access database (or Excel for
that matter), for adding, modifying, indexing, retrieving, etc.

TIA
Gilles

Reply With Quote
  #2  
Old   
John
 
Posts: n/a

Default Re: MP3 ID3 tags: anyone know how to include in access database? - 11-05-2003 , 09:11 PM






Certainly - you need to read the file specification for details on
where these fields are stored in the file (google search for MP3 File
Format Specification), i think for MP3 thats at the end of the file.
Then you need to open the file forReading, binary, and set your cursor
to those locations and read the data in vba, then poke it into your
fields.

if you need more help then that holler,

John

jobrien at acscience dot com


gilles <gchiase181 (AT) rogers (DOT) com> wrote

Quote:
I would like to create a music database using the information in the
MP3 ID3 tags (v1 and v2). Is it possible to capture those tags and
spread them in different fields in an Access database (or Excel for
that matter), for adding, modifying, indexing, retrieving, etc.

TIA
Gilles

Reply With Quote
  #3  
Old   
gilles
 
Posts: n/a

Default Re: MP3 ID3 tags: anyone know how to include in access database? - 11-06-2003 , 01:02 AM



John (thanks for your response)

I looked at the file specs and see that I may have asked more than I
can chew here... Consider this a holler... With a little more details
I might be able to get a friend to write a routine for me that I could
use in MS Access or Excel. I'm afraid I could not write some code !
That gives me cold sweats... I was hoping just to enter stuff in a
database.

If you do not have time to respond again, I'll give this to my friend
and maybe she could help. She knows Access inside out, but I'm not
sure what she knows of ID3s, although she usually surprises me.

Gilles

On 5 Nov 2003 19:11:43 -0800, jobrienct (AT) excite (DOT) com (John) wrote:

Quote:
Certainly - you need to read the file specification for details on
where these fields are stored in the file (google search for MP3 File
Format Specification), i think for MP3 thats at the end of the file.
Then you need to open the file forReading, binary, and set your cursor
to those locations and read the data in vba, then poke it into your
fields.

if you need more help then that holler,

John




Quote:
jobrien at acscience dot com


gilles <gchiase181 (AT) rogers (DOT) com> wrote

I would like to create a music database using the information in the
MP3 ID3 tags (v1 and v2). Is it possible to capture those tags and
spread them in different fields in an Access database (or Excel for
that matter), for adding, modifying, indexing, retrieving, etc.

TIA
Gilles


Reply With Quote
  #4  
Old   
John
 
Posts: n/a

Default Re: MP3 ID3 tags: anyone know how to include in access database? - 11-06-2003 , 01:30 PM



Ahh, so you just want to read it and type it in manually? (giggle)
Well ok, Just open the mp3 with something like the windows media
player - doesnt that display the information you need? Apparently,
from a quick glance, you want the last 128 bytes of the file for the
ID3 tag. If you want to do it programatically...

I usually don't do this (unless i'm getting paid for it) but I got
interested so heres a routine that reads each value from the ID3 and
places the individual fields in a msgbox. you can figure out what to
do with them from there with your friend i guess, it's overly
commented for your benefit

this procedure is called with: ParseID3("c:\BlueGrass.mp3")

Sub ParseID3(pstrFile)
'Field vars
Dim strchar As String
Dim strTag As String
Dim strTitle As String
Dim strArtist As String
Dim strYear As String
Dim strComment As String
Dim strGenre As String
'File vars
Dim fp As Integer
Dim lngFileSize As Long
Dim lngTagStart As Long

'fp = filepointer to next free file handle
fp = FreeFile()
'open the filename assigning to it the filepointer fp
Open pstrFile For Binary As fp
'get filesize
lngFileSize = LOF(fp)
'get start of ID3 tag
lngTagStart = lngFileSize - 127
'set the cursor to the start of the ID3 tag
Seek #fp, lngTagStart
'read the first 3 chars, should be "TAG"
For x = 1 To 3
strchar = Input(1, #fp)
If strchar <> "" Then strTag = strTag & strchar
Next
'Test for properly formatted tag
If strTag = "Tag" Then

'If ok then get title (Seek #fp, (lngTagStart + 3))
For x = 1 To 30
strchar = Input(1, #fp)
If strchar <> "" Then strTitle = strTitle & strchar
Next

'get artist Seek #fp, (lngTagStart + 3 + 30)
For x = 1 To 30
strchar = Input(1, #fp)
If strchar <> "" Then strArtist = strArtist & strchar
Next

'get album Seek #fp, (lngTagStart + 3 + 30 + 30)
For x = 1 To 30
strchar = Input(1, #fp)
If strchar <> "" Then strAlbum = strAlbum & strchar
Next

'get year Seek #fp, (lngTagStart + 3 + 30 + 30 + 30)
For x = 1 To 4
strchar = Input(1, #fp)
If strchar <> "" Then strYear = strYear & strchar
Next

'get comment Seek #fp, (lngTagStart + 3 + 30 + 30 + 4)
For x = 1 To 30
strchar = Input(1, #fp)
If strchar <> "" Then strComment = strComment & strchar
Next

' get genre Seek #fp, (lngTagStart + 3 + 30 + 30 + 4 + 30)
strGenre = Input(1, #fp)

MsgBox "Tag: " & strTag & "<"
MsgBox "Title: " & strTitle & "<"
MsgBox "Artist: " & strArtist & "<"
MsgBox "Album: " & strAlbum & "<"
MsgBox "Year: " & strYear & "<"
MsgBox "Comment: " & strComment & "<"
MsgBox "Genre: " & Asc(strGenre) & "<"

End If
Close #fp
End Sub

John


gilles <gchiase181 (AT) rogers (DOT) com> wrote

Quote:
John (thanks for your response)

I looked at the file specs and see that I may have asked more than I
can chew here... Consider this a holler... With a little more details
I might be able to get a friend to write a routine for me that I could
use in MS Access or Excel. I'm afraid I could not write some code !
That gives me cold sweats... I was hoping just to enter stuff in a
database.

If you do not have time to respond again, I'll give this to my friend
and maybe she could help. She knows Access inside out, but I'm not
sure what she knows of ID3s, although she usually surprises me.

Gilles

On 5 Nov 2003 19:11:43 -0800, jobrienct (AT) excite (DOT) com (John) wrote:

Certainly - you need to read the file specification for details on
where these fields are stored in the file (google search for MP3 File
Format Specification), i think for MP3 thats at the end of the file.
Then you need to open the file forReading, binary, and set your cursor
to those locations and read the data in vba, then poke it into your
fields.

if you need more help then that holler,

John





jobrien at acscience dot com


gilles <gchiase181 (AT) rogers (DOT) com> wrote

I would like to create a music database using the information in the
MP3 ID3 tags (v1 and v2). Is it possible to capture those tags and
spread them in different fields in an Access database (or Excel for
that matter), for adding, modifying, indexing, retrieving, etc.

TIA
Gilles

Reply With Quote
  #5  
Old   
gilles
 
Posts: n/a

Default Re: MP3 ID3 tags: anyone know how to include in access database? - 11-07-2003 , 09:31 AM



There are some great guys on these newsgroups afterall ! ! !

Thank you very much. I'll share this with my friend and see what she
can come up with.

Typing it manually is exactly what I want to prevent ! ! ! Why do
something manually if the computer can do it for you.

Oh! I so wish that I could program.

Gilles

On 6 Nov 2003 11:30:30 -0800, jobrienct (AT) excite (DOT) com (John) wrote:

Quote:
Ahh, so you just want to read it and type it in manually? (giggle)
Well ok, Just open the mp3 with something like the windows media
player - doesnt that display the information you need? Apparently,
from a quick glance, you want the last 128 bytes of the file for the
ID3 tag. If you want to do it programatically...

I usually don't do this (unless i'm getting paid for it) but I got
interested so heres a routine that reads each value from the ID3 and
places the individual fields in a msgbox. you can figure out what to
do with them from there with your friend i guess, it's overly
commented for your benefit

this procedure is called with: ParseID3("c:\BlueGrass.mp3")

Sub ParseID3(pstrFile)
'Field vars
Dim strchar As String
Dim strTag As String
Dim strTitle As String
Dim strArtist As String
Dim strYear As String
Dim strComment As String
Dim strGenre As String
'File vars
Dim fp As Integer
Dim lngFileSize As Long
Dim lngTagStart As Long

'fp = filepointer to next free file handle
fp = FreeFile()
'open the filename assigning to it the filepointer fp
Open pstrFile For Binary As fp
'get filesize
lngFileSize = LOF(fp)
'get start of ID3 tag
lngTagStart = lngFileSize - 127
'set the cursor to the start of the ID3 tag
Seek #fp, lngTagStart
'read the first 3 chars, should be "TAG"
For x = 1 To 3
strchar = Input(1, #fp)
If strchar <> "" Then strTag = strTag & strchar
Next
'Test for properly formatted tag
If strTag = "Tag" Then

'If ok then get title (Seek #fp, (lngTagStart + 3))
For x = 1 To 30
strchar = Input(1, #fp)
If strchar <> "" Then strTitle = strTitle & strchar
Next

'get artist Seek #fp, (lngTagStart + 3 + 30)
For x = 1 To 30
strchar = Input(1, #fp)
If strchar <> "" Then strArtist = strArtist & strchar
Next

'get album Seek #fp, (lngTagStart + 3 + 30 + 30)
For x = 1 To 30
strchar = Input(1, #fp)
If strchar <> "" Then strAlbum = strAlbum & strchar
Next

'get year Seek #fp, (lngTagStart + 3 + 30 + 30 + 30)
For x = 1 To 4
strchar = Input(1, #fp)
If strchar <> "" Then strYear = strYear & strchar
Next

'get comment Seek #fp, (lngTagStart + 3 + 30 + 30 + 4)
For x = 1 To 30
strchar = Input(1, #fp)
If strchar <> "" Then strComment = strComment & strchar
Next

' get genre Seek #fp, (lngTagStart + 3 + 30 + 30 + 4 + 30)
strGenre = Input(1, #fp)

MsgBox "Tag: " & strTag & "<"
MsgBox "Title: " & strTitle & "<"
MsgBox "Artist: " & strArtist & "<"
MsgBox "Album: " & strAlbum & "<"
MsgBox "Year: " & strYear & "<"
MsgBox "Comment: " & strComment & "<"
MsgBox "Genre: " & Asc(strGenre) & "<"

End If
Close #fp
End Sub

John


gilles <gchiase181 (AT) rogers (DOT) com> wrote

John (thanks for your response)

I looked at the file specs and see that I may have asked more than I
can chew here... Consider this a holler... With a little more details
I might be able to get a friend to write a routine for me that I could
use in MS Access or Excel. I'm afraid I could not write some code !
That gives me cold sweats... I was hoping just to enter stuff in a
database.

If you do not have time to respond again, I'll give this to my friend
and maybe she could help. She knows Access inside out, but I'm not
sure what she knows of ID3s, although she usually surprises me.

Gilles

On 5 Nov 2003 19:11:43 -0800, jobrienct (AT) excite (DOT) com (John) wrote:

Certainly - you need to read the file specification for details on
where these fields are stored in the file (google search for MP3 File
Format Specification), i think for MP3 thats at the end of the file.
Then you need to open the file forReading, binary, and set your cursor
to those locations and read the data in vba, then poke it into your
fields.

if you need more help then that holler,

John





jobrien at acscience dot com


gilles <gchiase181 (AT) rogers (DOT) com> wrote

I would like to create a music database using the information in the
MP3 ID3 tags (v1 and v2). Is it possible to capture those tags and
spread them in different fields in an Access database (or Excel for
that matter), for adding, modifying, indexing, retrieving, etc.

TIA
Gilles


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.