Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 857
  • Last Modified:

Classic ASP - How to find length of audio file

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
lshane
Asked:
lshane
  • 6
  • 2
1 Solution
 
Scott Fell, EE MVEDeveloperCommented:
Did you try looking at soundcloud.com to host your mp3?  I think that can be automated.
0
 
lshaneAuthor Commented:
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
 
Scott Fell, EE MVEDeveloperCommented:
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Scott Fell, EE MVEDeveloperCommented:
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
 
Scott Fell, EE MVEDeveloperCommented:
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
 
Scott Fell, EE MVEDeveloperCommented:
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
 
lshaneAuthor Commented:
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
 
Scott Fell, EE MVEDeveloperCommented:
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now