I came across a similar issue not too long ago and had a look around. The simplest and most effective method (in my opinion) is to use the exec command in order to extra media information.
I based my code on a forum post over at longtailvideo http://www.longtailvideo.com/support/forums/jw-player/setup-issues-and-embedding/9448/how-to-get-video-duration-with-ffmpeg-and-php
<?php
$videofile="/var/video/user_videos/partofvideo.avi";
ob_start();
passthru("/usr/bin/ffmpeg -i \"{$videofile}\" 2>&1");
$duration = ob_get_contents();
ob_end_clean();
$search='/Duration: (.*?),/';
$duration=preg_match($search, $duration, $matches, PREG_OFFSET_CAPTURE, 3);
echo $matches[1][0]; <-- Duration
?>
This script can handle anything ffmpeg is prepared to handle (which is a lot!) I know the above example illustrates a video file but, it will work fine with audio also
getID3()
- I have had great success with this library in the past for various types of media tags. – Spiller