?
Solved

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

Posted on 2007-11-20
9
Medium Priority
?
1,255 Views
Last Modified: 2012-05-05
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?
0
Comment
Question by:mopar003
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 9

Expert Comment

by:CCongdon
ID: 20322169
<%
dim filesys, filename, f
Set filesys = CreateObject("Scripting.FileSystemObject")
filename = Server.MapPath("filename.mp3")
Set f = filesys.GetFile(filename)
Response.Write(f.size & " bytes")
%>
0
 
LVL 9

Expert Comment

by:CCongdon
ID: 20322177
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")
%>

0
 
LVL 1

Author Comment

by:mopar003
ID: 20322194
I need to find the actual audio length in Minutes, seconds.  Not the file size itself.

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 18

Expert Comment

by:Morcalavin
ID: 20322198
@CCongdon

That will get the size of the file, but not the length(ie 2:27 seconds of audio).
0
 
LVL 9

Accepted Solution

by:
CCongdon earned 1000 total points
ID: 20322283
Woops, sorry. My brain started thinking size. I re-read the question and I see it clearly says length.

Are you adverse to installing a DLL or application on your system?

I came across these two articles on the 'net.

http://www.g6ftpserver.com/forum/index.php?showtopic=1161&pid=7076&mode=threaded&start=

This one on microsoft's page is a little more extensive (and requires iTunes!)

http://www.microsoft.com/technet/scriptcenter/funzone/tunes.mspx
0
 
LVL 9

Expert Comment

by:CCongdon
ID: 20322297
It's possible to not add the actual iTunes application, but merely an SDK to your system.

http://developer.apple.com/sdk/itunescomsdk.html
0
 
LVL 18

Assisted Solution

by:Morcalavin
Morcalavin earned 1000 total points
ID: 20411569
You can use SoX windows binary to do the wavs.  You would have to run a  wshell in asp to run the .exe.



Unfortunately, you the windows version doesn't support mp3 in the binary(you'd have to compile it yourself to enable mp3 support).  However, http://www.nabble.com/Getting-SoX-to-See-Lame-in-Windows-t4305851.html details converting mp3 -> wav in order to get the length.
C:\Documents and Settings\My Documents>sox file.wav -e stat
Samples read:             50400
Length (seconds):      2.285714
Scaled by:         2147483647.0
Maximum amplitude:     0.847046
Minimum amplitude:    -0.889740
Midline amplitude:    -0.021347
Mean    norm:          0.096549
Mean    amplitude:    -0.000049
RMS     amplitude:     0.182658
Maximum delta:         1.250366
Minimum delta:         0.000000
Mean    delta:         0.107366
RMS     delta:         0.199797
Rough   frequency:         1919
Volume adjustment:        1.124

Open in new window

0
 
LVL 1

Expert Comment

by:Computer101
ID: 21135895
Forced accept.

Computer101
EE Admin
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question