Solved

Read/Write WMA Tags

Posted on 2006-11-20
9
1,172 Views
Last Modified: 2008-03-15
Hi All,

I'm looking for some source code that will allow me to read and write Windows Media Audio (WMA) tags to existing files.

I've already tried TWMFile from the Audio Tools Library, but it only supports up to Windows Media Audio 8 and doesn't return all of the tags, or support writing.

The BassWM add-on for the BASS library will read, I'm looking for something more "light weight" and the WMAReader does not seem to support Delphi 5, which I am currently using.

Yeah, I know I should upgrade, but why fix it when it ain't broke!

Months of searching still has come up empty, so hopefully someone here will be able to provide a few options...

Thanks!

Mark
0
Comment
Question by:mwbowman
9 Comments
 
LVL 9

Expert Comment

by:bernani
Comment Utility

Hi,

Did you already test this one:

TWMAfile Class v.1.0      FWS       9 k       06 May 2002
By J. Faul. For extracting information from WMAfile file header. File info: file size, channel mode, sample rate, duration, bit rate. WMA tag info: title, artist, album, track, year, genre, comment.
 
Fully functional
Source: Included
Download: D3 D4 D5 D6 : http://www.torry.ru/vcl/mmedia/audio/wmafile.zip




0
 
LVL 9

Expert Comment

by:bernani
Comment Utility
Sorry, forgot to check before posting.

It's the AusioTols library :(
0
 
LVL 9

Accepted Solution

by:
bernani earned 250 total points
Comment Utility
Hi,

See this page (maybe you know it) :

http://www.un4seen.com/forum/?action=printpage;topic=2329.0

A topic started since 2004 - Last Post September 2006

You'll read


to read/write WMA Tag Infos do the following
Code:

// read

procedure ReadWMAFile;
var
  TagsData: PTagsData;
begin
   New(TagsData);
   try
      OpenWMAFile(FileName, TagsData);
      //now  read the TagsData Infos
     // Example
       edit1.Text := DurationToStr(TagsData.Duration, true) + ' sec ';
   finally
     Dispose(TagsData);  
end;

Code:

 // write the Data

procedure TTagEdit.WriteWMAFile;
var
  TagsData: PTagsData;
begin
  New(TagsData);
  try
    TagsData.Encoder := edEncoded2.Text;
    TagsData.Genre := cbGenre2.Text;
    TagsData.Author := edArtist2.Text;
    TagsData.Composer := edComposer2.Text;
    TagsData.Title := edTitel2.Text;
    TagsData.Album := edAlbum2.Text;
    TagsData.Year := edYear2.Text;
    TagsData.Track := edTrack2.Text;
    TagsData.Url := edUrl2.Text;
    TagsData.Comments := edComment2.Text;
    TagsData.Lyrics := edLyrics2.Text;
    TagsData.CopyRight := edCopyright2.Text;

    SaveWMAFile(TagsData);
  finally
    Dispose(TagsData);
  end;
end;

There is a zip here (not tested)

Http://www.cst-development.de/downloads/Wma_Tag_Writer.zip

Maye it can be a step to what you're asking for.

By the way, when you're talking about Audio Tools Library, is it really the link I gave (by mistake) above ?

Thanks
 


0
 
LVL 16

Assisted Solution

by:CodedK
CodedK earned 250 total points
Comment Utility
Read this article, maybe you'll find it usefull :

http://blogs.msdn.com/tims/articles/100730.aspx
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Comment

by:mwbowman
Comment Utility
bernani

I believe your suggestion requires the BASS Library, which I'm not interested in using as indicated in my original post.  But I'm going to have a look at it to see if it can be adapted using non-BASS code.

CodedK

Your suggestion involves C language, which I myself can't convert to Delphi.  But if you can get them working the 500 points will be yours!
0
 
LVL 9

Expert Comment

by:bernani
Comment Utility
Hi,

I believe your suggestion requires the BASS Library ...

I don't believe. I can run the demo project from the zip without any dll.

See in the header WMATagWriter pas

{
  MetaData Example
    Loading & Editing Wma File Tags

    Available Fields:
    ================

    Encoder, Genre, Author, Title, Album, Composer,
    Url, Track, Year, CopyRight, Comments, Lyrics.

    Read Only Fields: Version, Duration, BitRate, FileSize, VBR.

    (C) 2004 Copyright Philip Hadar - Israel
        Philip@EverX.co.il
        WWW.EverX.co.il

   modifications / Delphi-Header by Chris Trösken
   Credits goes to Harold Oudshoorn for fixing that it will work fine under WMA-Codec 10

   (No MetaData.DLL is needed)
}

0
 
LVL 9

Expert Comment

by:bernani
Comment Utility

Hi,

I've done some more usng the unit WMAReader.pas and Delphi 6 & 7.

The demo project is fully functionnal, no need of external DLL. I can read wma.files with no problem and I can change and save the tags and reload them.

The only DLL loaded is wmvcore.dll.

For Delphi 5,

  // Vars for the integer Part
  nVal: integer;

  // Vars for the int64/QWORD Part
  nVal_Int64: int64;
  P_Int64: Pint64;
  // Vars for the DWORD Part
  nVal_Car: Cardinal;
  P_Car: PCardinal;   -----> PCardinal returns a "Undefined identificator".

and the assignment

      if pType = WMT_TYPE_DWORD then
      begin
        P_Car := PCardinal(PValue);   ---------> generates (logically) an error message "Pointer type required".
        nVal_Car := P_Car^;

so you need to declare

type

...
    VBR: Boolean;
  end;
  PTagsData = ^TTagsData;
  PCardinal = ^Cardinal;            <-------------- add this

and in the main unit of the demo, there is a line:

      Audio_Info.Lines[3] := 'VBR : ' + booltostr(TagsData.VBR, true);

calling a booltostr with 2 param. Not declared. Uncomment the line and the demo works also in D5. I let you declare and guess the implementation of booltostr with TagsData.VBR : Boolean. I've no idea for the moment.


 

0
 
LVL 1

Expert Comment

by:Computer101
Comment Utility
Forced accept.

Computer101
EE Admin
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now