Solved

How to Read Tags from a WMA File

Posted on 2013-01-04
7
1,276 Views
Last Modified: 2013-01-08
Ok I need specific instruction on how to extract meta data (author,title,duration) from a Windows Media Audio file (.wma).  References I have reviewed involve downloading an SDK ,are several pages long, and extremely complicated.  I just want the metadata from the file and put it into strings.

This is what I tried:

public class MusicID3Tag
    {
        public byte[] TAGID = new byte[3];      //  3
        public byte[] Title = new byte[30];     //  30
        public byte[] Artist = new byte[30];    //  30  
        public byte[] Album = new byte[30];     //  30  
        public byte[] Year = new byte[4];       //  4  
        public byte[] Comment = new byte[30];   //  30  
        public byte[] Genre = new byte[1];      //  1
    }

           strFileName = "C:\\Develop\\Apps\\WQFX\\Music\\MySong.wma";
           //Open the file and read the tags.    
                using (FileStream fs = File.OpenRead( strFileName))
 
            {
                if (fs.Length >= 128)
                {
                     MusicID3Tag tag = new MusicID3Tag();
                    fs.Seek(-128, SeekOrigin.End);
                    fs.Read(tag.TAGID, 0, tag.TAGID.Length);
                    fs.Read(tag.Title, 0, tag.Title.Length);
                    //string theTAGID = Encoding.Default.GetString(tag.TAGID); Error: Encoding not recognized

                    //if (theTAGID.Equals("TAG"))
                    {
                       //string Title = Encoding.Default.GetString(tag.Title);  Error: Encoding not recognized
                       //string Artist = Encoding.Default.GetString(tag.Artist);
                    }

                }

Any help would be appreciated.
0
Comment
Question by:Dovberman
[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
  • 4
  • 2
7 Comments
 
LVL 81

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 100 total points
ID: 38746037
Windows Media Player 9 SDK, others are in the specific windows version SDK
Extracting Metadata from Windows Media Files
0
 

Author Comment

by:Dovberman
ID: 38746207
Thank you, I will try this tomorrow.  Will Windows Media Player work on Windows 7?
0
 

Author Comment

by:Dovberman
ID: 38746741
The proposed solution appears to be a GUI.  I need to programatically read the tags. It apears from other articles that thi is done by a COM object that uses ID3Audio tags. Can you help me here with references?

//string Title = Encoding.Default.GetString(tag.Title);  Error: Encoding not recognized
0
Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

 
LVL 19

Accepted Solution

by:
Manoj Patil earned 400 total points
ID: 38750341
0
 

Author Comment

by:Dovberman
ID: 38752647
TechChallenger1.  The download is a 2005 version of Visual Studio which has conversion issues.  However, I expect it to work. I will contact the author.

Thank you.
0
 
LVL 81

Expert Comment

by:David Johnson, CD, MVP
ID: 38752837
Converted to VS2010 solution
http://sdrv.ms/UwCztf
0
 

Author Comment

by:Dovberman
ID: 38754897
ve3ofa. Thank you.
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

737 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