ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MP3 ID3 API Calls for excel (https://www.excelbanter.com/excel-programming/319254-mp3-id3-api-calls-excel.html)

Chad Cameron[_3_]

MP3 ID3 API Calls for excel
 
I am trying to setup a sheet that has filenames, ID3 info fr all my MP3's.
Does anyone know of a site that can provide API info for ID3 tags? or a way
to get the info into excel?

Thanks
Chad



Rob van Gelder[_4_]

MP3 ID3 API Calls for excel
 
I don't know a lot about MP3 tags except that they occupy the last 128 bytes
of an mp3.

I did some Google searching and found the offsets. It seems to work.

Type MP3Tag
ID As String * 3
Title As String * 30
Artist As String * 30
Album As String * 30
Year As String * 4
Comment As String * 28
ID3Tag As Byte
TrackNumber As Byte
End Type

Sub test()
Const cRecordLen = 128
Dim strFile As String, lngFileLen As Long
Dim tag As MP3Tag, intFF As Integer

strFile = "C:\MP3\Prodigy - Always Outnumbered Never Outgunned\06 -
Prodigy - Wake Up Call.mp3"
lngFileLen = FileLen(strFile)

intFF = FreeFile
Open strFile For Binary Access Read As intFF

Get intFF, lngFileLen - cRecordLen + 1, tag

If tag.ID = "TAG" Then
Debug.Print tag.Album; Tab; tag.TrackNumber; Tab; tag.Title
End If

Close intFF
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Chad Cameron" wrote in message
...
I am trying to setup a sheet that has filenames, ID3 info fr all my MP3's.
Does anyone know of a site that can provide API info for ID3 tags? or a
way to get the info into excel?

Thanks
Chad




Chad Cameron[_3_]

MP3 ID3 API Calls for excel
 
Perfect, that is exactly what I need.

Now the next step is once I have all the info listed in columns, how do I
update the file if I change some of the data? Well, I know how to change
it, what is the command to save the .mp3?

TIA,
Greatly appreciated
Chad


"Rob van Gelder" wrote in message
...
I don't know a lot about MP3 tags except that they occupy the last 128
bytes of an mp3.

I did some Google searching and found the offsets. It seems to work.

Type MP3Tag
ID As String * 3
Title As String * 30
Artist As String * 30
Album As String * 30
Year As String * 4
Comment As String * 28
ID3Tag As Byte
TrackNumber As Byte
End Type

Sub test()
Const cRecordLen = 128
Dim strFile As String, lngFileLen As Long
Dim tag As MP3Tag, intFF As Integer

strFile = "C:\MP3\Prodigy - Always Outnumbered Never Outgunned\06 -
Prodigy - Wake Up Call.mp3"
lngFileLen = FileLen(strFile)

intFF = FreeFile
Open strFile For Binary Access Read As intFF

Get intFF, lngFileLen - cRecordLen + 1, tag

If tag.ID = "TAG" Then
Debug.Print tag.Album; Tab; tag.TrackNumber; Tab; tag.Title
End If

Close intFF
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Chad Cameron" wrote in message
...
I am trying to setup a sheet that has filenames, ID3 info fr all my MP3's.
Does anyone know of a site that can provide API info for ID3 tags? or a
way to get the info into excel?

Thanks
Chad






Tim Williams

MP3 ID3 API Calls for excel
 
http://www.vb-fun.de/cgi-bin/loadfra.../tip0106.shtml

(in German but you shouldn't have any problem...)

Tim.


"Chad Cameron" wrote in message
...
Perfect, that is exactly what I need.

Now the next step is once I have all the info listed in columns, how
do I update the file if I change some of the data? Well, I know how
to change it, what is the command to save the .mp3?

TIA,
Greatly appreciated
Chad


"Rob van Gelder" wrote in
message ...
I don't know a lot about MP3 tags except that they occupy the last
128 bytes of an mp3.

I did some Google searching and found the offsets. It seems to
work.

Type MP3Tag
ID As String * 3
Title As String * 30
Artist As String * 30
Album As String * 30
Year As String * 4
Comment As String * 28
ID3Tag As Byte
TrackNumber As Byte
End Type

Sub test()
Const cRecordLen = 128
Dim strFile As String, lngFileLen As Long
Dim tag As MP3Tag, intFF As Integer

strFile = "C:\MP3\Prodigy - Always Outnumbered Never
Outgunned\06 - Prodigy - Wake Up Call.mp3"
lngFileLen = FileLen(strFile)

intFF = FreeFile
Open strFile For Binary Access Read As intFF

Get intFF, lngFileLen - cRecordLen + 1, tag

If tag.ID = "TAG" Then
Debug.Print tag.Album; Tab; tag.TrackNumber; Tab; tag.Title
End If

Close intFF
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Chad Cameron" wrote in message
...
I am trying to setup a sheet that has filenames, ID3 info fr all my
MP3's. Does anyone know of a site that can provide API info for ID3
tags? or a way to get the info into excel?

Thanks
Chad








Ken Macksey

MP3 ID3 API Calls for excel
 
Hi

I have a freeware mp3 tagwriter OCX that I found that was written for vb5,
but it works great in VBA. Just drop it on a worksheet oer a user .
If you email me, I will send it and a working example workbook to you.

HTH

Ken



Chad Cameron[_3_]

MP3 ID3 API Calls for excel
 
I looked at the link. I used a chunk of the code, but the mp3 file doesn't
update the id3 info. When I step through it appears to work, but when I
open the mp3 the id3 info is the same.
Here is the code:

Sub xWrite()
strFile = Cells(2, 1) 'Filename of mp3
lngFileLen = FileLen(strFile)
intFF = FreeFile
Open strFile For Binary Access Write As intFF
tag.Title = ActiveCell.Offset(0, 3)
tag.Artist = ActiveCell.Offset(0, 4)
tag.Album = ActiveCell.Offset(0, 5)
tag.Year = ActiveCell.Offset(0, 6)
tag.Comment = ActiveCell.Offset(0, 7)
tag.TrackNumber = ActiveCell.Offset(0, 8)
Put intFF, lngFileLen - cRecordLen + 1, tag
Debug.Print tag.Title; 'check if the info is updated
Close intFF
End Sub



"Tim Williams" <saxifrax@pacbell*dot*net wrote in message
...
http://www.vb-fun.de/cgi-bin/loadfra.../tip0106.shtml

(in German but you shouldn't have any problem...)

Tim.


"Chad Cameron" wrote in message
...
Perfect, that is exactly what I need.

Now the next step is once I have all the info listed in columns, how do I
update the file if I change some of the data? Well, I know how to change
it, what is the command to save the .mp3?

TIA,
Greatly appreciated
Chad


"Rob van Gelder" wrote in message
...
I don't know a lot about MP3 tags except that they occupy the last 128
bytes of an mp3.

I did some Google searching and found the offsets. It seems to work.

Type MP3Tag
ID As String * 3
Title As String * 30
Artist As String * 30
Album As String * 30
Year As String * 4
Comment As String * 28
ID3Tag As Byte
TrackNumber As Byte
End Type

Sub test()
Const cRecordLen = 128
Dim strFile As String, lngFileLen As Long
Dim tag As MP3Tag, intFF As Integer

strFile = "C:\MP3\Prodigy - Always Outnumbered Never Outgunned\06 -
Prodigy - Wake Up Call.mp3"
lngFileLen = FileLen(strFile)

intFF = FreeFile
Open strFile For Binary Access Read As intFF

Get intFF, lngFileLen - cRecordLen + 1, tag

If tag.ID = "TAG" Then
Debug.Print tag.Album; Tab; tag.TrackNumber; Tab; tag.Title
End If

Close intFF
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Chad Cameron" wrote in message
...
I am trying to setup a sheet that has filenames, ID3 info fr all my
MP3's. Does anyone know of a site that can provide API info for ID3
tags? or a way to get the info into excel?

Thanks
Chad










Chad Cameron[_3_]

MP3 ID3 API Calls for excel
 
I am wrong, it is not updating the file, it is deleting all the id3 info.
I will have to look deeper into my code.



Myrna Larson

MP3 ID3 API Calls for excel
 
Maybe my arithmetic is off, but for 3 + 90 + 4 + 28 + 2, I get 127 rather than
128. Maybe that is the problem -- off by 1 byte.


On Sun, 19 Dec 2004 18:58:45 +1300, "Rob van Gelder"
wrote:

I don't know a lot about MP3 tags except that they occupy the last 128 bytes
of an mp3.

I did some Google searching and found the offsets. It seems to work.

Type MP3Tag
ID As String * 3
Title As String * 30
Artist As String * 30
Album As String * 30
Year As String * 4
Comment As String * 28
ID3Tag As Byte
TrackNumber As Byte
End Type

Sub test()
Const cRecordLen = 128
Dim strFile As String, lngFileLen As Long
Dim tag As MP3Tag, intFF As Integer

strFile = "C:\MP3\Prodigy - Always Outnumbered Never Outgunned\06 -
Prodigy - Wake Up Call.mp3"
lngFileLen = FileLen(strFile)

intFF = FreeFile
Open strFile For Binary Access Read As intFF

Get intFF, lngFileLen - cRecordLen + 1, tag

If tag.ID = "TAG" Then
Debug.Print tag.Album; Tab; tag.TrackNumber; Tab; tag.Title
End If

Close intFF
End Sub



Myrna Larson

MP3 ID3 API Calls for excel
 
You seem to have left out some critical parts of the code example you were
given.

I don't see where you are (1) defining the structure of the user-defined type
variable, (2) dimensioning the variable tag as that UDT, or (3) setting a
value for cRecordLen. But also see my other post re the length of the tab
record.

On Sun, 19 Dec 2004 13:22:13 -0800, "Chad Cameron" wrote:

I looked at the link. I used a chunk of the code, but the mp3 file doesn't
update the id3 info. When I step through it appears to work, but when I
open the mp3 the id3 info is the same.
Here is the code:

Sub xWrite()
strFile = Cells(2, 1) 'Filename of mp3
lngFileLen = FileLen(strFile)
intFF = FreeFile
Open strFile For Binary Access Write As intFF
tag.Title = ActiveCell.Offset(0, 3)
tag.Artist = ActiveCell.Offset(0, 4)
tag.Album = ActiveCell.Offset(0, 5)
tag.Year = ActiveCell.Offset(0, 6)
tag.Comment = ActiveCell.Offset(0, 7)
tag.TrackNumber = ActiveCell.Offset(0, 8)
Put intFF, lngFileLen - cRecordLen + 1, tag
Debug.Print tag.Title; 'check if the info is updated
Close intFF
End Sub



"Tim Williams" <saxifrax@pacbell*dot*net wrote in message
...
http://www.vb-fun.de/cgi-bin/loadfra.../tip0106.shtml

(in German but you shouldn't have any problem...)

Tim.


"Chad Cameron" wrote in message
...
Perfect, that is exactly what I need.

Now the next step is once I have all the info listed in columns, how do I
update the file if I change some of the data? Well, I know how to change
it, what is the command to save the .mp3?

TIA,
Greatly appreciated
Chad


"Rob van Gelder" wrote in message
...
I don't know a lot about MP3 tags except that they occupy the last 128
bytes of an mp3.

I did some Google searching and found the offsets. It seems to work.

Type MP3Tag
ID As String * 3
Title As String * 30
Artist As String * 30
Album As String * 30
Year As String * 4
Comment As String * 28
ID3Tag As Byte
TrackNumber As Byte
End Type

Sub test()
Const cRecordLen = 128
Dim strFile As String, lngFileLen As Long
Dim tag As MP3Tag, intFF As Integer

strFile = "C:\MP3\Prodigy - Always Outnumbered Never Outgunned\06 -
Prodigy - Wake Up Call.mp3"
lngFileLen = FileLen(strFile)

intFF = FreeFile
Open strFile For Binary Access Read As intFF

Get intFF, lngFileLen - cRecordLen + 1, tag

If tag.ID = "TAG" Then
Debug.Print tag.Album; Tab; tag.TrackNumber; Tab; tag.Title
End If

Close intFF
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Chad Cameron" wrote in message
...
I am trying to setup a sheet that has filenames, ID3 info fr all my
MP3's. Does anyone know of a site that can provide API info for ID3
tags? or a way to get the info into excel?

Thanks
Chad










Chad Cameron[_3_]

MP3 ID3 API Calls for excel
 
Thanks for the reply, All the variable definisions are global and not
shown. I got 127 too, but I assumed that if you start at 1 and go to 128
there are only 127 numbers in between, but that could be a problem.


"Myrna Larson" wrote in message
...
Maybe my arithmetic is off, but for 3 + 90 + 4 + 28 + 2, I get 127 rather
than
128. Maybe that is the problem -- off by 1 byte.


On Sun, 19 Dec 2004 18:58:45 +1300, "Rob van Gelder"
wrote:

I don't know a lot about MP3 tags except that they occupy the last 128
bytes
of an mp3.

I did some Google searching and found the offsets. It seems to work.

Type MP3Tag
ID As String * 3
Title As String * 30
Artist As String * 30
Album As String * 30
Year As String * 4
Comment As String * 28
ID3Tag As Byte
TrackNumber As Byte
End Type

Sub test()
Const cRecordLen = 128
Dim strFile As String, lngFileLen As Long
Dim tag As MP3Tag, intFF As Integer

strFile = "C:\MP3\Prodigy - Always Outnumbered Never Outgunned\06 -
Prodigy - Wake Up Call.mp3"
lngFileLen = FileLen(strFile)

intFF = FreeFile
Open strFile For Binary Access Read As intFF

Get intFF, lngFileLen - cRecordLen + 1, tag

If tag.ID = "TAG" Then
Debug.Print tag.Album; Tab; tag.TrackNumber; Tab; tag.Title
End If

Close intFF
End Sub





Rob van Gelder[_4_]

MP3 ID3 API Calls for excel
 
Hi Myrna.

I discovered the 127 too, which is why I start reading 127 from the end of
the file - even though I said it was 128 from the end of the file.
- cRecordLen + 1

I've never read the API for mpeg so I'm not 100% sure of the structure. I
assumed the OP was after a quick'n'dirty dump util.

Cheers

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Myrna Larson" wrote in message
...
Maybe my arithmetic is off, but for 3 + 90 + 4 + 28 + 2, I get 127 rather
than
128. Maybe that is the problem -- off by 1 byte.


On Sun, 19 Dec 2004 18:58:45 +1300, "Rob van Gelder"
wrote:

I don't know a lot about MP3 tags except that they occupy the last 128
bytes
of an mp3.

I did some Google searching and found the offsets. It seems to work.

Type MP3Tag
ID As String * 3
Title As String * 30
Artist As String * 30
Album As String * 30
Year As String * 4
Comment As String * 28
ID3Tag As Byte
TrackNumber As Byte
End Type

Sub test()
Const cRecordLen = 128
Dim strFile As String, lngFileLen As Long
Dim tag As MP3Tag, intFF As Integer

strFile = "C:\MP3\Prodigy - Always Outnumbered Never Outgunned\06 -
Prodigy - Wake Up Call.mp3"
lngFileLen = FileLen(strFile)

intFF = FreeFile
Open strFile For Binary Access Read As intFF

Get intFF, lngFileLen - cRecordLen + 1, tag

If tag.ID = "TAG" Then
Debug.Print tag.Album; Tab; tag.TrackNumber; Tab; tag.Title
End If

Close intFF
End Sub





Chad Cameron[_3_]

MP3 ID3 API Calls for excel
 
Thanks for everyones help. I figured out my problem. I forgot to set .ID
to "TAG"

Chad




All times are GMT +1. The time now is 06:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com