<?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>Bread and Circuits &#187; Teaching Open Source</title>
	<atom:link href="http://vocamus.net/dave/?feed=rss2&#038;category_name=TeachingOpenSource" rel="self" type="application/rss+xml" />
	<link>http://vocamus.net/dave</link>
	<description>Philosophy for the programming set, served on home made bread</description>
	<lastBuildDate>Thu, 26 Aug 2010 16:34:23 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Experiments with audio, conclusion</title>
		<link>http://vocamus.net/dave/?p=1148</link>
		<comments>http://vocamus.net/dave/?p=1148#comments</comments>
		<pubDate>Thu, 26 Aug 2010 16:34:23 +0000</pubDate>
		<dc:creator>david.humphrey</dc:creator>
				<category><![CDATA[CDOT]]></category>
		<category><![CDATA[Experiments with audio]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Mozilla Education]]></category>
		<category><![CDATA[Seneca]]></category>
		<category><![CDATA[Teaching Open Source]]></category>

		<guid isPermaLink="false">http://vocamus.net/dave/?p=1148</guid>
		<description><![CDATA[I’ve been working with an amazing group of web, audio, and Mozilla developers on a project to expose audio data to JavaScript from Firefox’s audio and video  elements. Today those experiments are over.
In December a few of us working on processing.js had an idea&#8211;what if we could visualize sound data coming out of an [...]]]></description>
			<content:encoded><![CDATA[<p><em>I’ve been working with an amazing group of web, audio, and Mozilla developers on <a href="../?cat=25">a project</a> to expose audio data to JavaScript from Firefox’s audio and video  elements. Today those experiments are over.</em></p>
<p>In December a few of us working on <a href="http://processingjs.org/">processing.js</a> had an idea&#8211;what if we could visualize sound data coming out of an &lt;audio&gt; or &lt;video&gt; element?  My colleagues were good at thinking in terms of &#8220;how can we make what we have now work?&#8221; but I had another idea.  &#8220;Let&#8217;s try and teach Firefox how to do this.&#8221;  In December I set myself a challenge:</p>
<blockquote><p>This post marks the beginning of what I expect to be a somewhat <a href="../?cat=25">regular series of posts</a> in which I will document my thinking, learning, and progress related to  some Firefox development.  I say “Experiments” above, because I am  going to try a number of things.  First, I’m going to push into a part  of the Firefox source code where I haven’t worked before, namely, the  DOM implementation (note: it scares me, to be honest).  Second, I’m  going to do so in an open and pedagogic way, attempting to cast aside my  own ego and hesitation at looking foolish–I don’t actually know how to  do what I’m going to try, and will learn and fail as I go–on the way to  producing an authentic model of open development for my students.   Third, I’m going to work with a <a href="http://philosophy.modern-carpentry.com/">few</a> <a href="http://www.hyper-metrix.com/">others</a> who are also interested in extending themselves and extending the web.   The only thing I can assure you of at this early date is that these  posts will be an honest account of the attempt.</p></blockquote>
<p>Yesterday, the end result of that work landed in mozilla-central, on its way to inclusion in Firefox 4.  I&#8217;m immensely proud of the work we&#8217;ve done, and thrilled that my peers in the Mozilla community have also accepted it.  I&#8217;m also very tired <img src='http://vocamus.net/dave/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>There&#8217;s lots of things that I could talk about in terms of the code and API, and probably we&#8217;ll do some of that soon (you can already use the API in a <a href="http://nightly.mozilla.org/">Firefox nightly</a>, read about <a href="https://wiki.mozilla.org/Audio_Data_API">the API</a>, and try <a href="https://wiki.mozilla.org/Audio_Data_API#Working_Audio_Data_Demos">live demos</a>).  But what I wanted to end this <a href="http://vocamus.net/dave/?cat=25">series of posts</a> by saying something about how Firefox, the Mozilla community, and the open web, make what we did possible.</p>
<p>The other day my family had some friends over, and we got talking about what I do.  Of course they had heard of Firefox, and used it themselves.  &#8220;But can you explain the difference between this and the other one I use, Internet Explorer.&#8221;  One of the big differences, I explained, is participation, the community of involvement, and the accountability that comes with this.</p>
<p>When we started these experiments, we did so without needing permission.  I didn&#8217;t have to sign an NDA, go talk to and convince the right people, or get approvals.  I just grabbed the source code and started messing around.  And I did make a mess, at first.  I learned as I went, and we iterated on the API a lot (I have over 80 versions of it here, not to mention the various implementations of those).  We weren&#8217;t judged for doing it wrong, or for the pace or directions we took.  Instead, we heard of lot of &#8220;this is very cool!&#8221; and &#8220;have you thought about this?&#8221;.  We were able to take one of the world&#8217;s premier applications (Firefox) and rework it.  It&#8217;s hard to overemphasize how significant this is.  We couldn&#8217;t do what we did in very many other contexts.</p>
<p>I said above that participation is paired with accountability, and this is also very important.  In the early months we built something that worked, but not what we have today.  As much as Mozilla made it possible for me to experiment, they also made sure that what got accepted was of the highest quality.  I haven&#8217;t blogged about audio much over the past three months, mostly because we&#8217;ve been too busy getting the patch fixed up based on reviews.  Before it could land we had to think about testing, security, JS performance, DOM manipulations, memory allocation, etc.  To get this landed we needed lots of advice from various people, who have been generous with their time and knowledge</p>
<p>What&#8217;s different about Mozilla?  I think of something Joe Hewitt wrote on twitter back in the spring that struck me:</p>
<blockquote><p>Bottom line: we can currently only move as fast as employees of browser makers can go, and our imagination is limited by theirs. @<a title="Joe Hewitt" hreflang="en" href="http://twitter.com/joehewitt">joehewitt</a></p></blockquote>
<p>Not one of the people who did this work is an employee of the Mozilla corporation.  When we decided to get serious about trying to include this in Firefox 4, one of the people working with us filed a bug, and the response was, &#8220;I don&#8217;t think we have the cycles to get this done in time.&#8221;  &#8220;That&#8217;s OK, we&#8217;ll do it then,&#8221; was the reply.  And we did.</p>
<p>The web is too big and too important to only go as fast and as far as a small group of employees can take it.  Mozilla gets this, and values community involvement like ours.  What we did is not unique&#8211;there are other great features and bug fixes coming in Firefox 4 that were done by community members vs. employees.  In fact the distinction between the two is often hard to see when you&#8217;re working on this stuff&#8211;we all work together.</p>
<p>Having said that, let me publicly congratulate my amazing audio peers, without whom this work wouldn&#8217;t have happened: Al MacDonald, Corban Brook, Yury Delendik, Charles Cliffe, Ricard Marxer, and our cheerleader and supporter, Chris Blizzard.  Also thanks to the dozen others who wrote demos with our stuff in the early days.  Demos are how you win (Chris Blizzard taught me that).</p>
<p>I&#8217;ll end with a video someone shot of my keynote talk at the recent Mozilla Summit.  I was doing a quick demonstration of what is possible with this API.  I look forward to seeing what the rest of the web will do with it.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/1Uw0CrQdYYg?fs=1&amp;hl=en_US&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999&amp;hd=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="640" height="385" src="http://www.youtube.com/v/1Uw0CrQdYYg?fs=1&amp;hl=en_US&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999&amp;hd=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://vocamus.net/dave/?feed=rss2&amp;p=1148</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Open Source Research at Seneca</title>
		<link>http://vocamus.net/dave/?p=1109</link>
		<comments>http://vocamus.net/dave/?p=1109#comments</comments>
		<pubDate>Mon, 07 Jun 2010 14:23:03 +0000</pubDate>
		<dc:creator>david.humphrey</dc:creator>
				<category><![CDATA[CDOT]]></category>
		<category><![CDATA[Mozilla Education]]></category>
		<category><![CDATA[Seneca]]></category>
		<category><![CDATA[Teaching Open Source]]></category>

		<guid isPermaLink="false">http://vocamus.net/dave/?p=1109</guid>
		<description><![CDATA[Last Thursday, David Agnew (President of Seneca) and Gary Goodyear (federal Minister of State (Science and Technology)) announced that Seneca college had received one of 12 NSERC grants.  The grant is specifically targeted to Seneca&#8217;s Centre for Development of Open Technology, to help us grow our involvement in open source, and to help local businesses [...]]]></description>
			<content:encoded><![CDATA[<p>Last Thursday, David Agnew (President of Seneca) and Gary Goodyear (federal Minister of State (Science and Technology)) <a href="http://www.senecac.on.ca/media/news/2010/2010-06-03.html?page=1">announced that Seneca college had received one of 12 NSERC grants</a>.  The grant is specifically targeted to Seneca&#8217;s Centre for Development of Open Technology, to help us grow our involvement in open source, and to help local businesses do the same.  If you don&#8217;t know, NSERC grants are a big deal, and it&#8217;s a huge honour to have received it.  It was also a lot of work for those of us applying!  But it&#8217;s paid off, and I wanted to say something about what it means for Seneca students reading my blog.</p>
<p>The grant brings $2.3 Million in funding over 5 years, and is meant to be combined with funding from industry partners.  It will allow us to fund research and co-op positions, like the 9 students who are working this summer on various open source projects.  It means that we can take more of the work we do in the open source courses (OSD600, DPS900, OSD700, DPS911, SBR600, etc.) and have it grow into larger projects, working directly with local industry partners and the open source community.  We&#8217;ve known how to do this for a while now but didn&#8217;t have the resources to make it happen.  Now we do.</p>
<p>One of the things I thought was key in the announcement of this grant is that the government, Seneca, and our partners all understand that working on open source is the best way to gain industry experience as a student.  I&#8217;ve written about this <a href="http://vocamus.net/dave/?p=552">many times before</a>, but I&#8217;ll say it again: if you want to work in software, you need experience.  And getting experience means getting a job, but a job needs experience&#8230;unless you get involved in global, collaborative, large scale development as a student before you have a job.  The way to do this is to contribute to open source projects.</p>
<p>I&#8217;ve had students come to me with all kinds of crazy ideas about what open source means.  Many have this idea that you can&#8217;t have a job or make money with open source.  We wouldn&#8217;t have this grant if that were true!</p>
<blockquote><p>“Our government supports innovation because it creates jobs, improves  the quality of life of Canadians and strengthens the economy,” said  Minister Goodyear. “We are supporting this project at Seneca College to  strengthen the competitiveness of small and medium-sized businesses, and  enable young Canadians to prepare for the jobs of tomorrow.”</p>
<p>&#8230;</p>
<p>&#8220;This funding is an important acknowledgment of the valuable,  innovative research taking place at Seneca,” says <a href="http://www.senecac.on.ca/media/documents/DavidAgnew.pdf" target="_self">Seneca College President David Agnew</a>. “Building on a  reputation of excellence in the open source community, this will help  create graduates who have learned not only through hands-on experience,  but through applied research that is changing the way we do business.”</p></blockquote>
<p>The jobs of tomorrow are here today, and they require that you know how to:</p>
<ul>
<li>work with large, legacy code bases measured in millions of lines</li>
<li>know how to collaborate with co-workers, both in person and electronically</li>
<li>understand how to maintain existing code vs. starting from scratch</li>
<li>know how to leverage existing technologies and tools</li>
<li>know how to manage software release cycles and project planning</li>
<li>know how to solve real world problems vs. made-up assignments</li>
<li>know how to leverage the open web, and its ways of working</li>
</ul>
<p>I think current examples are good, so let me give you one.  The other day I was catching up on industry news, and noticed this <a href="http://news.cnet.com/8301-30685_3-20006380-264.html">article on cnet news</a>:</p>
<blockquote><p>Mainstream microprocessors have been 64-bit for years. Operating systems  have followed suit. Now it&#8217;s time for a program used by hundreds of  millions of people to make the leap: Firefox.</p>
<p>Programmer <a href="http://armenzg.blogspot.com/">Armen Zambrano  Gasparnian</a> announced the first <a href="http://groups.google.com/group/mozilla.dev.planning/browse_thread/thread/9715187d7b1fdbf9">64-bit  Firefox builds for Windows</a> on Friday, offering an FTP site for  those who want to download it. But the software isn&#8217;t for mainstream  users yet.</p></blockquote>
<p>That guy making the announcement for Mozilla about the first 64-bit enabled builds of Firefox, know who he is?  He&#8217;s a Seneca grad who got involved with open source and now has an amazing job as a Release Engineer with Mozilla Corporation.  How did he get hired into such a position out of school?  He worked on this stuff <strong>while he was still a student</strong>.  He took our open source courses and got involved with the right projects and the right people.  He got the experience he needed while he was at Seneca in order to jump right into industry, where he&#8217;s now doing cutting edge work.</p>
<p>I could tell you many similar stories, but the story I&#8217;m most interested in at the moment is the one I&#8217;m going to be telling about you in 2-3 years.  My question right now is this: how do we get you, current Seneca student, working on the cutting edge of industry via open source?  We have ways to get your career started early if you&#8217;re willing to get involved with what we do.  Your first chance to do this comes in September.  Will you be signed up for the open source classes?  If so, we&#8217;ve got some amazing opportunities to discuss with you.</p>
]]></content:encoded>
			<wfw:commentRss>http://vocamus.net/dave/?feed=rss2&amp;p=1109</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Experiments with audio, part X</title>
		<link>http://vocamus.net/dave/?p=1092</link>
		<comments>http://vocamus.net/dave/?p=1092#comments</comments>
		<pubDate>Wed, 26 May 2010 16:02:58 +0000</pubDate>
		<dc:creator>david.humphrey</dc:creator>
				<category><![CDATA[CDOT]]></category>
		<category><![CDATA[Experiments with audio]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Mozilla Education]]></category>
		<category><![CDATA[Seneca]]></category>
		<category><![CDATA[Teaching Open Source]]></category>

		<guid isPermaLink="false">http://vocamus.net/dave/?p=1092</guid>
		<description><![CDATA[I’m working with an ever growing group of web, audio, and Mozilla developers on a project to expose audio data to JavaScript from Firefox’s audio and video elements. Today we show you how much JavaScript can really do.
Since my last post, quite a few new people have joined our group, a lot has changed in [...]]]></description>
			<content:encoded><![CDATA[<p><em>I’m working with an ever growing group of web, audio, and Mozilla developers on <a href="http://vocamus.net/dave/?cat=25">a project</a> to expose audio data to JavaScript from Firefox’s audio and video elements. Today we show you how much JavaScript can really do.</em></p>
<p>Since my <a href="http://vocamus.net/dave/?p=1074">last post</a>, quite a few new people have joined our group, a lot has changed in our implementation, and we&#8217;ve achieved a few things worth writing about.  I also can&#8217;t keep these demos under wraps any longer, so it&#8217;s time for another post.</p>
<p>One of the first pieces of advice <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=490705#c15">I got in the bug</a>, when I started writing <a href="http://scotland.proximity.on.ca/dxr/tmp/audio/audio13f.diff">this patch</a> to expose audio data in Firefox, was to use Vlad&#8217;s new typed arrays (aka WebGL Arrays).  My first implementation used an array-like object to expose the audio data, and JS arrays for writing samples.  Both worked well, but neither was as fast as we&#8217;d like, and it meant various hacks to work around performance issues.  Vlad was kind enough to give me a crash course on how to implement them via quickstubs, and over the past few weeks, Yury Delendik and I have worked long hours to rewrite our entire implementation to use them.</p>
<p>Along with the suggestion to use typed arrays also came a less welcome suggestion: remove the FFT calculation from C++ and do it all in JavaScript.  When I suggested this in our <a href="http://www.cubicvr.org/index.php?option=com_content&amp;view=article&amp;id=73&amp;Itemid=88">#audio irc channel</a>, a lot of people were upset, saying that this was a bad idea, that we&#8217;d never be fast enough, etc.  However, I pulled it out anyway in order to force them to try.  Corban responded by rewriting his <a href="http://github.com/corbanbrook/dsp.js/">dsp.js library</a> to use Float32Array, which can now do 1000 FFTs on a 2 channel * 2048 sample buffer in 490ms, or 0.49ms per fft (js arrays take 2.577ms per fft, so a lot faster!).  And one of the biggest critics of my decision to pull the native FFT, Charles Cliffe, went off to prove me wrong, but ended up with two stunning WebGL based audio visualizations (demos <a href="http://cubicvr.org/CubicVR.js/bd3/BeatDetektor3HD-13a.html">here</a> and <a href="http://cubicvr.org/CubicVR.js/bd3/BeatDetektor4HD.html">here</a>, videos <a href="http://www.youtube.com/watch?v=OxoFcyKYwr0&amp;feature=related">here</a> and <a href="http://www.youtube.com/watch?v=dym4DqpJuDk&amp;fmt=22">here</a>).</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/OxoFcyKYwr0&amp;hl=en_US&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="640" height="385" src="http://www.youtube.com/v/OxoFcyKYwr0&amp;hl=en_US&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/dym4DqpJuDk&amp;hl=en_US&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="640" height="385" src="http://www.youtube.com/v/dym4DqpJuDk&amp;hl=en_US&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>What I like most about these (other than the fact that he&#8217;s written the music, js libs, and demo) is that these combine a whole bunch of JavaScript libraries: <a href="http://github.com/corbanbrook/dsp.js/">dsp.js</a>, <a href="http://www.cubicvr.org/index.php?option=com_content&amp;view=article&amp;id=73&amp;Itemid=88">cubicvr.js and beatdetection.js</a>, and <a href="http://processingjs.org/">processing.js</a>.  Some people will tell you that doing anything complex in a browser is going to be slow; but Charles is masterfully proving that you can do many, many things at once and the browser can keep pace.</p>
<p>Corban and Ricard Marxer have been busy exploring how far we can push audio write, and managed to also produce some amazing demos.  The first is by Ricard, and is a <a href="http://www.ricardmarxer.com/blog/2010/05/26/graphical-eq-in-javascript/">graphic equalizer</a> (<a href="http://vimeo.com/12038405">video is here</a>):</p>
<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=12038405&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=12038405&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></p>
<p>The second is by Corban, and shows a <a href="http://weare.buildingsky.net/processing/dsp.js/examples/sampler.html">JavaScript based audio sampler</a>.  His code can loop forward or backward, change playback speed, etc. (<a href="http://vimeo.com/12039823">video is here</a>):</p>
<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=12039823&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=12039823&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></p>
<p>Chris McCormick has been working on <a href="http://mccormick.cx/dev/webpd/">porting Pure Data to JavaScript</a>, and already has some basic components built.  Here&#8217;s one that combines <a href="http://mccormick.cx/dev/webpd/demos/processingjs-basic-example-with-audio/index.html">processing.js and webpd</a> (<a href="http://vimeo.com/12050606">video is here</a>):</p>
<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=12050606&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=12050606&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></p>
<p>I think that my favourite demo by far this time around is one that I&#8217;ve been waiting to see since we first began these experiments.  I&#8217;ve written in the past that our work could be used to solve many web accessibility problems.  A few weeks ago I mentioned on irc that someone should take a shot at building a text to speech engine in JavaScript, now that we have typed arrays.  Yury quietly went off and built one based on the <a href="http://www.speech.cs.cmu.edu/flite/">flite engine</a>.  When you run this, remember that you&#8217;re watching a browser speak with no plugins of any kind.  This is all done in JavaScript (<a href="http://scotland.proximity.on.ca/dxr/tmp/audio/tts/">demo is here</a>, <a href="http://vimeo.com/12039415">video is here</a>):</p>
<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=12039415&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=12039415&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></p>
<p>In order to do this he had to overcome some interesting problems, for example, how to load large binary voice databases into the page.  The straightforward approach of using a JS array was brittle, with JS sometimes running out of stack space trying to initialize the array.  After trying various obvious ways, Yury decided to use the web to his advantage, and pushed the binary data into a PNG, then loaded it into a canvas, where getImageData allows him to access the bytes very quickly, using another typed array.  The browser takes care of downloading and re-inflating the data automatically.  Here&#8217;s what the database looks like:</p>
<p><a href="http://scotland.proximity.on.ca/dxr/tmp/audio/tts/phonems_db.png"><img src="http://scotland.proximity.on.ca/dxr/tmp/audio/tts/phonems_db.png" width="400" height="300" border="0"></a></p>
<p>What began as a series of experiments by a small group of strangers, has now turned into something much larger.  Our community continues to grow, and the scope and scale of the projects being done on our API is increasing.  At the same time, through the work of <a href="http://schepers.cc/?p=212">Doug Schepers and Chris Blizzard</a>, we&#8217;ve managed to get the attention of the W3C, which have now started an <a href="http://www.w3.org/2005/Incubator/audio/">Audio Incubator Working Group</a> to look at how to standardize this stuff.  One of my colleagues in these experiments, Al MacDonald, has been asked to chair the group, which already has members from Mozilla, Google, and the BBC.  You can get involved and follow <a href="https://twitter.com/AudioXG">@AudioXG</a> for updates.</p>
<p>If you&#8217;d like to stay connected to this work, you can join <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=490705">this bug</a>, where I&#8217;ll be posting a patch for review in the next week or so (<a href="http://scotland.proximity.on.ca/dxr/tmp/audio/audio13f.diff">current patch is here</a>).  You can see our <a href="https://wiki.mozilla.org/Audio_Data_API">Audio Data API documentation</a>, with tutorials and examples (this was recently completely rewritten, if you&#8217;ve looked at it before).  You can also grab builds there, which I&#8217;m making right now and will be done in the next few hours.</p>
]]></content:encoded>
			<wfw:commentRss>http://vocamus.net/dave/?feed=rss2&amp;p=1092</wfw:commentRss>
		<slash:comments>42</slash:comments>
		</item>
		<item>
		<title>View Source as Musical Innovation</title>
		<link>http://vocamus.net/dave/?p=1084</link>
		<comments>http://vocamus.net/dave/?p=1084#comments</comments>
		<pubDate>Tue, 04 May 2010 16:25:32 +0000</pubDate>
		<dc:creator>david.humphrey</dc:creator>
				<category><![CDATA[CDOT]]></category>
		<category><![CDATA[Experiments with audio]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Mozilla Education]]></category>
		<category><![CDATA[Seneca]]></category>
		<category><![CDATA[Teaching Open Source]]></category>

		<guid isPermaLink="false">http://vocamus.net/dave/?p=1084</guid>
		<description><![CDATA[I&#8217;ve been interested to watch the flood of reactions around the web to our latest demos and audio experiments.  Here are a few:

Al MacDonald lays out a history and potential future for our work
Article in Create Digital Music, &#8220;Real Sound Synthesis, Now in the Browser; Possible New Standard?&#8221;
Post on Wired&#8217;s WebMonkey blog, &#8220;New HTML5 Tools [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been interested to watch the flood of reactions around the web to our latest <a href="http://vocamus.net/dave/?p=1074">demos and audio experiments</a>.  Here are a few:</p>
<ul>
<li><a href="http://weblog.bocoup.com/web-audio-all-aboard">Al MacDonald lays out a history and potential future for our work</a></li>
<li>Article in Create Digital Music, <a href="http://createdigitalmusic.com/2010/05/03/real-sound-synthesis-now-an-open-standard-in-the-browser/">&#8220;Real Sound Synthesis, Now in the Browser; Possible New Standard?&#8221;</a></li>
<li>Post on Wired&#8217;s WebMonkey blog, <a href="http://www.webmonkey.com/2010/05/new-html5-tools-make-your-browser-sing-and-dance/">&#8220;New HTML5 Tools Make Your Browser Sing and Dance&#8221;</a></li>
<li><a href="http://vimeo.com/channels/weave">Feature of Multi-Touch Audio Data Bloop demo on weave.de</a></li>
</ul>
<p>A number of comments on these and other blogs, and people on twitter, have talked about how Flash already allows some of this.  Reading it as many times as I did, I wanted to respond and suggest that what we&#8217;re doing isn&#8217;t simply parity with Flash.  I don&#8217;t think it&#8217;s exaggerating to say that exposing audio data to the open web has the potential to change sound, audio, and music.  The reason is that HTML5 and JavaScript based audio participates in &#8220;View Source,&#8221; and that means creating a whole new kind of active and passive audio collaboration.</p>
<p>The reason the web has grown like it has, the reason there is so much innovation, the reason so many people of varying levels of expertise can use it, or as <a href="http://shaver.off.net/diary/2007/05/10/the-high-cost-of-some-free-tools/">Mike Shaver put it in 2007</a>, the reason the web won, is View Source:</p>
<blockquote><p>If you choose a platform that <em>needs</em> tools, if you give up the  viral soft collaboration of View Source and copy-and-paste mashups and  being able to jam jQuery in the hole that used to have Prototype in it,  you lose what gave the web its distributed evolution and incrementalism.   You lose what made the web great, and what made the web win.</p></blockquote>
<p>The way View Source functions, with respect to HTML documents, is well understood.  It&#8217;s so well understood that its absence becomes something you can&#8217;t <em>not</em> see.  The Flash-based music visualization or audio app that runs in the browser today looks and sounds great, but that&#8217;s all it does&#8211;it can&#8217;t lead others to iterate and innovate.  Sure, we can deploy audio on the web, but we can&#8217;t tinker with it if we can&#8217;t get at how it&#8217;s made.  Pressing &#8216;play&#8217; isn&#8217;t the same as playing.</p>
<p>Right now the community of people actively working on audio data in the browser is small (about 12 people that I know of), but it already points to what I&#8217;m talking about.  When we made <a href="http://vimeo.com/11346141">Bloop</a> (a <a href="http://code.bocoup.com/bloop/color/bloop.html">processing.js version</a> of Eno&#8217;s Bloom), we did it iteratively.  We learned how to <a href="http://mavra.perilith.com/~luser/test3.html">generate simple sounds using JavaScript</a>, then <a href="http://bocoup.com/core/code/firefox-audio/html-sings/audio-out-music-gen-f1lt3r.html">built scales</a>, followed by <a href="http://weare.buildingsky.net/processing/dsp.js/examples/squarewave.html">more complex</a> <a href="http://weare.buildingsky.net/processing/dsp.js/examples/nowave.html">wave patterns</a>, followed by <a href="http://weare.buildingsky.net/processing/dsp.js/examples/synthesizer.html">oscillators</a>, etc.  The code bounced back and forth between people on irc and twitter, before it got extracted into a <a href="https://wiki.mozilla.org/Audio_Data_API_JS_Library">reusable JavaScript library</a>, which has already allowed <a href="http://twitter.com/corban">Corban</a> and <a href="http://twitter.com/Maciek416">Maciej</a> to start building a <a href="http://www.flickr.com/photos/11280278@N04/4578838640/sizes/o/">multiuser synthesizer/sequencer</a> based on our audio api, node.js, and processing.js (<a href="http://github.com/Maciek416/nodesynth">code is here</a>).</p>
<p>This way of working is so common on the web, it&#8217;s almost not worth mentioning.  But I do mention it because this was, as far as I can tell, the first time people have collaborated on the web to build music <em>using</em> the technologies of web.  And just as it has for all manner of other things, the web made building music easier and faster.</p>
<p>One of the properties of sound is that it bounces off things, echoes, and changes.  The history of music is filled with people innovating by playing with existing sounds.  Allowing sound to exist in a more manifest and malleable way on the web, to become scriptable, viewable, copy-pastable, means that innovations in sound and music will be more frequent and much, much faster.</p>
<p>It&#8217;s a good time to be having this discussion, since the trajectory of music on the web is pointed away from sharing and collaboration (and has for a long time been).  What we&#8217;re plotting with an <a href="https://wiki.mozilla.org/Audio_Data_API">audio data API</a> for the web isn&#8217;t a new method of delivering music.  This is about a new way of creating and collaborating that is stolen directly from the web&#8217;s play book.  The web beat every other way of working using it.  What will happen to music and sound if we let it do the same?</p>
]]></content:encoded>
			<wfw:commentRss>http://vocamus.net/dave/?feed=rss2&amp;p=1084</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Experiments with audio, part IX</title>
		<link>http://vocamus.net/dave/?p=1074</link>
		<comments>http://vocamus.net/dave/?p=1074#comments</comments>
		<pubDate>Fri, 30 Apr 2010 16:06:30 +0000</pubDate>
		<dc:creator>david.humphrey</dc:creator>
				<category><![CDATA[CDOT]]></category>
		<category><![CDATA[Experiments with audio]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Mozilla Education]]></category>
		<category><![CDATA[Seneca]]></category>
		<category><![CDATA[Teaching Open Source]]></category>

		<guid isPermaLink="false">http://vocamus.net/dave/?p=1074</guid>
		<description><![CDATA[I’m working with an ever growing group of web, audio, and Mozilla  developers on a project to expose audio  spectrum data to JavaScript from Firefox’s audio and video elements.  Today we show what we did at www2010.
I&#8217;m in Raleigh, North Carolina, with Al MacDonald for the www2010 conference.  We&#8217;re here to present [...]]]></description>
			<content:encoded><![CDATA[<p><em>I’m working with an ever growing group of web, audio, and Mozilla  developers on <a href="http://vocamus.net/dave/?p=974">a project</a> to expose audio  spectrum data to JavaScript from Firefox’s audio and video elements.  Today we show what we did at www2010.</em></p>
<p>I&#8217;m in Raleigh, North Carolina, with <a href="https://twitter.com/F1LT3R/">Al MacDonald</a> for the <a href="http://www2010.org/www/">www2010</a> conference.  We&#8217;re here to present our work on exposing audio data in the browser.  Over the past month <a href="https://twitter.com/corban">Corban</a>, <a href="https://twitter.com/ccliffe">Charles</a>, and a bunch of other friends have been working with us to refine the API and get new types of demos ready.  We ended-up with 11 demos, some of which I&#8217;ve shown here before.  Here are the others.</p>
<p>The first was done by <a href="http://twitter.com/jseidelin">Jacob Seidelin</a>, and shows many cool 2D visualizations of audio using our API.  You can see the <a href="http://blog.nihilogic.dk/2010/04/html5-audio-visualizations.html">live version</a> on his site, or check out <a href="http://vimeo.com/11355121">this video</a>:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=11355121&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=11355121&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>The second and third demos where done by <a href="https://twitter.com/ccliffe">Charles Cliffe</a>, and show 3D visualizations using WebGL and his <a href="http://www.cubicvr.org/">CubicVR engine</a>.  These also show off his JavaScript beat detection code.  Is JavaScript fast enough to do real-time analysis of audio and synchronized 3D graphics?  Yes, yes it is.  The live versions are <a href="http://cubicvr.org/CubicVR.js/BeatDetektor2HD.html">here</a> and <a href="http://cubicvr.org/CubicVR.js/BeatDetektor1HD.html">here</a>, and here are <a href="http://vimeo.com/11345262">some</a> <a href="http://vimeo.com/11345685">videos</a>:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=11345262&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=11345262&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=11345685&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=11345685&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>The fourth demo was done by <a href="https://twitter.com/corban">Corban Brook</a> and shows how audio data can be mixed live using script.  Here he mutes the main audio, plays it, passes the data through a low pass filter written in JavaScript, then dumps the modified frames into a second audio element to be played.  It&#8217;s a technique we need to apply more widely, as it holds a lot of potential.  Here&#8217;s the <a href="http://weare.buildingsky.net/processing/dsp.js/examples/filter.html">live version</a>, and here&#8217;s a <a href="http://vimeo.com/11335434">video</a> (check out his updated <a href="http://weare.buildingsky.net/processing/dsp.js/examples/synthesizer.html">JavaScript synthesizer</a>, which we also presented):</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=11335434&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=11335434&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>The fifth and sixth demos were done by Al (with the help of many).  When I was last in Boston, for the Processing.js meetup at Bocoup, we met with <a href="http://twitter.com/shepazu">Doug Schepers</a> from the W3C.  He loved our stuff, and was talking to us about ideas that would be cool to build.  He pulled out his iPhone and showed us <a href="http://vimeo.com/2184392">Brian Eno&#8217;s Bloom</a> audio app.  &#8220;It would be cool to do this in the browser.&#8221;  Yeah, it is cool, and here it is, written in a <a href="http://code.bocoup.com/bloop/color/bloop.html">few hundred lines of JavaScript and Processing.js</a> (<a href="http://vimeo.com/11346141">video 1</a>, <a href="http://vimeo.com/11345133">video 2</a>):</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=11346141&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=11346141&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=11345133&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=11345133&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>This demo also showcases the awesome work of <a href="http://felipe.wordpress.com/">Felipe Gomes</a>, who has a patch to add <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=508906">multi-touch DOM events to Firefox</a>.  The method we&#8217;ve used here can be taken a lot further.  Imagine being able to connect multiple browsers together for collaborative music creation, layering other audio underneath, mixing fragments vs. just oscillators, etc.  We built this one in a week, and the web is capable of a lot more.</p>
<p>One of the main points of our talk was to emphasize that what we&#8217;re talking about here isn&#8217;t just a concept, and it isn&#8217;t some far away future.  This is real code, running in a real browser, and it&#8217;s all being done in HTML5 and JavaScript.  The web is fast enough to do real-time audio processing now, powerful enough and expressive enough to create music.  And the community of digital music and audio hackers, visualizers, etc. are hungry for it.  So hungry that they are seeking us out, downloading our hacked builds and creating gorgeous web audio applications.</p>
<p>We want to keep going, and we need help.  We need help from those within Mozilla, the W3C, and other browsers to get this stuff into shipping browsers.  We need the audio, digital music, accessibility, and web communities to come together in order to help us build js audio libraries and more sample applications.  Yesterday <a href="http://twitter.com/joehewitt/status/13090747143">Joe Hewitt was talking on twitter</a> about how web browser vendors need to experiment more with non-standard APIs.  I couldn&#8217;t agree more, and here&#8217;s a chance for people to put their money where their mouth is.  Let&#8217;s make audio a scriptable part of the open web.</p>
<p>I&#8217;m currently creating new builds of our updated patch for Firefox, and will post links to them here when I&#8217;m done.  You can read more about the technical details of our work <a href="https://wiki.mozilla.org/Audio_Data_API">here</a>, and get involved in the bug <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=490705">here</a>.  You can talk more with me on irc in the <a href="irc://irc.mozilla.org/processing.js">processing.js channel</a> (I&#8217;m <em>humph</em> on moznet), or talk to me on twitter (<a href="http://twitter.com/humphd">@humphd</a>) or by <a href="mailto:david.humphrey@senecac.on.ca">email</a>.  One way or another, get in touch so you can help us push this forward.</p>
]]></content:encoded>
			<wfw:commentRss>http://vocamus.net/dave/?feed=rss2&amp;p=1074</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>We make stuff</title>
		<link>http://vocamus.net/dave/?p=1069</link>
		<comments>http://vocamus.net/dave/?p=1069#comments</comments>
		<pubDate>Wed, 21 Apr 2010 00:57:42 +0000</pubDate>
		<dc:creator>david.humphrey</dc:creator>
				<category><![CDATA[Come on!]]></category>
		<category><![CDATA[Digital Swag]]></category>
		<category><![CDATA[Home School]]></category>
		<category><![CDATA[Mozilla Education]]></category>
		<category><![CDATA[Teaching Open Source]]></category>
		<category><![CDATA[family]]></category>

		<guid isPermaLink="false">http://vocamus.net/dave/?p=1069</guid>
		<description><![CDATA[I had dinner last week with a few friends, and one of the things we discussed was cognitive surplus.  I commented on the recent explosion of tweets and blog posts about the iPad, and how it will usher in the end of tinkering as we know and love it.  It&#8217;s a sentiment I share, but [...]]]></description>
			<content:encoded><![CDATA[<p>I had dinner last week with a few friends, and one of the things we discussed was <a href="http://www.cognitivesurplus.com/">cognitive surplus</a>.  I commented on the recent explosion of tweets and blog posts about the iPad, and how it will usher in the <a href="http://benfry.com/writing/archives/608">end of tinkering</a> as we know and love it.  It&#8217;s a sentiment I share, but what struck me most about this recent vociferousness cry of the mob was that too few of them are actually making things today on the computers and other devices they have.  As Mark Twain said, &#8220;The man who does not read good books has no advantage over the man who  can&#8217;t read them.&#8221;</p>
<p>One of my friends said that people don&#8217;t make things because it&#8217;s hard, but I don&#8217;t think it has anything to do with it being hard.  Most people don&#8217;t make things because they&#8217;ve only ever been taught how to consume.  They live in a plastic world impossible to reproduce, governed by the expert, the manufacturer, the teacher, the broadcaster, the chef.</p>
<p>But it doesn&#8217;t have to be so.  You can make stuff.  Tonight I was cleaning up after dinner, and noticed two pieces of cardboard on the table (scraps from a box), each with a perfect hole cut in the centre.  I called to our girls and handed them each one: &#8220;Make something cool with these.&#8221;  I didn&#8217;t have to say anything else.  They knew what to do next.  One made a bird house using tape, more cardboard and a pencil, with the round hole as the opening.  The other made an elaborate one-eyed mask and devised a way of moving while wearing it that made her &#8220;like a character in a story.&#8221;</p>
<p>People start out knowing how to make things.  They are taught to stop.  It takes time to refine one&#8217;s taste such that the homemade won&#8217;t do anymore.  You have to work at shutting down the desire to create and build and make.  But you can do it.  Most adults I know wouldn&#8217;t know what to do with a piece of cardboard that had a perfect circle cut out of the middle, or what to do with their laptop either.</p>
]]></content:encoded>
			<wfw:commentRss>http://vocamus.net/dave/?feed=rss2&amp;p=1069</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Watching the open web play with Processing.js</title>
		<link>http://vocamus.net/dave/?p=1043</link>
		<comments>http://vocamus.net/dave/?p=1043#comments</comments>
		<pubDate>Mon, 29 Mar 2010 16:55:00 +0000</pubDate>
		<dc:creator>david.humphrey</dc:creator>
				<category><![CDATA[CDOT]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Mozilla Education]]></category>
		<category><![CDATA[Seneca]]></category>
		<category><![CDATA[Teaching Open Source]]></category>

		<guid isPermaLink="false">http://vocamus.net/dave/?p=1043</guid>
		<description><![CDATA[As we get closer to finishing Processing.js, it&#8217;s awesome to watch people doing new things with it.  Building a technology on the open web means new ways of interaction and deployment suddenly become possible.  Take, for example, Robert O&#8217;Rourke&#8217;s newly released PJSBox bookmarklet, which allows arbitrary processing code on a web page to be highlighted [...]]]></description>
			<content:encoded><![CDATA[<p>As we get closer to finishing <a href="http://processingjs.org/">Processing.js</a>, it&#8217;s awesome to watch people doing new things with it.  Building a technology on the open web means new ways of interaction and deployment suddenly become possible.  Take, for example, <a href="http://sanchothefat.com/">Robert O&#8217;Rourke&#8217;s</a> newly released <a href="http://sanchothefat.com/labs/161/pjsbox">PJSBox bookmarklet</a>, which allows arbitrary processing code on a web page to be highlighted and then run in a lightbox type interface.  The code uses jQuery to inject the necessary DOM scaffolding into the current document, before parsing and running the code in Processing.js.  It&#8217;s one of the many creative and interesting things that the open web makes possible, and I&#8217;m excited to see what&#8217;s next.</p>
]]></content:encoded>
			<wfw:commentRss>http://vocamus.net/dave/?feed=rss2&amp;p=1043</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Processing.js 0.7, plus ref tests with canvas</title>
		<link>http://vocamus.net/dave/?p=1039</link>
		<comments>http://vocamus.net/dave/?p=1039#comments</comments>
		<pubDate>Thu, 25 Mar 2010 02:34:40 +0000</pubDate>
		<dc:creator>david.humphrey</dc:creator>
				<category><![CDATA[CDOT]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Mozilla Education]]></category>
		<category><![CDATA[Seneca]]></category>
		<category><![CDATA[Teaching Open Source]]></category>

		<guid isPermaLink="false">http://vocamus.net/dave/?p=1039</guid>
		<description><![CDATA[Today we finished final testing for Processing.js 0.7 and released it for download.  It represents a lot of hard work by an ever growing community of developers.  This release once again focuses on feature parity with Processing, as well as bug fixes.  We&#8217;ve added some big new features, like PImage and image loading, as well [...]]]></description>
			<content:encoded><![CDATA[<p>Today we finished final testing for Processing.js 0.7 and <a href="http://processingjs.org/blog/?p=220">released it for download</a>.  It represents a lot of hard work by an ever growing community of developers.  This release once again focuses on feature parity with <a href="http://processing.org/">Processing</a>, as well as bug fixes.  We&#8217;ve added some big new features, like <a href="http://processing.org/reference/PImage.html">PImage</a> and image loading, as well as support for Processing&#8217;s synchronous loading model in the browser via a new language directive.  We&#8217;ve also continued to finish WebGL-based 3D support, adding <a href="http://processing.org/reference/beginCamera_.html">beginCamera</a>, <a href="http://processing.org/reference/endCamera_.html">endCamera</a>, <a href="http://processing.org/reference/curveVertex_.html">curveVertex</a>, <a href="http://processing.org/reference/dist_.html">dist</a>, <a href="http://processing.org/reference/curve_.html">curve</a>, <a href="http://processing.org/reference/ambientLight_.html">ambientLight</a>, <a href="http://processing.org/reference/pointLight_.html">pointLight</a>, <a href="http://processing.org/reference/noLights_.html">noLights</a>, <a href="http://processing.org/reference/noLights_.html">directionalLight</a>, and <a href="http://processing.org/reference/box_.html">box</a>.  Our <a href="https://processing-js.lighthouseapp.com/projects/41284/3droadmap">roadmap</a> for adding full 3D support is just about at an end, which is a great feeling.  We&#8217;ve also worked on many parser, language, and API bugs that people have been submitting (thanks to those that are filing them).</p>
<p>This release also introduces another layer of <a href="https://processing-js.lighthouseapp.com/projects/41284/writing-automated-tests">automated tests for the project</a>: ref tests.  We&#8217;ve had automated parser and unit tests for quite a few releases (there are over 1,200 tests in 0.7), but we were still having to manually inspect the results of our drawing code; and when you&#8217;re porting a graphics language, there are a lot of drawing tests.  We ended-up implementing an automated canvas 2D and 3D pixel-based ref test system.  The process works like this:</p>
<ol>
<li>Write a visual test (processing code) and make sure the native Processing (Java) and Processing.js are the same (visual inspection).</li>
<li>Generate a ref test using a <a href="http://scotland.proximity.on.ca/dxr/tmp/processing-ref-tests-3d/tools/processing-helper.html">web-based tool</a>.  The ref test is made by running the code, then extracting pixel data from the canvas and putting it in a comment in the code.  The file is then saved (code + bitmap pixel data) to a .pde file.</li>
<li>A <a href="http://scotland.proximity.on.ca/dxr/tmp/processing-ref-tests-3d/test/ref/">web-based ref test runner</a> reads in the test files and does 3 things.  First, draw the pixels back to a canvas using ImageData and putImageData.  Second, run the processing code to produce a live sketch.  Third do a visual pixel diff, comparing the two canvases.</li>
</ol>
<p>Doing a comparison between the pixels of two canvases is easy for 2D, and a bit more complicated for 3D (Andor has a <a href="http://asalga.wordpress.com/2010/03/19/compensating-for-webgl-readpixels-implementation-inconsistencie/">great post about his 3D method in WebGL</a>).  Using a reference image generated by another browser on another OS and having it match *this* browser/OS combo?  That&#8217;s harder.  To compensate for differences in rendering and canvas implementations, we apply a Gaussian blur in JavaScript to the two sets of pixels.  We then compare the colour values using a colour tolerance.  Our initial testing used 2% but further testing points to needing 5% (e.g., 0.02 * 255).</p>
<p>And it works!  We only recently got the ref test infrastructure in place, so don&#8217;t have many tests yet (15 at present).  However, today, we caught our first bug using them: a recent check-in that changed curveVertex broke how we interpret control points.  Here&#8217;s what it looked like when it failed (red pixels are differences):</p>
<p><a title="Automated Ref Tests find a bug in Processing.js by humphd, on Flickr" href="http://www.flickr.com/photos/11280278@N04/4460669832/"><img src="http://farm3.static.flickr.com/2660/4460669832_15c7ce0797_o.png" alt="Automated Ref Tests find a bug in Processing.js" width="424" height="406" /></a></p>
<p>This technique is already saving us a lot of time as we test our code on Firefox, Minefield, Safari, Chrome, Opera and on Windows, Linux, Mac, and mobile OSes.  I think other people doing visual work with canvas should explore this method.  You can try it out for yourself <a href="http://scotland.proximity.on.ca/dxr/tmp/processing-ref-tests-3d/test/ref/">here</a>, and see code <a href="http://github.com/jeresig/processing-js/blob/master/test/ref/index.html">here</a>.  Thanks to Andor, Yury, and Corban for their work with me to get this working.</p>
]]></content:encoded>
			<wfw:commentRss>http://vocamus.net/dave/?feed=rss2&amp;p=1039</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Understanding the cost of arrays with canvas</title>
		<link>http://vocamus.net/dave/?p=1035</link>
		<comments>http://vocamus.net/dave/?p=1035#comments</comments>
		<pubDate>Mon, 22 Mar 2010 15:46:14 +0000</pubDate>
		<dc:creator>david.humphrey</dc:creator>
				<category><![CDATA[CDOT]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Mozilla Education]]></category>
		<category><![CDATA[Seneca]]></category>
		<category><![CDATA[Teaching Open Source]]></category>

		<guid isPermaLink="false">http://vocamus.net/dave/?p=1035</guid>
		<description><![CDATA[Yesterday, Daniel and I spent a bunch of time optimizing his patch to add PImage to processing.js.  One of the many things it allows you to do is operate on the pixels of an image &#8220;off screen,&#8221; then draw all or some of the resulting image.  To implement this on top of canvas we have [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, Daniel and I spent a bunch of time optimizing his patch to add <a href="http://processing.org/reference/PImage.html">PImage</a> to <a href="http://processingjs.org/">processing.js</a>.  One of the many things it allows you to do is operate on the pixels of an image &#8220;off screen,&#8221; then draw all or some of the resulting image.  To implement this on top of canvas we have to work with <a href="https://developer.mozilla.org/En/HTML/Canvas/Pixel_manipulation_with_canvas">getImageData and putImageData</a>.  It turns out that how you do this is really important for performance.</p>
<p>In one of his test cases, he had a series of large images that were being flipped through as a slideshow.  Processing provides a <a href="http://processing.org/reference/draw_.html">draw()</a> function, which is basically a loop allowing for animation to take place: whatever you do in draw() happens at the specified frame rate.  Or, it tries to run at that rate.  When we ran the test with his initial code, we were getting ~6 fps which seemed&#8230;slow.  After a bunch of profiling and debugging, we got that to 80-100 fps.</p>
<p>I took a look at his test case under Shark (Benjamin has a <a href="http://benjamin.smedbergs.us/blog/2008-09-04/profiling-dromaeo-testcases-with-shark/">great post on how to use it</a>) and noticed that we were spending 9.8% of our time in <a href="http://mxr.mozilla.org/mozilla-central/source/js/src/jsarray.cpp#3535">js_CoerceArrayToCanvasImageData</a>.  Reading through the code it started to make sense.  In Daniel&#8217;s code, he had constructed his own ImageData object using a js array:</p>
<pre>var imgData = {data: [], width: w, height: h};</pre>
<p>Then, whenever he needed to alter pixels, he&#8217;d set imgData.data[n] as usual before updating the canvas:</p>
<pre>putImageData(imgData, 0, 0);</pre>
<p>On paper it looks good.  But it&#8217;s not fast.  Every time you do this (and we have to do it a lot, and as fast as possible), the canvas context looks at the data array, sees that it&#8217;s just a js array, and then coerces it into the proper type.  And that takes time.</p>
<p>I <a href="http://scotland.proximity.on.ca/dxr/tmp/imagedata-test.html">wrote a little test</a> to demonstrate the issue.  This test picks 100 random gray scale colours and draws them one-by-one, pixel-by-pixel, to a 400 x400 canvas.  It does it first by using a custom ImageData object with a normal js array, then using a native ImageData object, returned via getImageData (NOTE: Opera doesn&#8217;t support createImageData, so I&#8217;ve used getImageData so I could test this on various browsers).  Here&#8217;s what I see on my MacBook Pro running OS X 10.6:</p>
<table border="0">
<tbody>
<tr>
<th>Browser</th>
<th>JS Array Time/Run</th>
<th>Native Array Time/Run</th>
</tr>
<tr>
<td>Firefox 3.6</td>
<td>48.9ms</td>
<td>48.46</td>
</tr>
<tr>
<td>Firefox Trunk</td>
<td>15.85ms</td>
<td>8.95ms</td>
</tr>
<tr>
<td>Chrome</td>
<td>Unsupported</td>
<td>51.87ms</td>
</tr>
<tr>
<td>Safari</td>
<td>Unsupported</td>
<td>9.3ms</td>
</tr>
<tr>
<td>Opera</td>
<td>1460.08ms</td>
<td>296.24ms</td>
</tr>
</tbody>
</table>
<p>Right off the top, if you want this to work across all browsers supporting canvas, you shouldn&#8217;t use custom objects with js arays&#8211;it won&#8217;t work on WebKit.  But ignoring that, you shouldn&#8217;t do this on those browsers that do support it because you pay a big price.  It&#8217;s not surprising to see Firefox 3.6 showing no big difference between the two methods, since Vlad&#8217;s WebGL arrays aren&#8217;t in there.  But you can really see the effect in a trunk build that has them, which is faster than any other browser I tested (NOTE: I didn&#8217;t test the equivalent trunk builds for the other browsers, just releases).</p>
<p>As with all performance tests, please don&#8217;t take this as the final word, or generalize this as though I&#8217;m saying something about canvas performance in general.  I&#8217;m talking very specifically about the pixel array container you choose, and the numbers all lean toward using getImageData over [].  It&#8217;s a 6 fps vs. 80-100 fps kind of choice in our case.  Not a hard decision.</p>
]]></content:encoded>
			<wfw:commentRss>http://vocamus.net/dave/?feed=rss2&amp;p=1035</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Processing.js 0.6 Released</title>
		<link>http://vocamus.net/dave/?p=1025</link>
		<comments>http://vocamus.net/dave/?p=1025#comments</comments>
		<pubDate>Sat, 27 Feb 2010 00:47:27 +0000</pubDate>
		<dc:creator>david.humphrey</dc:creator>
				<category><![CDATA[CDOT]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Mozilla Education]]></category>
		<category><![CDATA[Seneca]]></category>
		<category><![CDATA[Teaching Open Source]]></category>

		<guid isPermaLink="false">http://vocamus.net/dave/?p=1025</guid>
		<description><![CDATA[We&#8217;ve just released Processing.js 0.6, and with it a bunch of bug fixes and more WebGL-based 3D support.  You can download it here, and read the full blog-post here.  We had hoped to get a rewrite of the color implementation in this time, which will bring with it some nice performance gains, but that is [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve just released <a href="http://processingjs.org/download">Processing.js 0.6</a>, and with it a bunch of bug fixes and more WebGL-based 3D support.  You can download it <a href="http://processingjs.org/download">here</a>, and read the full blog-post <a href="http://processingjs.org/blog/?p=213">here</a>.  We had hoped to get a rewrite of the color implementation in this time, which will bring with it some nice performance gains, but that is going to slip to 0.7.  If you&#8217;re using Processing.js, please <a href="http://processing-js.lighthouseapp.com/projects/41284-processingjs/overview">file bugs</a> and show us what you&#8217;re building.</p>
]]></content:encoded>
			<wfw:commentRss>http://vocamus.net/dave/?feed=rss2&amp;p=1025</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
