Solved

Classic ASP - How to find length of audio file

Posted on 2013-05-31
8
813 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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 information …
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

758 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

19 Experts available now in Live!

Get 1:1 Help Now