Advertisement

02.26.2008 at 07:21AM PST, ID: 23193746
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

how to get the duration of the song in a mp3 file

Tags: delphi
I want to extract the duration of the music in a mp3 file without having to play the entire file, just like Windows explorer does.

I am developing with Delphi 6 and Windows XP

Thanks for any Help
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: titcher
Solution Provided By: rfwoolf
Participating Experts: 3
Solution Grade: B
Views: 35
Translate:
Loading Advertisement...
02.26.2008 at 09:26PM PST, ID: 20991580

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.26.2008 at 10:09PM PST, ID: 20991742

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.26.2008 at 10:10PM PST, ID: 20991747

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.26.2008 at 10:19PM PST, ID: 20991788

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.27.2008 at 12:04AM PST, ID: 20992164

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.27.2008 at 12:05AM PST, ID: 20992169

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.27.2008 at 12:13AM PST, ID: 20992210

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.27.2008 at 12:18AM PST, ID: 20992231

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.27.2008 at 06:28AM PST, ID: 20994182

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.17.2008 at 06:49PM PDT, ID: 21147864

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.08.2008 at 09:55AM PDT, ID: 21307211

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
02.26.2008 at 09:26PM PST, ID: 20991580
titcher,
We have sent a message to some of our more experienced Experts asking them to review your question, and will check back again to see if you are getting the help you need. I also added a zone to your question.

Please do not respond to this comment or post another request; we are monitoring the notifications from your question for activity from the Experts.

Thank you for using Experts Exchange,

ForestDenizen
Community Support Moderator
http://www.experts-exchange.com/Q_23195906.html
 
02.26.2008 at 10:09PM PST, ID: 20991742

Rank: Guru

Hi titcher.

I'm afraid I don't yet have any simple code for you, but there are a few resources that can technically do the job.
So I want to know if you'll accept 3rd party resources?

Here are some resources for you to look at:

0. Here is some C code that you can translate that is BASED ON the Windows Media Player SDK which an easily output the duration of an mp3 or wma file.
http://web.archive.org/web/20040405003445/http://msdn.microsoft.com/library/en-us/dncodefun/html/code4fun01242003.asp

1. XAudio VCL component
Component available from:

http://web.archive.org/web/20040629203345/http://www.cs.ucl.ac.uk/students/S.Lau/delphi001.htm

To distribute an application using this component, you have to buy a license.

2. IF YOU HAVE THE FILESIZE AND BITRATE (doesn't work for Variable Bitrate (VBR) files)
SOURCE: http://www.delphipages.com/threads/thread.cfm?ID=64252&G=64221
QUOTE:
If you have the bitrate and the filesize AND the file is not a variable bit rate (vbr) file, then you simply divide the filesize by the byterate (that's bitrate/8) and you get an approximate playtime in seconds (+-1s, 'cause we didn't compensate for the frame headers):
function GetPlayLength(FileSize, BitRate: integer): integer;
begin
 Result:= round(FileSize / (BitRate shr 3));
end;

procedure TForm1.Button1Click(Sender: TObject);
begin                            //Bitrate FileSize
 caption:= inttostr(GetPlayLength(128000, 4368620));
end;

3. MP3Info v.1.0 component from Torry.net [Freeware, Source Included]
(This will help you calculate the length by calculation)
http://www.torry.net/authorsmore.php?id=3556
"By TRIDENT-Soft. Component which reads information about MPEG version, layer, bitrate and sample frequency from a MP3 file."
Accepted Solution
 
02.26.2008 at 10:10PM PST, ID: 20991747

Rank: Guru

0. Correction: The code is probably Visual Basic, very similar to pascal. Not C
 
02.26.2008 at 10:19PM PST, ID: 20991788

Rank: Guru

Wait, try this component for delphi, is probably the best bet so far...
http://www.cobans.net/mp3info.php
 
02.27.2008 at 12:04AM PST, ID: 20992164

Rank: Sage

it might be a long shot for you, but you could try to use dspack from progdigy.com
it's a delphi conversion of th directshow api.
I don't know what you want to do so if all you want is getting the duration and nothing else, this might eb a little to much, but it's worth trying, since if you want more, you can actually do almost everything in respect to playing/converting/etc.
 
02.27.2008 at 12:05AM PST, ID: 20992169

Rank: Sage

oh, and I forgot to mention: this wil work not just for mp3 files, but with anything that has directshow filters installed. (including video)
 
02.27.2008 at 12:13AM PST, ID: 20992210

Rank: Guru

yes it's worth adding that once you get the file into your app and you start playing it, it's pretty darn easy to calculate the duration based on the elapse. I can find a link to that if you like
 
02.27.2008 at 12:18AM PST, ID: 20992231

Rank: Sage

let me help you with that link: http://www.ciuly.com/delphi/multimedia/index.html :)
dspack and MCI solutions are there. thought they might need a little work in order to get the time (it's been a while, I don't rememvber what's in them), bu that is easy as 1-2 maybe 3 lines of code which I can provide if needed
 
02.27.2008 at 06:28AM PST, ID: 20994182

Rank: Guru

I've uploaded here a full source working example :
http://www.sendspace.com/file/7z5y0s

It can retrieve any kind of info from the mp3 file and length also...

Hope this helps.
 
03.17.2008 at 06:49PM PDT, ID: 21147864
Dear Experts,

Thanks for your help. I understood that if I want to get the duration of a song in a mp3 file, i have to first get the bitrate and the frame size. To get these info I have to first find the exact location of the tag in the header of the mp3. And to do that I have to deal with unsyncsafe numbers and find the offset of the first frame. I learned a lot with Jurgen Faul's TMPEGAudio component (http://mac.sourceforge.net/). The best audio component i tested from all the resources you gave me. Now I can handle the majority of my mp3 files.

But there are some files that i just cant find the exact location of the tag in the header.

The attached file is a mp3 file (renamed to txt). Winamp reports to find the tag at byte 33860 which seems to be the exact position. But with all the knowledge i learned from here i calculate the position at byte 33604. What am I missing?

Windows explorer also can handle it well.

 
mp3 file with intriguing header
 
 
04.08.2008 at 09:55AM PDT, ID: 21307211

Rank: Sage

I'm sorry, but I have to disagree (again).
your comment is by far not the answer. I understand that you want to do it "by hand" but you were given more than one working solutions for your problem.
It's not our fault that you ignored them (because yes, when you don't say anything about a suggestion, it is called that you ignred that suggestion).
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628