Link to home
Start Free TrialLog in
Avatar of mopar003
mopar003

asked on

Determining the length of an Audio File (mp3, wav, etc) via ASP

Don't know if this is possible or not, but I need to find out the length of an audio file on the server.  I can get size and dimension of a JPEG, so maybe there is something out there that will do the same for an audio file.  Any thoughts?
Avatar of CCongdon
CCongdon
Flag of United States of America image

<%
dim filesys, filename, f
Set filesys = CreateObject("Scripting.FileSystemObject")
filename = Server.MapPath("filename.mp3")
Set f = filesys.GetFile(filename)
Response.Write(f.size & " bytes")
%>
Woops, that's won't work in ASP.  Try this instead:

<%
dim filesys, filename, f
Set filesys = Server.CreateObject("Scripting.FileSystemObject")
filename = Server.MapPath("filename.mp3")
Set f = filesys.GetFile(filename)
Response.Write(f.size & " bytes")
%>

Avatar of mopar003
mopar003

ASKER

I need to find the actual audio length in Minutes, seconds.  Not the file size itself.

@CCongdon

That will get the size of the file, but not the length(ie 2:27 seconds of audio).
ASKER CERTIFIED SOLUTION
Avatar of CCongdon
CCongdon
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It's possible to not add the actual iTunes application, but merely an SDK to your system.

http://developer.apple.com/sdk/itunescomsdk.html
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forced accept.

Computer101
EE Admin