<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ColdFused? &#187; mp3</title>
	<atom:link href="http://www.rupeshk.org/blog/index.php/tag/mp3/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rupeshk.org/blog</link>
	<description>My Views on ColdFusion, Java and related technologies</description>
	<lastBuildDate>Fri, 19 Nov 2010 14:22:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Reading MP3 meta-data from ColdFusion</title>
		<link>http://www.rupeshk.org/blog/index.php/2008/02/reading-mp3-meta-data-from-coldfusion/</link>
		<comments>http://www.rupeshk.org/blog/index.php/2008/02/reading-mp3-meta-data-from-coldfusion/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 20:33:00 +0000</pubDate>
		<dc:creator>Rupesh Kumar</dc:creator>
				<category><![CDATA[coldfusion]]></category>
		<category><![CDATA[mp3]]></category>

		<guid isPermaLink="false">http://rupesh106.wordpress.com/2008/02/18/reading-mp3-meta-data-from-coldfusion/</guid>
		<description><![CDATA[On friday I posted about how to read the meta-data for Swf (flash) file from ColdFusion and on the same note, I think it will be cool to read the meta-data for MP3 file as well. Here is the specification for MP3 header and it is fairly straight forward to read the header using the [...]]]></description>
			<content:encoded><![CDATA[<p>On friday I posted about how to <a href="http://coldfused.blogspot.com/2008/02/reading-flash-swf-metadata-from.html">read the meta-data for Swf (flash) file from ColdFusion</a> and on the same note, I think it will be cool to read the meta-data for MP3 file as well. <a href="http://www.dv.co.yu/mpgscript/mpeghdr.htm">Here</a> is the specification for MP3 header and it is fairly straight forward to read the header using the spec.</p>
<p>ColdFusion 8 knows how to read MP3 file and it can provide a set of meta-data for it. Though this functionality is not exposed via any tag or function, you can still use it. The meta-data it provides are</p>
<ul>
<li>Bit Rate : in kbps</li>
<li>Frequency : in Hz</li>
<li>Play duration : in second</li>
<li>Version : integer
<ul>
<li>
<ul>
<li>0 &#8211; MPEG version 2.5</li>
<li>1 &#8211; MPEG version 2</li>
<li>3 &#8211; MPEG version 1</li>
</ul>
</li>
</ul>
</li>
<li>Copy Right : true/false</li>
<li>Channel mode : integer
<ul>
<li>
<ul>
<li>0 &#8211; Stereo</li>
<li>1 &#8211; Joint Stereo</li>
<li>2 &#8211; Dual Channel</li>
<li>3 &#8211; Mono or Single Channel</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>Here is an example code.</p>

<div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> mp3File <span style="color: #0000FF;">=</span> <span style="color: #800080; font-weight: bold;">createObject</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;java&quot;</span>, <span style="color: #009900;">&quot;coldfusion.util.MP3File&quot;</span><span style="color: #0000FF;">&#41;</span>.init<span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;C:<span style="color: #009900;">\m</span>usic.mp3&quot;</span><span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfoutput</span><span style="color: #0000FF;">&gt;</span></span>mp3File.getBitRate() : <span style="color: #0000FF;">#mp3File.getBitRate<span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span>#</span> kbps<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfoutput</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfoutput</span><span style="color: #0000FF;">&gt;</span></span>mp3File.getFrequency() : <span style="color: #0000FF;">#mp3File.getFrequency<span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span>#</span> Hz<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfoutput</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfoutput</span><span style="color: #0000FF;">&gt;</span></span>mp3File.getVersion() : <span style="color: #0000FF;">#mp3File.getVersion<span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span>#</span><span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfoutput</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfoutput</span><span style="color: #0000FF;">&gt;</span></span>mp3File.getDuration() : <span style="color: #0000FF;">#mp3File.getDuration<span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span>#</span>Sec<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfoutput</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfoutput</span><span style="color: #0000FF;">&gt;</span></span>mp3File.isCopyRighted() : <span style="color: #0000FF;">#mp3File.isCopyRighted<span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span>#</span><span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfoutput</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfoutput</span><span style="color: #0000FF;">&gt;</span></span>mp3File.getChannelMode() : <span style="color: #0000FF;">#mp3File.getChannelMode<span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span>#</span><span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfoutput</span><span style="color: #0000FF;">&gt;</span></span></pre></div></div>

<p>Though you can use the above mentioned class (coldfusion.util.MP3File) without any problem, you must keep it in mind that it is unsupported and *might* change in future. Just a disclaimer !!! <img src='http://www.rupeshk.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>This class does not get you the ID3V1 or <a href="http://www.id3.org/id3v2.3.0">ID3V2</a> meta-data, but it should be easy for you to do it. For ID3V1, all you need to do is to read the last 128 bytes of the mp3 file and you have all the information required. Reading ID3V2 tag is little more involved and there are a number of open source java libraries available (common one being <a href="http://javamusictag.sourceforge.net/">jidlib</a> and <a href="http://www.jthink.net/jaudiotagger/index.jsp">jaudiotagger</a>) which can be used.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rupeshk.org/blog/index.php/2008/02/reading-mp3-meta-data-from-coldfusion/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

