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
Solved

Read/Write WMA Tags

Posted on 2006-11-20
9
1,181 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
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

860 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