Solved

Read/Write WMA Tags

Posted on 2006-11-20
9
1,179 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Newbie Thread Programming 1 152
Delphi selector screen 2 79
Firemonkey android show image from resource ? 1 42
MS Access from Delphi 31 29
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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

777 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