Solved

Classic ASP - How to find length of audio file

Posted on 2013-05-31
8
839 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
[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
  • 6
  • 2
8 Comments
 
LVL 53

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 53

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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 53

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
 
LVL 53

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 53

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 53

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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

635 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