Solved

Classic ASP - How to find length of audio file

Posted on 2013-05-31
8
823 Views
Last Modified: 2013-05-31
Classic ASP VBScript
iTunes XML

Hello, all.

I am in the process of constructing a dynamic XML podcast feed for iTunes via ASP VBScript.

(Recent help from EE really helped get me started).



Now... one of the properties that iTunes wants in the XML feed is the "Length" of the audio MP3 (In "seconds", I'm concluding, from viewing the large number in the sample).

I am hosting through a shared hosting provider (GoDaddy).


So, the question is... using ASP VBScript... how can I extract/obtain the file Length (In "seconds")???

Thank you!
Shane
0
Comment
Question by:lshane
  • 6
  • 2
8 Comments
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39211277
Did you try looking at soundcloud.com to host your mp3?  I think that can be automated.
0
 

Author Comment

by:lshane
ID: 39211302
Hi, padas.

Well - I created an admin page for the church to upload their audio to play from the church site.  Those are being saved to their database.

That's why I wanted to loop through there to dynamically produce all the XML data I needed - using the data that is already there.

I didn't want them to have to upload the audio twice - to another location (i.e. Soundcloud).
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39211348
What I am suggesting is to  just use a service like soundcloud to host your mp3's.  For one, if you are using a shared server or even low end dedicated server, it could be slow.  Soundcloud and the like are on a cdn meaning if your listener is in California, they are serviced by a server in CA and if in New York, a server in NY.  You only need to upload once.  From there, I believe the proper feed is already taken care of and it is meant for sharing mp3's and sound files.  

Otherwise, the only thing you can figure out automatically is the size of the file.  You can experiment and see if there is a correlation with the size of your files and the length of the recording.  Otherwise, your users should note the length of the recording and add that to your database so you can output to xml.
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39211358
I think I found a solution but not sure yet how to implement with asp.   You can read the first few bits of data and get the info you need.  http://www.codeproject.com/Articles/8295/MPEG-Audio-Frame-Header#XINGHeader
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39211388
Are you using html5?  It looks like we can grab the info from the <audio> tag

http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-duration
0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 39211397
Here it is in javascript http://blog.gingertech.net/wp-content/uploads/2011/01/LCA_MM_AVProc2011/#slide13

Once the sound is uploaded, you can place it in an audio tag and use an ajax call to update the database with the length.

<audio id="audio_event" src="revolve.ogg" controls>
</audio>

<pre id="display_event"></pre>

<script type="text/javascript">
  var audio = document.getElementById("audio_event");
  var display = document.getElementById("display_event");
  lines = [];

  audio.addEventListener("MozAudioAvailable", writeSamples, false);

  function writeSamples (event) {
    lines.push ("Event time: " + event.time + 
                ", Audio time:" + audio.currentTime);
    if (lines.length > 20) lines.shift();
    display.innerHTML = lines.join('<br>');
  }
</script>

Open in new window


Another version http://codetheory.in/get-the-duration-of-an-audio-or-video-file-in-javascript/
0
 

Author Closing Comment

by:lshane
ID: 39211734
Thank you, padas.


Should I open a new post regarding the last thread you helped me with:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/ASP/Q_28142427.html


I submitted the feed URL to iTunes, but it does not appear to be picking up the ASP.
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39212298
Sure.  Make sure you post a) what the static xml should look like b) sample data  c) your code

http://sscce.org/
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 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

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now