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
Solved

Classic ASP - How to find length of audio file

Posted on 2013-05-31
8
828 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Can not run ASP pages Windows 10 Edge browser. 5 104
ASP Button to clear text 4 62
Error in query expression 3 48
is this a cms? 8 67
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 …
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/…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

840 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