🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #15626

Re: mp3 database

#15626
From: StoVoKar
Date: Sat, 02 Sep 2000 10:16
156 lines
6649 bytes
Here's another useful Visual Basic tip from Element K Journals,
your number one source for software tips and techniques.

********** SPONSOR **********

IMPORTANT: www.OfficeRecovery.com presents data recovery tools
for Excel spreadsheets, Word documents, PowerPoint presentations!
Get your FREE demo, click here: http://www.OfficeRecovery.com

********** THE TIP **********

Deciphering MP3 Tag information with Visual Basic

The Windows Media Player provides an easy, quick way to drop MP3
capability into a Visual Basic application. However, once you have
an MP3, you may have wondered how to read information about the song,
such as the song title and artist's name. If the MP3 file uses the
most popular tag encryption, ID3, then you're in luck. This standard
stores the Tag information in the last 128 bytes of the file
(Tag:3, Title:30, Artist:30, Album:30, Year:4, Comment:30, Genre:1)

To read this information, first open the MP3 file and grab the last
128 bytes. With ID3, the first three slots hold the string TAG if the
file actually contains information. If the file does contain Tag
information, store the last 128 bytes in a custom variable. After that,
cycle through the MP3 file, extracting information as you go. The
following procedure shows the code that extracts this information as
well as creates several important variables to use later on:

Option Explicit
Private Type TagInfo
    Tag As String * 3
    Songname As String * 30
    artist As String * 30
    album As String * 30
    year As String * 4
    comment As String * 30
    genre As String * 1
End Type

Dim FileName As String
Dim CurrentTag As TagInfo

Private Sub Form1_Load()
Dim temp As String
On Error Resume Next

FileName = App.Path & "\myMP3.mp3"
Open FileName For Binary As #1
With CurrentTag
    Get #1, FileLen(FileName) - 127, .Tag
    If Not .Tag = "TAG" Then
        label8.Caption = "No tag"
        Close #1
        Exit Sub
    End If
    Get #1, , .Songname
    Get #1, , .artist
    Get #1, , .album
    Get #1, , .year
    Get #1, , .comment
    Get #1, , .genre
    Close #1

    txtTitle = RTrim(.Songname)
    txtArtist = RTrim(.artist)
    txtAlbum = RTrim(.album)
    txtYear = RTrim(.year)
    txtComment = RTrim(.comment)

    Temp = RTrim(.genre)
    txtGenreCode = Asc(Temp)
    Combo1.ListIndex = CInt(txtGenreCode) - 1
End With
End Sub

Notice that the code has to handle the genre character a little
differently. That's because ID3 stores this data as a single ASCII
character. To match up the actual number with its corresponding
description--say contained in a combobox--the procedure converts the
ASCII to a number, and then looks up that number in the combobox.

********** TRY US FREE! ***********

If you like this tip, you'll love Element K Journals' Inside Visual Basic.

For a FREE issue of Inside Visual Basic go to
https://secure.elementkjournals.com/ivb/cb2001.htm

Each issue of Inside Visual Basic offers a constant flow of fresh
ideas, shortcuts, and advice from software experts who explore
every aspect of Visual Basic for Windows. Discover timesaving
strategies and practical solutions to all of your computing
questions through in-depth articles covering complex techniques
and valuable quick tips. Free issue offer valid in United States
only.

********** NEED TO KNOW MORE? **********

Visit http://www.elementkjournals.com/ivb to see what's new in this
month's issue of Inside Visual Basic.

********** SPECIAL OFFER **********

The fastest and easiest reference tool -For only $19.95

Just In - The Best of ZD Journals' Web and Programming
Department's Tips, Techniques and FAQ links. This CD is packed
with the best from Active Server Developers Journal, Automating
Office with VBA, Inside Microsoft FrontPage, Inside the Internet,
Inside Visual Basic and Microsoft Web Builder.

Order Now!

https://secure.elementkjournals.com/4061/cdb2001.htm

********** SUBMIT A TIP! **********

Do you have a shortcut or technique that's tip worthy? If so, send
it to visual_basic@elementkjournals.com.

If we use your submission, we'll include your name and email or Web
address, along with the tip.

********** SERVICES **********

You can unsubscribe from a particular tip (or tips) list at
http://www.elementkjournals.com/zdtips/unsub

This weekly tip is delivered to you as a free service from
Element K Journals. http://www.elementktips.com

*******************************************************************
Copyright (C) 2000 Element K Content LLC. All rights reserved.
Reproduction in whole or in part in any form or medium without
express written permission of Element K Content LLC is prohibited.
Element K is a service mark of Element K LLC.

"Liessens" <llfvdh@village.uunet.be> wrote in message
news:39b00605$0$22991$73bec57d@news.be.uu.net...
> Questie van alles een beetje bij te houden en te onrdenen zou ik
> een mp3 database willen maken van alle MP3s op mijn hd.
> Ik heb echter geen flauw idee hoe ik die mp3-tags (gegevens die
> in mp3-bestand zitten zoals lengte, artiest, nummer, album,
> etc.,) en filename, path moet lezen ?
> Moet ik hiervoor ook programmeren in vb. C++ of is dit
> uitsluitend met een database-programma als Access / StarBase te
> doen ?
>
> Wie o wie heeft voor mij goede raad ?
>
> Alle hulp welkom ...
>
> Benoit
>
>
Technical Details
Message-ID: <rs4s5.66114$DJ4.601058@afrodite.telenet-ops.be>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-east!supernews.com!feeder.qis.net!europa.netcrusader.net!194.176.220.129!newsfeed.icl.net!newsfeed00.sul.t-online.de!t-online.de!newsfeeds.belnet.be!news.belnet.be!afrodite.telenet-ops.be!not-for-mail
References: <39b00605$0$22991$73bec57d@news.be.uu.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 107324,5bcd3bf1fceb58fa
X-Google-Attributes: gid107324,public
X-Google-Thread: fcea4,5bcd3bf1fceb58fa
X-Google-Attributes: gidfcea4,public
X-Google-ArrivalTime: 2000-09-02 03:17:27 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-east!supernews.com!feeder.qis.net!europa.netcrusader.net!194.176.220.129!newsfeed.icl.net!newsfeed00.sul.t-online.de!t-online.de!newsfeeds.belnet.be!news.belnet.be!afrodite.telenet-ops.be!not-for-mail
Reply-To: "StoVoKar" <StoVoKar@yahoo.com>
From: "StoVoKar" <StoVoKar@yahoo.com>
Newsgroups: be.comp.programming,nl.comp.programmeren
References: <39b00605$0$22991$73bec57d@news.be.uu.net>
Subject: Re: mp3 database
Lines: 158
Organization: STEM OOK www.nolimit.nu
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Message-ID: <rs4s5.66114$DJ4.601058@afrodite.telenet-ops.be>
Date: Sat, 02 Sep 2000 10:16:55 GMT
NNTP-Posting-Host: 212.123.3.127
X-Trace: afrodite.telenet-ops.be 967889815 212.123.3.127 (Sat, 02 Sep 2000 12:16:55 MET DST)
NNTP-Posting-Date: Sat, 02 Sep 2000 12:16:55 MET DST