?
Solved

How to Read Tags from a WMA File

Posted on 2013-01-04
7
Medium Priority
?
1,306 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 82

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 300 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 19

Accepted Solution

by:
Manoj Patil earned 1200 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 82

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

Independent Software Vendors: 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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

762 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