Solved

Read/Write WMA Tags

Posted on 2006-11-20
9
1,183 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to send memory stream from ics Client To ics server ? 11 169
update joined tables 2 61
IP without any Dots 1 49
Firemonkey Queue list 1 25
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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…

679 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