<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>blog.humaneguitarist.org &#187; HTML5</title>
	<atom:link href="http://blog.humaneguitarist.org/tag/html-5/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.humaneguitarist.org</link>
	<description>discoveries in digital audio, music notation, and information encoding</description>
	<lastBuildDate>Tue, 07 Feb 2012 03:33:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>jAUs 3-D: no glasses required</title>
		<link>http://blog.humaneguitarist.org/2012/01/11/jaus-3-d-no-glasses-required/</link>
		<comments>http://blog.humaneguitarist.org/2012/01/11/jaus-3-d-no-glasses-required/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 00:55:57 +0000</pubDate>
		<dc:creator>nitin</dc:creator>
				<category><![CDATA[digital audio]]></category>
		<category><![CDATA[audio tag]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[jAUs]]></category>
		<category><![CDATA[streaming media]]></category>

		<guid isPermaLink="false">http://blog.humaneguitarist.org/?p=3916</guid>
		<description><![CDATA[So, I am slightly obsessive compulsive. I worked a little more tonight on this jAUs thing to add support for start and stop time attributes in the HTML5 &#60;audio&#62; tag. Video should work, too, with a little work, but I don&#39;t care about that right now. What I did tonight was make it so that [...]]]></description>
			<content:encoded><![CDATA[<p>So, I am slightly obsessive compulsive.</p>
<p>I worked a little more tonight on this jAUs thing to add support for start and stop time attributes in the HTML5 &lt;audio&gt; tag.</p>
<p>Video should work, too, with a little work, but I don&#39;t care about that right now.</p>
<p>What I did tonight was make it so that if a &quot;stopTime&quot; attribute is used, then after that point is reached the player will move the scrubber back to the original &quot;startTime&quot; value though at that point the playback is already paused.</p>
<p>If there is no &quot;stopTime&quot; attribute, then after the file&#39;s played itself to the end, the scrubber will move back to the &quot;startTime&quot; value. Again, playback is already paused at that point.</p>
<p>I&#39;ve tested this with Firefox 9.01, Internet Explorer 9, Safari 4.0.5, Opera 11.60, and Chrome 16.0.912.75 on my Windows 7 (32-bit) laptop.</p>
<p>Running everything from my desktop, I had no problems except that I should mention that if I used the &quot;autoplay&quot; attribute and set it to &quot;true&quot;, Chrome didn&#39;t start the playback as it should, but it seems that maybe that&#39;s a Chrome problem that <a href="http://www.google.com/support/forum/p/Chrome/thread?tid=6636ce31ccd9b4e7&amp;hl=en ">others are having</a>, too.</p>
<p>Testing with the files uploaded to my hosted account was a different story. Opera seemed to need a page refresh before the scrubber would locate itself at the proper positions &#8211; though adding a <a href="http://blog.humaneguitarist.org/2012/01/09/jaus-trying-to-add-a-starttime-attribute-to-the-audio-tag">pesky alert()</a> at the beginning seemed to make Opera happy. Chrome and Safari seemed to take a few seconds to get situated, although they seemed to generally need a restart to move the scrubber to the right place for the last audio player. I didn&#39;t test the alert() thing for these two. Firefox did well although I hate the way Firefox moves the audio players around depending on whether the audio has been played or not. And that leaves IE9 &#8230; which, hands down, did the best. Maybe that&#39;s because of the exception I&#39;d added for it as I mentioned in an <a href="http://blog.humaneguitarist.org/2012/01/09/jaus-trying-to-add-a-starttime-attribute-to-the-audio-tag#update011012">earlier post</a>.</p>
<p>So, there&#39;s still work to do and things to investigate.</p>
<p>Also, I haven&#39;t tested this with really long files or anything so I don&#39;t know how that would go. But then again, as I&#39;ve heard others say, HTML5 media elements aren&#39;t really for long-form media anyway.</p>
<p>Oh yeah, one more thing. I did in fact change to &quot;data-startTime&quot; and &quot;data-stopTime&quot; to make the HTML legal HTML5.</p>
<p>Here&#39;s the HTML5 code itself, letting one see that the JavaScript has now been moved into a separate JS file.</p>
<pre class="brush:html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;jAUs&lt;/title&gt;
    &lt;meta charset=&quot;UTF-8&quot; /&gt;
  &lt;/head&gt;
  &lt;body&gt;

  &lt;script type=&quot;text/javascript&quot; src=&quot;jAUs.js&quot;&gt;&lt;/script&gt;

  &lt;p&gt;This is the entire recording of Shakespeare&#39;s Sonnet 130, read by Nathan Miller for
  &lt;a href=&quot;http://librivox.org/sonnet-130-by-william-shakespeare/&quot;&gt;LibriVox&lt;/a&gt;.&lt;/p&gt;
  &lt;audio controls&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.ogg&quot; type=&quot;audio/ogg&quot; /&gt;
    Your browser does not support the audio element.
  &lt;/audio&gt;

  &lt;p&gt;&quot;My mistress&#39; eyes are nothing like the sun.&quot; - &lt;em&gt;start = 10; end = 13.&lt;/em&gt;&lt;/p&gt;
  &lt;audio class=&quot;jAUs&quot; controls data-startTime=&quot;10&quot; data-stopTime=&quot;13&quot;&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.ogg&quot; type=&quot;audio/ogg&quot; /&gt;
    Your browser does not support the audio element.
  &lt;/audio&gt;

  &lt;p&gt;&quot;End of poem.&quot;- &lt;em&gt;start = 57, no end specified.&lt;/em&gt;&lt;/p&gt;
  &lt;audio class=&quot;jAUs&quot; controls data-startTime=&quot;57&quot;&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.ogg&quot; type=&quot;audio/ogg&quot; /&gt;
    Your browser does not support the audio element.
  &lt;/audio&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Oh, and here&#39;s the JavaScript file:</p>
<pre class="brush:javascript">/*
***** Note: This software is still in ALPHA. Please refrain from using
the code without first contacting Nitin Arora at nitaro74@gmail.com.
Thanks!
***** 

jAUs: JavaScript &lt;audio&gt; Shark.

Copyright (c) 2012 Nitin Arora. 

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
&quot;Software&quot;), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software. 

THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 

jAUs is licensed under the MIT license:

http://www.opensource.org/licenses/mit-license.php.

*/

function jAUs(){

  audioTagArray = document.getElementsByClassName(&quot;jAUs&quot;);

  for (i=0;i&lt;=audioTagArray.length-1;i++){
    var thisAudioTag = audioTagArray[i];
    jAUs_2(audioTagArray,thisAudioTag);
  }
}

function jAUs_2(audioTagArray,thisAudioTag){
  //if this is placed directly into jAUs() - i.e. not a separate function,
  //then this whole thing doesn&#39;t seem to work.

  if (navigator.appName == &quot;Microsoft Internet Explorer&quot;){
    thisAudioTag.onloadeddata = function(){
      var thisAudioTag_startTime = thisAudioTag.getAttribute(&quot;data-startTime&quot;);
      thisAudioTag.currentTime = thisAudioTag_startTime;
    }
  }

  else {
    var thisAudioTag_startTime = thisAudioTag.getAttribute(&quot;data-startTime&quot;);
    thisAudioTag.currentTime = thisAudioTag_startTime;
  }

  var thisAudioTag_stopTime = thisAudioTag.getAttribute(&quot;data-stopTime&quot;);
  var stopString = &quot;jAUs_3(this.currentTime,&quot; + thisAudioTag_stopTime + &quot;,&quot; + i + &quot;);&quot;;
  //returns &quot;jAUs_3(this.currentTime, 13, i);&quot; where &quot;i&quot; is an int.

  thisAudioTag.setAttribute(&quot;ontimeupdate&quot;,stopString);
}

function jAUs_3(this_currentTime,thisAudioTag_stopTime,i){

  if (thisAudioTag_stopTime){
    //if there&#39;s a data-stopTime attribute then ...
    if (this_currentTime &gt; thisAudioTag_stopTime){
      //... reset audio to data-startTime when data-stopTime is reached.
      audioTagArray[i].currentTime = audioTagArray[i].getAttribute(&quot;data-startTime&quot;);
      audioTagArray[i].pause();
    }
  }
  else if (audioTagArray[i].ended == true){
    //if there&#39;s no data-stopTime, move back to data-startTime when playback has ended.
    audioTagArray[i].currentTime = audioTagArray[i].getAttribute(&quot;data-startTime&quot;);
    audioTagArray[i].pause();
  }
}

window.onload = function(){
  jAUs();
}
</pre>
<p><strong>Update, January 12, 2012:</strong> Turns out &quot;jAUs&quot; is the name for some robotic SDK and I&#39;m not too crazy about that name anyway. So, I&#39;m leaning toward &quot;m(AUj)ulate&quot; (pronounced like &#39;modulate&#39;) which would stand for something like &quot;My Untimely Little Audio Tag Extender&quot;. The word &quot;untimely&quot; being, of course, a play on the fact that time is what this is all about. The parenthetical bit refers to &quot;audio&quot; (AU) and JavaScript (j).</p>
<p>And, yes, I care much more about the name/acronym than the script itself.</p>
<p><img alt=":P" src="http://blog.humaneguitarist.org/wp-content/plugins/fckeditor-for-wordpress-plugin/ckeditor/plugins/smiley/images/tounge_smile.gif" title=":P" /></p>
<p><strong>Update, January 15, 2012:</strong> OK, this is interesting. If, for the source of the audio file, I actually use the audio files on the Archive.org site for the LibriVox recordings like so &#8230;</p>
<pre class="brush:html">  &lt;audio class=&quot;jAUs&quot; controls data-startTime=&quot;10&quot; data-stopTime=&quot;13&quot;&gt;
    &lt;source src=&quot;http://www.archive.org/download/sonnet_130_librivox/sonnet130_shakespeare_njm_64kb.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    &lt;source src=&quot;http://www.archive.org/download/sonnet_130_librivox/sonnet130_shakespeare_njm.ogg&quot; type=&quot;audio/ogg&quot; /&gt;
    Your browser does not support the audio element.
  &lt;/audio&gt;
</pre>
<p>&#8230; then this seems to be working OK in all the browsers. Chrome seems, per casual observation, the slowest in terms of getting the scrubber moved to the appropriate points, but I guess this is progress.</p>
<p>Related to all this stuff I&#39;ve been messing with, I found this: <a href="http://dev.opera.com/articles/view/consistent-event-firing-with-html5-video/">Consistent event firing with HTML5 video &#8211; Dev.Opera</a>. But here, too, they use an alert() to notify the user that metadata is loaded using &quot;onloadedmetadata&quot;, but in my tests it seems like the alert() function itself was what was fixing the inability of some browsers to set the current time as my script was instructing.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.humaneguitarist.org/2012/01/11/jaus-3-d-no-glasses-required/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jAUs: trying to add a startTime attribute to the audio tag</title>
		<link>http://blog.humaneguitarist.org/2012/01/09/jaus-trying-to-add-a-starttime-attribute-to-the-audio-tag/</link>
		<comments>http://blog.humaneguitarist.org/2012/01/09/jaus-trying-to-add-a-starttime-attribute-to-the-audio-tag/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 17:29:52 +0000</pubDate>
		<dc:creator>nitin</dc:creator>
				<category><![CDATA[digital audio]]></category>
		<category><![CDATA[audio tag]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[jAUs]]></category>

		<guid isPermaLink="false">http://blog.humaneguitarist.org/?p=3857</guid>
		<description><![CDATA[I work up this morning feeling unwell, but I still went in to work for a few minutes to enable Remote Desktop as it had stopped working (was a Windows Firewall thing) &#8230; Anyway, on the walk back home I started thinking about something I&#39;ve wanted to play with for a while. And that&#39;s seeing [...]]]></description>
			<content:encoded><![CDATA[<p>I work up this morning feeling unwell, but I still went in to work for a few minutes to enable Remote Desktop as it had stopped working (was a Windows Firewall thing) &#8230;</p>
<p>Anyway, on the walk back home I started thinking about something I&#39;ve wanted to play with for a while.</p>
<p>And that&#39;s seeing what it would take to add support for a &quot;startTime&quot; attribute for the HTML5 &lt;audio&gt; tag using a browser&#39;s built-in player. I think it&#39;s a real oversight that there isn&#39;t native support for passing the start and stop times in the &lt;audio&gt; and &lt;video&gt; tags themselves. Um, there isn&#39;t right?</p>
<p>Adding support for a &quot;stopTime&quot; attribute would, I think, require more than I&#39;m willing to think about right now (I should be napping) because obviously that entails checking the current time against the point at which one would want the media to stop.</p>
<p>But adding a simple (and, yes, non-standard) &quot;startTime&quot; attribute inside the &lt;audio&gt; tag seems pretty easy &#8211; if you aren&#39;t using IE. Ugh.</p>
<p>As you can see in the code below there&#39;s an alert() that returns a null, but without it IE (version 9) won&#39;t set the audio players to the values in the &quot;startTime&quot; attributes. The other &quot;major&quot; browsers do fine without it. And, really, it can&#39;t be there because it&#39;s annoying as hell.</p>
<p>But I think this still points to the problem of each browser having its own player. Take Safari for instance. It doesn&#39;t natively show the current or total time of the track. Chrome doesn&#39;t show the total time.</p>
<p>Still think Flash is a bad thing?</p>
<p><img alt=":P" src="http://blog.humaneguitarist.org/wp-content/plugins/fckeditor-for-wordpress-plugin/ckeditor/plugins/smiley/images/tounge_smile.gif" title=":P" /></p>
<pre class="brush:html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;jAUs&lt;/title&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
      function jAUs(){
        var audioTag = document.getElementsByClassName(&#39;jAUs&#39;);
        for (i=0;i&lt;=audioTag.length;i++){
          var audioTag_startTime = audioTag[i].getAttribute(&#39;startTime&#39;);
          alert(&#39;&#39;);
          audioTag[i].currentTime = audioTag_startTime;
        }
      }
    &lt;/script&gt;
  &lt;/head&gt;
&lt;body onload=&quot;jAUs()&quot;&gt;

  &lt;audio class=&quot;jAUs&quot; controls startTime=&quot;10&quot;&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.ogg&quot; type=&quot;audio/ogg&quot; /&gt;
    Your browser does not support the audio element.
  &lt;/audio&gt;

  &lt;br /&gt;

  &lt;audio class=&quot;jAUs&quot; controls startTime=&quot;25&quot;&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.ogg&quot; type=&quot;audio/ogg&quot; /&gt;
    Your browser does not support the audio element.
  &lt;/audio&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>ps: If this ever turns into a little project of mine, it needs a decently cool name to keep my interest. &quot;JS&quot; for JavaScript and &quot;AU&quot; for audio mashed up equals &quot;jAUs&quot;. I hope that isn&#39;t already taken within the JavaScript/HTML5 domain.</p>
<p><strong>Update, January 09, 2012:</strong> Now that an hour has past and I finished watching &quot;<a href="http://www.imdb.com/title/tt1922373/">Thor &amp; Loki: Blood Brothers</a>&quot;, I figured out how to elegantly do the &quot;stopTime&quot; thing &#8211; well, at least I think it&#39;s better than what I was thinking earlier today!</p>
<p>So unlike in the code above, the JavaScript below only hits on one &lt;audio&gt; element (the one with an &quot;id&quot; value of &quot;jAUs&quot;) and not all the ones with a &quot;class&quot; value of &quot;jAUs&quot;. But the point is that this new code adds the &quot;ontimeupdate&quot; attribute to the &lt;audio&gt; tag and makes it run a function called stopper() that will stop the audio once the current time is greater than the designated stopping time.</p>
<p>Now, there&#39;s still work to do. For example, the code should test for the existence of the &quot;stopTime&quot; attribute before forcing the stopper() function to run, but that&#39;s no big deal. I also need to test doing this as above &#8211; i.e. hitting all &lt;audio&gt; tags with a &quot;class&quot; value of &quot;jAUs&quot; &#8211; and see how that works. And there&#39;s that pesky IE thing, too.</p>
<p>Anyway, this is working in the other &quot;major&quot; browsers &#39;far as I can tell.</p>
<pre class="brush:html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;jAUs&lt;/title&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
      function jAUs(){
        var audioTag = document.getElementById(&#39;jAUs&#39;);
        var audioTag_startTime = audioTag.getAttribute(&#39;startTime&#39;); //returns &quot;10&quot;
        //alert(&#39;&#39;); //no IE love this time, sorry!
        audioTag.currentTime = audioTag_startTime;
        var audioTag_stopTime = audioTag.getAttribute(&#39;stopTime&#39;);  //returns &quot;20&quot;
        var stopThis = &quot;stopper(this.currentTime,&quot; + audioTag_stopTime + &quot;);&quot;; //returns &quot;stopper(this.currentTime,20);&quot;
        audioTag.setAttribute(&#39;ontimeupdate&#39;,stopThis); //sends current time and stopTime value to stopper()
      }
      function stopper(currentTime, stopTime){
        var audioTag = document.getElementById(&#39;jAUs&#39;);
        if (currentTime &gt; stopTime){
          audioTag.pause(); //stops playback if the current time is greater than the stopTime value
        }
      }
    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload=&quot;jAUs()&quot;&gt;

  &lt;audio id=&quot;jAUs&quot; controls startTime=&quot;10&quot; stopTime=&quot;20&quot;&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.ogg&quot; type=&quot;audio/ogg&quot; /&gt;
    Your browser does not support the audio element.
  &lt;/audio&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>Update, January 09, 2012: </strong>I still don&#39;t like it, but it seems that the alert() line can go at the top of the jAUs() function and still allow all this to work on IE 9. At least that prevents an alert message for each &lt;audio&gt; tag within the page.<strong><a name="update011012"></a></strong></p>
<p><strong>Update, January 10, 2012:</strong> Ah. Now, we might be getting somewhere. I don&#39;t know if it&#39;s just a band-aid fix, but if I add an &quot;onloadeddata&quot; bit for IE9 this actually seems to be working just fine. The problem was that IE didn&#39;t consider the &lt;audio&gt; element&#39;s properties to be accessible, thus giving me an &quot;Invalid State Error&quot; with a code number of 11 which is this, more or less: &quot;An attempt was made to use an object that is not, or is no longer, usable.&quot; So, IE9 is taking a little longer than the other browsers in realizing what&#39;s what.</p>
<pre class="brush:html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;jAUs&lt;/title&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
      function jAUs(){
        audioTag = document.getElementById(&#39;jAUs&#39;); //this is a global variable
        var audioTag_startTime = audioTag.getAttribute(&#39;startTime&#39;); //returns &quot;10&quot;
        //alert(audioTag.readyState); //IE returns &quot;0&quot;, other browsers &quot;4&quot;
        //alert(audioTag.readyState); //IE and others return &quot;4&quot;

        //needs to be for IE9 only ... I guess it waits until the audioTag is ready to go.
        if (navigator.appName == &#39;Microsoft Internet Explorer&#39;)
        {
          audioTag.onloadeddata = function() {
            audioTag.currentTime = audioTag_startTime;
          }
        }
        else {
          audioTag.currentTime = audioTag_startTime;
        }

        var audioTag_stopTime = audioTag.getAttribute(&#39;stopTime&#39;);  //returns &quot;13&quot;
        var stopThis = &quot;stopper(this.currentTime,&quot; + audioTag_stopTime + &quot;);&quot;;
        //returns &quot;stopper(this.currentTime, 13);&quot;

        audioTag.setAttribute(&#39;ontimeupdate&#39;,stopThis);
      }

      function stopper(currentTime, stopTime){
        if (currentTime &gt; stopTime){
          audioTag.pause();
        }
      }
    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload=&quot;jAUs()&quot;&gt;

  &lt;audio id=&quot;jAUs&quot; controls startTime=&quot;10&quot; stopTime=&quot;13&quot;&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.ogg&quot; type=&quot;audio/ogg&quot; /&gt;
    Your browser does not support the audio element.
  &lt;/audio&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>Update, January 10, 2012:</strong> Hopefully (for you and me) this is the last update for a while. Hey, I&#39;m still sick, jerk!</p>
<p>Anyway, this is a test for hitting on all &lt;audio&gt; tags with a class value of &quot;jAUs&quot;.</p>
<pre class="brush:html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;jAUs&lt;/title&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
      function jAUs(){

        audioTagArray = document.getElementsByClassName(&#39;jAUs&#39;);

        for (i=0;i&lt;=audioTagArray.length-1;i++){
          var thisAudioTag = audioTagArray[i];
          jAUs_2(audioTagArray,thisAudioTag);
        }
      }

      function jAUs_2(audioTagArray,thisAudioTag){
      //if this is placed directly into jAUs() - i.e. not a separate function,
      //then this whole thing doesn&#39;t seem to work.

        if (navigator.appName == &#39;Microsoft Internet Explorer&#39;){
          thisAudioTag.onloadeddata = function(){
            var thisAudioTag_startTime = thisAudioTag.getAttribute(&#39;startTime&#39;);
            thisAudioTag.currentTime = thisAudioTag_startTime;
          }
        }

        else {
          var thisAudioTag_startTime = thisAudioTag.getAttribute(&#39;startTime&#39;);
          thisAudioTag.currentTime = thisAudioTag_startTime;
        }

        var thisAudioTag_stopTime = thisAudioTag.getAttribute(&#39;stopTime&#39;);
        var stopString = &quot;jAUs_3(this.currentTime,&quot; + thisAudioTag_stopTime + &quot;,&quot; + i + &quot;);&quot;;
        //returns &quot;jAUs_3(this.currentTime, 13, i);&quot; where &quot;i&quot; is an int.

        thisAudioTag.setAttribute(&#39;ontimeupdate&#39;,stopString);
      }

      function jAUs_3(this_currentTime,thisAudioTag_stopTime,i){

        if (this_currentTime &gt; thisAudioTag_stopTime){
          audioTagArray[i].pause();
        }
      }
    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload=&quot;jAUs()&quot;&gt;

  &lt;audio class=&quot;jAUs&quot; controls startTime=&quot;10&quot; stopTime=&quot;13&quot;&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.ogg&quot; type=&quot;audio/ogg&quot; /&gt;
    Your browser does not support the audio element.
  &lt;/audio&gt;

  &lt;br /&gt;

  &lt;audio class=&quot;jAUs&quot; controls startTime=&quot;25&quot; stopTime=&quot;26&quot;&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    &lt;source src=&quot;sonnet130_shakespeare_njm.ogg&quot; type=&quot;audio/ogg&quot; /&gt;
    Your browser does not support the audio element.
  &lt;/audio&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>By the way, using the HTML5 &quot;<a href="http://www.javascriptkit.com/dhtmltutors/customattributes.shtml">data-</a>&quot; prefix a la &quot;data-startTime&quot; would make the attribute(s) valid, though still not part of a standard per the &lt;audio&gt; tag specifically. But I guess the &quot;data-&quot; prefix is an acknowledgment of reality.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.humaneguitarist.org/2012/01/09/jaus-trying-to-add-a-starttime-attribute-to-the-audio-tag/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAVS: a Simple Audio/Video Synchronizer</title>
		<link>http://blog.humaneguitarist.org/2011/09/05/savs-a-simple-audiovideo-synchronizer/</link>
		<comments>http://blog.humaneguitarist.org/2011/09/05/savs-a-simple-audiovideo-synchronizer/#comments</comments>
		<pubDate>Mon, 05 Sep 2011 13:39:59 +0000</pubDate>
		<dc:creator>nitin</dc:creator>
				<category><![CDATA[digital audio]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[SAVS]]></category>
		<category><![CDATA[streaming media]]></category>
		<category><![CDATA[timed text]]></category>

		<guid isPermaLink="false">http://blog.humaneguitarist.org/?p=3089</guid>
		<description><![CDATA[About a year ago I did some text to audio synchronization tests with HTML5 and Flash. The tests were partially successful, but I think what really mattered is that I set four goals that I felt needed to be met before the word &#34;synchronization&#34; could truly be used: The user should be able to click [...]]]></description>
			<content:encoded><![CDATA[<p>About a year ago I did some text to audio <a href="http://blog.humaneguitarist.org/uploads/SAVS/AVsink/">synchronization tests</a> with HTML5 and Flash.</p>
<p>The tests were partially successful, but I think what really mattered is that I set four goals that I felt needed to be met before the word &quot;synchronization&quot; could truly be used:</p>
<ol>
<li>The user should be able to click on a line of text and hear the related media.</li>
<li>The user should be able to &quot;scrub&quot; ahead on the media player and the text should follow.</li>
<li>The page should report where in the document the user is.</li>
<li>The page should automatically keep the media/text synchronized without user intervention.</li>
</ol>
<p>Basically, I&#39;ve seen a few people make it so that you could watch media while the transcript text was also on the page (scrollable as opposed to overlaid closed captions) and the user could click on a line and have the movie/audio skip ahead to that moment (goal #1). That&#39;s great and all, but that&#39;s not synchronization.</p>
<p><img alt=";)" src="http://blog.humaneguitarist.org/wp-content/plugins/fckeditor-for-wordpress-plugin/ckeditor/plugins/smiley/images/wink_smile.gif" title=";)" /></p>
<p>Synchronization is a two way street and I&#39;ve been working this past week during what I&#39;m calling &quot;4 days of madness&quot; to come up with a really simple solution to real synchronization. I did run across this really cool <a href="http://hyper-audio.org/r/">RadioLab page</a> that achieves goal #1, but as much as I like it I want more features with less flash (as in &quot;flash and dash&quot; not Adobe Flash!) and less code. No mistake: it looks fantastic and I also appreciate that they&#39;ve got the text timed to clusters of a couple of words rather than by line but the only thing I&#39;ve seen that gets it all &quot;right&quot; per my perspective was a subscription resource by <a href="http://alexanderstreet.com/">Alexander St. Press</a>. It achieved all the goals above using a Flash player and the rest appeared to by done with Javascript and some jQuery smooth scrolling. It was also timed by clusters of words and not just by line or by paragraph. Of course, conceptually it&#39;s the same whether one marks up their text &#8211; in the temporal sense &#8211; by line or by word, but it&#39;s a little more work to do it by word of course. Unfortunately, I&#39;ve seen people do the opposite: they use a static unit of time like 60 seconds and only mark up the text every minute. That&#39;s taking the easy way out and also misses the point entirely since it makes the text subservient to an arbitrary unit of time. Would it be acceptable if closed captioning and subtitles on your foreign films only showed up in large chunks every minute? I would hope not, and in the case of the former it would violate the the spirit if not the letter of the &quot;law&quot; in regard to accessibility. If done right, you can use the same timed text file to both serve up captions in addition to showing the full text on the page. It&#39;s more time and cost efficient to re-purpose the same data for two needs.</p>
<p>Anyway, let&#39;s get back to Alexander St. Press. I loved what I saw when my boss (I work at <a href="http://nclive.org/">NC Live</a>) showed it to me. I got really excited and said something like, &quot;This is what I&#39;ve been waiting to see!&quot;. In addition to the great and true syncing, they also had a feature that would let the user make and share clips, much the way you can on sites like NBC&#39;s <a href="http://www.msnbc.msn.com/id/3032608/">Meet The Press</a>. The Alexander St. Press site also allowed you to annotate that clip, which is a great feature for teachers and librarians, etc. Alexander St. Press also has this with their classical music streaming subscription service, which in the spirit of full disclosure I pay for. They ALSO had a cool timeline where you could see what I call &quot;hot spots&quot; &#8211; places where others had made clips. The idea, I guess, is that spots on the timeline with more clusters would indicate a particular point of interest. Nothing new, because you see that all the time with streaming sports like the <a href="http://www.usopen.org/en_US/index.html">US Open&#39;s site</a> where you can go back and watch previous moments in matches and then &quot;go live&quot; at any time. But the difference is, of course, that&nbsp;Alexander St. Press was using user-contributed clips.</p>
<p>So long story short (or just not as long), in a few weeks I need to present these ideas to some people and talk about how we think these features could be useful for our users. And the more I struggled with how to talk about these concepts without a prototype the more I thought I would a) sound like I&#39;m crazy and b) like I&#39;m full of hot air.</p>
<p>	I decided that it was time to go back to some earlier tests of mine from early April and just build a prototype so we could just show it to people and not have to talk theoretical speak. I think it&#39;s generally easier to explain and convince people of the utility of software by showing it rather than telling it. Actions &gt; words, right?</p>
<p>
	Well, early tests are working and only required me to add one line of Actionscript to our current Flash player and about only 50 lines of Javascript code are needed to keep the text and media synced. The tests I did were for some PBS videos we purchased along with closed captioning files.</p>
<p>	I was so excited that it was finally working that I went home during those &quot;4 days of madness&quot; to write an HTML5 version which is virtually identical to the Flash version. It&#39;s got basic clip making features as well as a very basic tool inspired by this <a href="http://blog.humaneguitarist.org/2011/01/09/videoscores-from-the-musescore-gang/">video score</a> tutorial to make timed text files provided you have the audio and full text in hand. Eventually, I&#39;ll comment the code up and improve some options and post a download to the source for the HTML5 version. At work, we&#39;ll probably eventually offer the code as it&#39;s tweaked to meet our aesthetic needs, etc. As you&#39;ll see in the demo video below, I have no aesthetics!</p>
<p>	I&#39;ll shut up now and leave you to the video if you&#39;re interested. I recommend watching it in HD so you can read the words on the page.</p>
<p>As my friend whom the HTML5 version is kinda named after likes to say:</p>
<p>More later &#8230;</p>
<p><iframe frameborder="0" height="225" src="http://player.vimeo.com/video/28582024?byline=0&amp;portrait=0" width="400"></iframe></p>
<p><a href="http://vimeo.com/28582024">SAVS: a Simple Audio/Verse Synchronizer</a> from <a href="http://vimeo.com/user3665532">nitin arora</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>&#8230;</p>
<p><strong>Update, September 20, 2011:</strong> To avoid confusion as to what this does, I&#39;m renaming this from &quot;Simple Audio/Video Synchronizer&quot; to &quot;Simple Audio/Verse Synchronizer&quot; or something &#8230;</p>
<p><img alt=":)" src="http://blog.humaneguitarist.org/wp-content/plugins/fckeditor-for-wordpress-plugin/ckeditor/plugins/smiley/images/regular_smile.gif" title=":)" /></p>
<p><strong>Update, October 16, 2011:</strong> Cool, I found one more thing that meets all the four goals at <a href="http://www.dinglabs.com">http://www.dinglabs.com</a>. They&#39;re pitching it as a foreign language learning tool, but same difference. Also, that site led me to <a href="http://transag.sourceforge.net/">TranscriberAG</a>, a tool for transcribing audio.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.humaneguitarist.org/2011/09/05/savs-a-simple-audiovideo-synchronizer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>segmenting audio with AudioRegent, SoX and XML</title>
		<link>http://blog.humaneguitarist.org/2010/01/16/segmenting-audio-with-audioregent/</link>
		<comments>http://blog.humaneguitarist.org/2010/01/16/segmenting-audio-with-audioregent/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 19:05:39 +0000</pubDate>
		<dc:creator>nitin</dc:creator>
				<category><![CDATA[digital audio]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[AudioRegent]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[SoX]]></category>
		<category><![CDATA[transcripts]]></category>

		<guid isPermaLink="false">http://blog.humaneguitarist.org/?p=697</guid>
		<description><![CDATA[For some reason I&#160;feel obligated to point out that I&#160;haven&#8217;t blogged in a while for a few reasons: Christmas break from school/work at the University of Alabama the desire not to blog for the sake of blogging and &#8230; I&#8217;ve been working on something huge &#8211; at least for me. It&#8217;s a piece of software [...]]]></description>
			<content:encoded><![CDATA[<p>For some reason I&nbsp;feel obligated to point out that I&nbsp;haven&#8217;t blogged in a while for a few reasons:</p>
<ol>
<li>Christmas break from school/work at the University of Alabama</li>
<li>the desire not to blog for the sake of blogging</li>
<li>and &#8230;</li>
</ol>
<p>I&#8217;ve been working on something huge &#8211; at least for me. It&#8217;s a piece of software called AudioRegent that harnesses XML to create derivative &quot;clips&quot; of regions within WAV audio files. <em>A region is simply a user-defined segment within an audio file, like a track on a Compact Disc.<br />
</em></p>
<p>Besides writing the program in Python, which I&nbsp;pretty much finished in December, I had to also develop the XML format which I&nbsp;call <a href="http://blog.humaneguitarist.org/projects/audioregent/#SimpleADL">SimpleADL</a> (Simple Audio Decision List) that AudioRegent looks at and then makes derivative audio clips by leveraging <a href="http://sox.sourceforge.net/">SoX</a>, the Sound Exchange command line audio editor. AudioRegent and SimpleADL can also be used to sync audio to text, like transcripts.</p>
<p>Actually, the programming and devising SimpleADL were the easy part. The hard stuff was the documentation and deciding on a license for the software.</p>
<p>I&nbsp;tried to find a balance in documenting the software: being thorough without writing a novel. I&#8217;m not sure I&nbsp;succeeded, but I can always improve it with time.</p>
<p>I used the W3C&#8217;s <a href="http://www.w3.org/Amaya/">Amaya</a> editor to write the documentation in XHTML. Sure, you can use OpenOffice to export a document to XHTML, but man is it bloated and messy. Amaya writes really clean XHTML.</p>
<p>As for the license, I&nbsp;chose the <a href="http://creativecommons.org/licenses/BSD/">BSD license</a>. As I&nbsp;understand it, this allows one to use the source code at will in future open or closed-source applications as long as you maintain the credits for AudioRegent. I&nbsp;was tempted to use the <a href="http://www.mozilla.org/MPL/">Mozilla Public License</a> (MPL) which, again from what I&nbsp;can tell, is similar to the BSD license except that any source derived from AudioRegent would have to stay open-source though any peripheral code can be closed-source. I absolutely decided against the <a href="http://www.gnu.org/licenses/gpl.html">GNU&nbsp;General Public License</a> which is viral and imposes its philosophy perpetually on all subsequent code, even peripheral code. Some have even argued that it works against its own objectives and is <a href="http://croftsoft.com/library/tutorials/gplmpl/">less &quot;open&quot; than the MPL</a>.</p>
<p>Now I&nbsp;realize that, practically speaking, a skilled programmer could write better code from scratch in 30 minutes as opposed to the some 30 hours I&nbsp;needed, but I&nbsp;wanted to go about this quasi-professionally. And I&nbsp;learned more about licensing, which was cool.</p>
<p>Anyway, rather than try and explain the software itself and how to get it, I&#8217;d be better off pointing you to the <a href="http://blog.humaneguitarist.org/projects/audioregent/">documentation</a> if you have any interest &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.humaneguitarist.org/2010/01/16/segmenting-audio-with-audioregent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

