Solved

Read/Write WMA Tags

Posted on 2006-11-20
9
1,188 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 9

Expert Comment

by:bernani
ID: 17983375

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
ID: 17983392
Sorry, forgot to check before posting.

It's the AusioTols library :(
0
 
LVL 9

Accepted Solution

by:
bernani earned 250 total points
ID: 17984133
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 16

Assisted Solution

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

http://blogs.msdn.com/tims/articles/100730.aspx
0
 
LVL 1

Author Comment

by:mwbowman
ID: 18001387
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
ID: 18001705
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
ID: 18010161

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
ID: 21135804
Forced accept.

Computer101
EE Admin
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses
Course of the Month9 days, 11 hours left to enroll

624 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