hi..
You will need Taglib - Sharp Library for this purpose .
For Complete understanding and project Download Go to: [snipped]
hi..
You will need Taglib - Sharp Library for this purpose .
For Complete understanding and project Download Go to: [snipped]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using TagLib;
namespace TagReadermp3
{
public partial class frmTagReader : Form
{
public frmTagReader()
{
InitializeComponent();
}
private void btnSelect_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Mp3 Files | *.mp3";
if (ofd.ShowDialog() == DialogResult.OK)
{
lblFile.Text = ofd.FileName;
}
}
private void btnRead_Click(object sender, EventArgs e)
{
TagLib.File mp3 = TagLib.File.Create(lblFile.Text);
lblAlbum.Text = mp3.Tag.Album;
lblAritst.Text = GetAllStringsFromArrary(mp3.Tag.AlbumArtists,","); // Tag.AlbumAritst is a string array
lblBitsPerMinute.Text = mp3.Tag.BeatsPerMinute.ToString();
lblComposers.Text = GetAllStringsFromArrary(mp3.Tag.Composers,",");
lblCopyright.Text = mp3.Tag.Copyright;
lblGenre.Text = GetAllStringsFromArrary(mp3.Tag.Genres,",");
lblTitle.Text = mp3.Tag.Title;
lblTrack.Text = mp3.Tag.Track.ToString();
lblYear.Text = mp3.Tag.Year.ToString();
}
public string GetAllStringsFromArrary(string[] strArray,string strDelimeter)
{
string strFinal = string.Empty;
for (int i = 0; i < strArray.Length ; i++)
{
strFinal += strArray[i];
if (i != strArray.Length - 1)
{
strFinal += strDelimeter;
}
}
return strFinal;
}
}
}
Thank YOU! I was looking for this for a long time, does it do tag editing too?
yes it does.. explore the library a bit you will find a Save method there ..
If you need to understand how MP3 tagging works, take a look at this post:
http://www.codeproject.com/KB/vb/mp3id3v1.aspx
Basically, MP3 tagging is implemented by adding this data to the final of the MP3 file, the last 128 bits of MP3 files represent this data.
u can find length like below
string strlength = mp3.Properties.Duration.ToString();
Excellent. I was going to make something alike MP3-TagIt, because they stopped developing it. It was the best Tag-manager i've ever used, too bad it's gone now but i can start building an alternative now ^^ so thanks again! this is of great use.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.