<?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>Evan Lenz &#187; Programming</title>
	<atom:link href="http://evanlenz.net/blog/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://evanlenz.net/blog</link>
	<description>XSLT et cetera</description>
	<lastBuildDate>Tue, 27 Oct 2009 21:28:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>I&#8217;ve started another blog</title>
		<link>http://evanlenz.net/blog/2009/10/27/ive-started-another-blog/</link>
		<comments>http://evanlenz.net/blog/2009/10/27/ive-started-another-blog/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 21:28:30 +0000</pubDate>
		<dc:creator>Evan</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://evanlenz.net/blog/?p=141</guid>
		<description><![CDATA[Check it out here: Lenz on Learning: Reflections on parenting, education, kids, and creativity. Here are the article titles so far:

&#8220;Mastery&#8221; (Part 1, Part 2, and Part 3)
Reasoning with a 3-year-old
Mimsy Sadofsky on play and talking
Appreciating your own kids

I&#8217;ll probably still blog here on miscellaneous topics on an occasional basis (as always), so feel free [...]]]></description>
			<content:encoded><![CDATA[<p>Check it out here: <a href="http://lenzonlearning.com/">Lenz on Learning: Reflections on parenting, education, kids, and creativity</a>. Here are the article titles so far:</p>
<ul>
<li>&#8220;Mastery&#8221; (<a href="http://lenzonlearning.com/2009/10/mastery-part-1/">Part 1</a>, <a href="http://lenzonlearning.com/2009/10/mastery-part-2/">Part 2</a>, and <a href="http://lenzonlearning.com/2009/10/mastery-part-3/">Part 3</a>)</li>
<li><a href="http://lenzonlearning.com/2009/10/reasoning-with-a-3-year-old/">Reasoning with a 3-year-old</a></li>
<li><a href="http://lenzonlearning.com/2009/10/on-the-importance-of-play-and-talking/">Mimsy Sadofsky on play and talking</a></li>
<li><a href="http://lenzonlearning.com/2009/10/hello-world/">Appreciating your own kids</a></li>
</ul>
<p>I&#8217;ll probably still blog here on miscellaneous topics on an occasional basis (as always), so feel free to subscribe to both.</p>
]]></content:encoded>
			<wfw:commentRss>http://evanlenz.net/blog/2009/10/27/ive-started-another-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Watching The Atheism Tapes</title>
		<link>http://evanlenz.net/blog/2009/10/11/watching-the-atheism-tapes/</link>
		<comments>http://evanlenz.net/blog/2009/10/11/watching-the-atheism-tapes/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 04:44:18 +0000</pubDate>
		<dc:creator>Evan</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://evanlenz.net/blog/?p=132</guid>
		<description><![CDATA[I just began watching The Atheism Tapes (on Netflix), by Jonathan Miller, a series of interviews with prominent atheist intellectuals. In the first episode, Colin McGinn reviews some standard arguments for and against the existence of God.
He puts forward lack of positive evidence as his principal reason for not believing that God exists. Paraphrasing Bertrand [...]]]></description>
			<content:encoded><![CDATA[<p>I just began watching <em><a href="http://en.wikipedia.org/wiki/The_Atheism_Tapes">The Atheism Tapes</a></em> (on Netflix), by Jonathan Miller, a series of interviews with prominent atheist intellectuals. In the first episode, Colin McGinn reviews some standard arguments for and against the existence of God.</p>
<p>He puts forward lack of positive evidence as his principal reason for not believing that God exists. Paraphrasing Bertrand Russell, he says, &#8220;there&#8217;s no more reason to believe in the Christian God than in the Greek gods.&#8221; I think this is a silly assertion. Nobody believes in the Greek gods today. However, many millions of people <em>do</em> believe in the Christian God today. He may not think that&#8217;s a good enough reason <em>to</em> believe in God, but it&#8217;s a big jump to say there&#8217;s &#8220;no evidence&#8221;. If he&#8217;s talking scientific evidence, then I grant him the argument. Scientific evidence is a very narrow sort of evidence, as science is a very narrow sort of inquiry. But the continuing faith of millions over thousands of years does constitute <em>some</em> sort of evidence.</p>
<p>Later in the interview, he admits that people do have a sort of &#8220;cosmic loneliness&#8221;, or angst. He sees this as an explanation for why people have such a need for believing in God. The belief appears to satisfy their deep need for connection. This is another sort of evidence. You can use it to either explain people&#8217;s need to believe despite God&#8217;s non-existence, or you can view it as another sort of evidence for God&#8212;a being which, when believed in, &#8220;satisfies a deep craving in the human soul&#8221;, as McGinn puts it.</p>
<p>McGinn is most persuasive, I think, when he brings up the problem of evil. This should be truly challenging to any Christian or anyone who believes in the existence of a good, all-powerful God. Why would a good, all-powerful God let evil things happen in the world? McGinn notes the standard, ultimately unsatisifying explanation offered by theologians: God gave us free will, and we&#8217;re the ones that mess it up. Then what about natural disasters? Ultimately, the problem of evil is a real problem for faith. One of my beliefs as a Christian is that whereas God is all-knowing, we are not. And we&#8217;re not particularly meant to be. There are things we don&#8217;t understand and won&#8217;t ever understand in this life. Atrocities such as holocausts happen. There is a profound potential for evil in the human heart. These are things we have to contend with, even if we can&#8217;t fully explain them. If you&#8217;re going to believe in a religion, make sure it&#8217;s one that acknowledges and contends with the reality of suffering in the world and evil in the human heart&#8212;even if you were born into a free, wealthy society such as America where we are protected from much of the world&#8217;s suffering.</p>
<p>I have friends, family members, and colleagues who are atheists, and I want to better understand their point of view. I also want to find ways to address my doubts and to bolster my own faith in the face of unbelief. Despite my natural affinity for philosophy and philosophical arguments, I don&#8217;t put my hope in them as a primary way to grow closer to God (which <em>is</em> a primary goal of mine). They do play a minor role though; they fit in somewhere. Otherwise, I wouldn&#8217;t feel compelled to write about this topic. Just know that I haven&#8217;t even begun to expound on why I do believe, and I can&#8217;t necessarily explain all the reasons why I&#8217;m compelled to believe. (For one thing, I believe God had a large role in my choosing to believe and continue to believe, and that&#8217;s hopelessly circular from a philosophical perspective.)</p>
]]></content:encoded>
			<wfw:commentRss>http://evanlenz.net/blog/2009/10/11/watching-the-atheism-tapes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to generate GUIDs in XSLT 2.0, using Saxon.NET</title>
		<link>http://evanlenz.net/blog/2009/03/06/how-to-generate-guids-in-xslt-20-using-saxonnet/</link>
		<comments>http://evanlenz.net/blog/2009/03/06/how-to-generate-guids-in-xslt-20-using-saxonnet/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 19:47:02 +0000</pubDate>
		<dc:creator>Evan</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://evanlenz.net/blog/?p=126</guid>
		<description><![CDATA[I have a project where I need to generate file names that are GUIDs. I&#8217;m using Saxon.NET. With the help of Google, I figured out how to do that, but it wasn&#8217;t immediately obvious. Hopefully this post will make the solution easier to find for other people trying to solve the same problem.
This is just [...]]]></description>
			<content:encoded><![CDATA[<p>I have a project where I need to generate file names that are GUIDs. I&#8217;m using Saxon.NET. With the help of Google, I figured out how to do that, but it wasn&#8217;t immediately obvious. Hopefully this post will make the solution easier to find for other people trying to solve the same problem.</p>
<p>This is just one example of a .NET function you can access as an extension function in XSLT 2.0, so a more general-purpose treatment of .NET extension functions might be more useful. (I defer to <a href="http://www.saxonica.com/documentation/extensibility/dotnetextensions.html">&#8220;Writing extension functions for .NET&#8221;</a> for that.) But if you&#8217;re like me, you spend most of your coding time within the safe, comfy confines of pure XSLT. And you do very little .NET development. So to ensure your continued comfort, here&#8217;s how you can generate a GUID in Saxon.NET (relevant parts highlighted):</p>
<pre>
&lt;xsl:stylesheet version="2.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  <strong>xmlns:guid="clitype:System.Guid?partialname=mscorlib"</strong>
  exclude-result-prefixes="guid">

  &lt;xsl:output indent="yes"/>

  &lt;xsl:template match="/">
    &lt;guids>
      &lt;guid>
        &lt;xsl:value-of select="<strong>guid:NewGuid()</strong>"/>
      &lt;/guid>
      &lt;guid>
        &lt;xsl:value-of select="<strong>guid:NewGuid()</strong>"/>
      &lt;/guid>
      &lt;guid>
        &lt;xsl:value-of select="<strong>guid:NewGuid()</strong>"/>
      &lt;/guid>
    &lt;/guids>
  &lt;/xsl:template>

&lt;/xsl:stylesheet>
</pre>
<p>Here&#8217;s an example result from applying this stylesheet (to any input document):</p>
<pre>
&lt;guids>
   &lt;guid>6dbd3a72-ad74-429d-97ca-3056e8940813&lt;/guid>
   &lt;guid>cea97da4-9de5-4fb5-a35e-ba04a0dee906&lt;/guid>
   &lt;guid>41c89105-6cf7-4fd6-b17a-ed04235a4804&lt;/guid>
&lt;/guids>
</pre>
<p>All you do is call the .NET platform&#8217;s <a href="http://msdn.microsoft.com/en-us/library/system.guid.newguid.aspx">System.Guid.NewGuid() method</a> as an extension function. The function&#8217;s namespace URI identifies for Saxon what assembly and object class you&#8217;re interested in (System.Guid in this case).</p>
<p>Thanks to M. David Peterson: I found this usage buried in a code example in his lucidly-titled blog post: <a href="http://www.oreillynet.com/xml/blog/2008/04/if_oop_fp_aop_xslt_20_then_com.html">if ((OOP + FP + AOP) == XSLT 2.0) then &#8216;Composable Language&#8217; else &#8216;Try Again&#8217;</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://evanlenz.net/blog/2009/03/06/how-to-generate-guids-in-xslt-20-using-saxonnet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Some updates</title>
		<link>http://evanlenz.net/blog/2009/03/04/some-updates/</link>
		<comments>http://evanlenz.net/blog/2009/03/04/some-updates/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 01:10:00 +0000</pubDate>
		<dc:creator>Evan</dc:creator>
				<category><![CDATA[Piano]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://evanlenz.net/blog/?p=119</guid>
		<description><![CDATA[Short blog post, in bullet points:

I&#8217;m attending SXSW Interactive very soon. PianoNinja was accepted as a semi-finalist in the ScreenBurn Game Design Competition! If my presentation is selected as a finalist, I&#8217;ll get to present a live 5-minute pitch for the judges.
I&#8217;m working on a reference implementation for Inline XBRL. I had responded to their [...]]]></description>
			<content:encoded><![CDATA[<p>Short blog post, in bullet points:</p>
<ul>
<li>I&#8217;m attending <a href="http://sxsw.com/interactive">SXSW Interactive</a> very soon. PianoNinja was accepted as a <a href="http://sxsw.com/node/971">semi-finalist in the ScreenBurn Game Design Competition</a>! If my presentation is selected as a finalist, I&#8217;ll get to present a live 5-minute pitch for the judges.</li>
<li>I&#8217;m working on a reference implementation for Inline XBRL. I had responded to their <a href="http://www.xbrl.org/Announcements/Inline_XBRL_XSLT_RFP-2008-11-03.htm">RFP for XSLT style sheet for extracting XBRL 2.1 from HTML documents with embedded Inline XBRL</a>, and they chose my proposal. They&#8217;ve been very pleasant to work with, and the work is coming right along.</li>
<li>I&#8217;m also working on a really cool SVG and XSL-FO project, generating SVG-based flow-chart diagrams.</li>
<li>I&#8217;ve started Twittering. This may give me more excuses not to blog. So <a href="http://twitter.com/evanlenz">follow me</a>! Disclaimer: we&#8217;ll see how long it lasts.</li>
</ul>
<p>That&#8217;s all for now. See you again in 6 months. <img src='http://evanlenz.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://evanlenz.net/blog/2009/03/04/some-updates/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ninja pain</title>
		<link>http://evanlenz.net/blog/2008/01/22/ninja-pain/</link>
		<comments>http://evanlenz.net/blog/2008/01/22/ninja-pain/#comments</comments>
		<pubDate>Wed, 23 Jan 2008 07:42:09 +0000</pubDate>
		<dc:creator>Evan</dc:creator>
				<category><![CDATA[Piano]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://evanlenz.net/blog/2008/01/22/ninja-pain/</guid>
		<description><![CDATA[This is how the PianoNinja is feeling tonight after suffering a difficult blow:

We had a little setback involving lost code. Ironically, this happened when I was trying to set up version control to guard against this very thing. I&#8217;ve posted a message to the user&#8217;s list for the IDE that failed to give me a [...]]]></description>
			<content:encoded><![CDATA[<p>This is how the PianoNinja is feeling tonight after suffering a difficult blow:</p>
<p><img src='http://evanlenz.net/blog/wp-content/uploads/2008/01/finalninjaouch.png' alt='Out-of-sorts ninja' width="261" height="252"/></p>
<p>We had a little setback involving lost code. Ironically, this happened when I was trying to set up version control to guard against this very thing. I&#8217;ve posted a message to the user&#8217;s list for the <a href="http://www.netbeans.org">IDE</a> that failed to give me a warning before deleting all this naive user&#8217;s code, in hopes that similar mistakes by other users can be prevented. Hindsight is 20/20. I should&#8217;ve backed it up before trying to&#8230;back it up. It would also have been good to have <a href="http://www.apple.com/macosx/features/timemachine.html">Time Machine</a> set up already, but I hadn&#8217;t done that either.</p>
<p>Thankfully, I did still have an older version of the code from before I switched over to the development environment that I&#8217;m now using, so I don&#8217;t have to start <em>totally</em> all over. And you can be sure that I have already secured that code into version control on a server machine so that I can continue from now on from a solid base.</p>
<p>How bad is it? Well, we were on <a href="http://evanlenz.net/blog/2008/01/22/pianoninja-video-7-notation-consistent-note-releases/">Video #7</a>. Let&#8217;s just say we&#8217;ve now reverted back to <a href="http://evanlenz.net/blog/2008/01/07/video-3-klavarskribo-game-with-midi-keyboard/">Video #3</a>. In other words, all the code I wrote in the last two weeks is gone.</p>
<p>Maybe this is a blessing in disguise. Sure, I learned a lesson and I won&#8217;t make this mistake again. But the blessing might be that my continued dependency on MIDI files as the game&#8217;s underlying format is now that much less alluring. The MIDI crutch has been snatched out from under me. I don&#8217;t need to wrest myself from the MIDI code so I can move onto a better way. The code has wrested itself from me&#8230;</p>
<p>I was going to add bar lines tonight. Oh well, those can wait.</p>
<p>Before you know it, the ninja will be feeling better than ever.</p>
]]></content:encoded>
			<wfw:commentRss>http://evanlenz.net/blog/2008/01/22/ninja-pain/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PianoNinja Video #7: Notation-consistent note releases</title>
		<link>http://evanlenz.net/blog/2008/01/22/pianoninja-video-7-notation-consistent-note-releases/</link>
		<comments>http://evanlenz.net/blog/2008/01/22/pianoninja-video-7-notation-consistent-note-releases/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 08:51:06 +0000</pubDate>
		<dc:creator>Evan</dc:creator>
				<category><![CDATA[Piano]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://evanlenz.net/blog/2008/01/22/pianoninja-video-7-notation-consistent-note-releases/</guid>
		<description><![CDATA[Okay, this post is just to complete the thought I&#8217;ve been exploring over the last couple of posts. I wasn&#8217;t up for much heavy thinking tonight, so I decided to just download a free MIDI editor and normalize the durations of the notes in the Chopin Waltz MIDI file so that it had no more [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, this post is just to complete the thought I&#8217;ve been exploring over the last couple of posts. I wasn&#8217;t up for much heavy thinking tonight, so I decided to just download a <a href="http://www.anvilstudio.com/">free MIDI editor</a> and normalize the durations of the notes in the Chopin Waltz MIDI file so that it had no more staccato releases in the first section of the piece. Now the visual note releases reflect the actual notated durations (except that some Klavarskribo continuation dots are still missing; I haven&#8217;t implemented those yet). I wanted to see if this helped make it easier to &#8220;see&#8221; the beat:</p>
<div class="flvPlayer">				<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="320" height="260"><param name="movie" value="https://media.dreamhost.com/mediaplayer.swf?file=http://evanlenz.net/blog/wp-content/uploads/2008/01/klavarskribo7_320x240.flv" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><embed src="https://media.dreamhost.com/mediaplayer.swf?file=http://evanlenz.net/blog/wp-content/uploads/2008/01/klavarskribo7_320x240.flv" quality="high" wmode="transparent" width="320" height="260" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /><br />
				</object></div>
<p><a href='http://evanlenz.net/blog/wp-content/uploads/2008/01/klavarskribo7.mov' title='Video #7: Notation-consistent note releases'>Video #7: Notation-consistent note releases (Quicktime streaming)</a></p>
<p>I think it works pretty well for this piece of music. The sudden flash of each note release now coincides with the attack of the next note. I think it now looks smooth and rhythmic, which is what I was hoping for.</p>
]]></content:encoded>
			<wfw:commentRss>http://evanlenz.net/blog/2008/01/22/pianoninja-video-7-notation-consistent-note-releases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://evanlenz.net/blog/wp-content/uploads/2008/01/klavarskribo7.mov" length="1855019" type="video/quicktime" />
		</item>
		<item>
		<title>PianoNinja Video #6: Note OFF events visualized</title>
		<link>http://evanlenz.net/blog/2008/01/20/pianoninja-video-6-note-off-events-visualized/</link>
		<comments>http://evanlenz.net/blog/2008/01/20/pianoninja-video-6-note-off-events-visualized/#comments</comments>
		<pubDate>Mon, 21 Jan 2008 06:26:22 +0000</pubDate>
		<dc:creator>Evan</dc:creator>
				<category><![CDATA[Piano]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://evanlenz.net/blog/2008/01/20/pianoninja-video-6-note-off-events-visualized/</guid>
		<description><![CDATA[I haven&#8217;t made any progress since yesterday&#8217;s report, but I did finally track down our camera. This video shows what I was talking about yesterday: the MIDI Note OFF events are now visible.
				
				
Video #6: Note OFF events visualized (Quicktime streaming)
The game isn&#8217;t making any sound in this video, because I&#8217;m not playing along on the [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t made any progress since <a href="http://evanlenz.net/blog/2008/01/19/more-midi-mismatches/">yesterday&#8217;s report</a>, but I did finally track down our camera. This video shows what I was talking about yesterday: the MIDI Note OFF events are now visible.</p>
<div class="flvPlayer">				<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="320" height="260"><param name="movie" value="https://media.dreamhost.com/mediaplayer.swf?file=http://evanlenz.net/blog/wp-content/uploads/2008/01/klavarskribo6_320x240.flv" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><embed src="https://media.dreamhost.com/mediaplayer.swf?file=http://evanlenz.net/blog/wp-content/uploads/2008/01/klavarskribo6_320x240.flv" quality="high" wmode="transparent" width="320" height="260" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /><br />
				</object></div>
<p><a href='http://evanlenz.net/blog/wp-content/uploads/2008/01/klavarskribo6.mov' title='Video #6: Note OFF events visualized (Quicktime streaming)'>Video #6: Note OFF events visualized (Quicktime streaming)</a></p>
<p>The game isn&#8217;t making any sound in this video, because I&#8217;m not playing along on the MIDI keyboard. It&#8217;s easier to see the note releases when I&#8217;m not playing along and adding all the green and red colors. The piece is the same one I&#8217;ve been using for the last few demos: Chopin Waltz in E-flat, Opus 18.</p>
<p>The molasses effect of lingering notes is gone, so that&#8217;s good. But the note releases are accented too much, in that the suddenness of the notes&#8217; disappearance tends to be the most visually striking movement that&#8217;s going on. It&#8217;s also dependent on the interpretation of the person who rendered the performance in the MIDI file. My theory is that if performance-dependent note releases are ignored and instead the actual note value is reflected (regardless of whether the note should be played staccato), then the accented note releases will actually help rather than hinder the feeling of the beat, since they&#8217;ll most often coincide with the attack of the next note. I&#8217;m looking forward to testing my theory out (and then moving on past this academic theorizing).</p>
]]></content:encoded>
			<wfw:commentRss>http://evanlenz.net/blog/2008/01/20/pianoninja-video-6-note-off-events-visualized/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://evanlenz.net/blog/wp-content/uploads/2008/01/klavarskribo6.mov" length="1742243" type="video/quicktime" />
		</item>
		<item>
		<title>More MIDI mismatches</title>
		<link>http://evanlenz.net/blog/2008/01/19/more-midi-mismatches/</link>
		<comments>http://evanlenz.net/blog/2008/01/19/more-midi-mismatches/#comments</comments>
		<pubDate>Sun, 20 Jan 2008 07:58:13 +0000</pubDate>
		<dc:creator>Evan</dc:creator>
				<category><![CDATA[Piano]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://evanlenz.net/blog/2008/01/19/more-midi-mismatches/</guid>
		<description><![CDATA[Today, I tried to enable what I talked about in my last post about PianoNinja. I was able to get the MIDI Note OFF events to be reflected in each note&#8217;s visible duration: how long it remains stationary on its piano key before disappearing. (I would have posted a video, but I can&#8217;t seem to [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I tried to enable what I talked about in <a href="http://evanlenz.net/blog/2008/01/19/feeling-the-beat-in-pianoninja/">my last post about PianoNinja</a>. I was able to get the MIDI Note OFF events to be reflected in each note&#8217;s visible duration: how long it remains stationary on its piano key before disappearing. (I would have posted a video, but I can&#8217;t seem to find the camera right now, and I really need to be getting to bed earlier anyway.) I have a couple of observations:</p>
<ul>
<li>It&#8217;s much nicer than before: crisp and clean releases, but&#8230;</li>
<li>the effective duration doesn&#8217;t necessarily correspond to the actual note value.</li>
</ul>
<p>A MIDI file contains a rendition of a piece, not (necessarily) the authoritative musical information you&#8217;d need to reconstruct a score. Staccato durations, for example, get interpreted as short notes that obscure the actual notated value. I&#8217;m coming to terms with what I want PianoNinja to do: display a score (in Klavarskribo notation) that can be relied upon as containing the more-or-less canonical information that makes up the piece. While there might be <a href="http://www.classicalarchives.com/chopin.html#chopin_piano_waltzes">many and varied MIDI files</a> for the same Chopin Waltz, I don&#8217;t want PianoNinja to be subject to those variations.</p>
<p>So while I&#8217;m glad that I got the MIDI Note OFF events to be reflected, the associated note-vanishing is still a bit jumpy-looking, since they don&#8217;t always coincide with the attack of the following note. Before diving into using MusicXML instead, I might try to see what sorts of MIDI file quantization I could do to stretch each duration out for its full note value. I&#8217;m going for the path of least resistance here in keeping this project moving forward&#8212;without compromising the steady vision I have for what PianoNinja can be.</p>
]]></content:encoded>
			<wfw:commentRss>http://evanlenz.net/blog/2008/01/19/more-midi-mismatches/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Feeling the beat in PianoNinja</title>
		<link>http://evanlenz.net/blog/2008/01/19/feeling-the-beat-in-pianoninja/</link>
		<comments>http://evanlenz.net/blog/2008/01/19/feeling-the-beat-in-pianoninja/#comments</comments>
		<pubDate>Sat, 19 Jan 2008 08:28:45 +0000</pubDate>
		<dc:creator>Evan</dc:creator>
				<category><![CDATA[Piano]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://evanlenz.net/blog/2008/01/19/feeling-the-beat-in-pianoninja/</guid>
		<description><![CDATA[As I play around with PianoNinja, I&#8217;ve noticed so far that it&#8217;s fairly easy to get out of sync with the notes that I&#8217;m supposed to be playing. I tend to speed up when playing slowly, for example. (You might have noticed this in the last video I posted). Part of the problem is that [...]]]></description>
			<content:encoded><![CDATA[<p>As I play around with PianoNinja, I&#8217;ve noticed so far that it&#8217;s fairly easy to get out of sync with the notes that I&#8217;m supposed to be playing. I tend to speed up when playing slowly, for example. (You might have noticed this in <a href="http://evanlenz.net/blog/2008/01/15/pianoninja-video-5-stems-pointing-to-left-and-right/">the last video I posted</a>). Part of the problem is that I don&#8217;t have any strong cues as to where the beat falls. In games like Dance Dance Revolution, there&#8217;s a very strong beat&#8212;you simply dance to the music that you hear. Ultimately, I think PianoNinja will need auditory cues as well, whether as simple as a metronome sound or as complex as a full accompaniment. (That would make it a lot more fun too.)</p>
<p>But before I add any auditory hints, I want to see how far purely visual cues can get me. Of course, I&#8217;ve made the decision to go with <a href="http://en.wikipedia.org/wiki/Klavarskribo">Klavarskribo</a>, so the question as to what visual cues to use has largely already been answered for me. (Basically, use solid and dotted bar lines to indicate the primary and secondary beats, respectively.) But what Klavarskribo doesn&#8217;t answer is how to display the notes once they reach the point where they&#8217;re supposed to be played.</p>
<p>The simplest approach would be to just keep scrolling the manuscript right off the screen, just as if it was a roll of sheet music continuing to unwind. In other words, apart from the scrolling movement, the display would be purely static. You&#8217;d know when to play the notes only according to when they cross a given (horizontal) line, but then they&#8217;d keep on scrolling off the screen and out of sight. In that case, perhaps the most natural place for that line would be the middle of the screen rather than the top. That way, you&#8217;d be able to see the notes come and go rather than immediately scroll off the screen at the top.</p>
<p>I&#8217;ve decided to take a more dynamic approach, placing that line at the top of the screen and representing it with a picture of a piano keyboard, so that, for one thing, the relationship between the notation and the piano keyboard is immediately obvious (I hope). The dynamic aspect is that the visible note then freezes and remains stationary on its corresponding piano key for the duration that it&#8217;s supposed to be played, while all along the rest of the music continues to scroll upward. Early on, I was experimenting with a grayscale fade-out approach for representing the decay of the note&#8217;s sound, but I found that keeping it solid and stationary and then suddenly making it disappear worked nicely&#8212;especially when followed immediately by another note in the same hand. The combination of the new note stopping in its tracks and the old note vanishing in the same instant creates a certain visceral perception of the rhythm. At least that&#8217;s my suspicion and hope; I haven&#8217;t fully put it to the test. Right now, the durations are all hard-coded to the length of one beat, which doesn&#8217;t fit well with the Chopin Waltz I&#8217;ve been using in my demos. The notes all linger far too long, giving a molasses-like visual effect which doesn&#8217;t help you feel the beat at all. So I think I&#8217;ll focus next on taking care of those note durations.</p>
<p>With this approach, the most &#8220;attack-like&#8221; movement that you see is when a note ends, not when it begins. What makes it work is the fact that the disappearance of one note often coincides with the attack of the next. For that reason, it may turn out to work well for some kinds of music, but not so well for others.</p>
<p>But now I&#8217;m just speculating. First I&#8217;ll get it to work correctly and try several pieces of music with it. If I still find it to be lacking, then maybe I&#8217;ll add some kind of &#8220;flash&#8221; to each note&#8217;s attack. I&#8217;m hoping that won&#8217;t be necessary though. I like the idea of a visually spare interface that still packs a punch&#8212;like Klavarskribo itself, and, I hope, like the <a href="http://evanlenz.net/blog/2008/01/13/piano-ninja/">new PianoNinja logo</a>. <img src='http://evanlenz.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://evanlenz.net/blog/2008/01/19/feeling-the-beat-in-pianoninja/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PianoNinja file formats: MIDI or MusicXML or&#8230;</title>
		<link>http://evanlenz.net/blog/2008/01/16/pianoninja-file-formats-midi-or-musicxml-or/</link>
		<comments>http://evanlenz.net/blog/2008/01/16/pianoninja-file-formats-midi-or-musicxml-or/#comments</comments>
		<pubDate>Thu, 17 Jan 2008 01:44:03 +0000</pubDate>
		<dc:creator>Evan</dc:creator>
				<category><![CDATA[Piano]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://evanlenz.net/blog/2008/01/16/pianoninja-file-formats-midi-or-musicxml-or/</guid>
		<description><![CDATA[I&#8217;m trying to figure out what file format(s) to support in PianoNinja. Synthesia has gone the route of &#8220;blind devotion to MIDI files&#8221; and its attendant pitfalls when it comes to notating music. I&#8217;ve already gotten a glimpse of these drawbacks now that I&#8217;ve tried to add the left-hand/right-hand distinction to PianoNinja. Some MIDI files [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m trying to figure out what file format(s) to support in PianoNinja. <a href="http://www.synthesiagame.com">Synthesia</a> has gone the route of <a href="https://www.synthesiagame.com/forum/viewtopic.php?f=5&#038;t=10&#038;st=0&#038;sk=t&#038;sd=a&#038;sid=f090bdd8d37d9dc4d164d7206569ae49#p58">&#8220;blind devotion to MIDI files&#8221;</a> and its attendant pitfalls when it comes to notating music. I&#8217;ve already gotten a glimpse of these drawbacks now that I&#8217;ve tried to add the <a href="http://evanlenz.net/blog/2008/01/15/pianoninja-video-5-stems-pointing-to-left-and-right/">left-hand/right-hand distinction</a> to PianoNinja. Some MIDI files separate the hands into two different tracks, and some don&#8217;t. And there doesn&#8217;t seem to be a standard way of doing this. Also, there are other visual cues built into Klavarskribo that I want to include, like bar lines, note beams, rests, continuation dots, etc. These aren&#8217;t going to be easy to derive from simplistic MIDI ON and OFF events, especially since the best MIDI files as far as performance goes would tend to be the worst as far as deriving notation goes. That&#8217;s my suspicion anyway. I get the impression that there are features of MIDI files that could allow them to provide notational hints, but those are optional and so they can&#8217;t be totally relied on.</p>
<p><a href="http://www.recordare.com/xml.html">MusicXML</a>, on the other hand, is designed for representing musical information that can be notated. The biggest disadvantage I see of using MusicXML is that it&#8217;s not nearly as widely available as MIDI files are. Where do I go to find MusicXML files anyway? Do I have to purchase them? Do they only exist transiently on their path from Finale to Sibelius or vice versa? If I can get sufficiently past that hurdle, then it seems that I should go with MusicXML.</p>
<p>But there might be some other disadvantages to MusicXML also. Traditional notation requires you to make certain decisions about things like key signatures, whereas key signatures are optional in Klavarskribo (represented by a circle or diamond at the beginning of the piece on the relevant line for major or minor keys, as well as other shapes for different modes IIRC). Are they optional in MusicXML? Or does MusicXML force you to make certain distinctions that Klavarskribo doesn&#8217;t require? If MusicXML files were as abundant as MIDI files, I wouldn&#8217;t worry so much about this. I&#8217;d just take what I need and leave what I don&#8217;t need. But if I want to promote the proliferation of PianoNinja music across the Web, would MusicXML raise the bar too high? The purist in me doesn&#8217;t want to have to decide whether a note is B-flat or A-sharp in the underlying format when that distinction may not ever appear on the screen in PianoNinja.</p>
<p>So maybe what&#8217;s needed is a new &#8220;KlavarML&#8221; format, along with a converter from MusicXML to KlavarML (using XSLT of course). I presume there are already converters from MIDI to MusicXML (insofar as they&#8217;re able to). I don&#8217;t want to reinvent the wheel. But I also don&#8217;t want to be held back by unnecessary technological limitations. Both MIDI and MusicXML provide too much information. MIDI has lots of performance/interpretation-specific information that&#8217;s not relevant to Klavarskribo (although theoretically could be relevant to PianoNinja insofar as the scroll speed could dynamically vary, but I digress). MusicXML makes distinctions that Klavarskribo and PianoNinja do not. And MIDI doesn&#8217;t provide enough information.</p>
<p>Whether a &#8220;KlavarML&#8221; becomes an interchange format or an internal format specific to PianoNinja, I still like the idea. At the very least, the exercise of designing it would help clarify the whole domain of what it is I need to represent in PianoNinja. And it would also give me another opportunity to use <a href="http://en.wikipedia.org/wiki/RELAX_NG">RELAX NG</a>. <img src='http://evanlenz.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://evanlenz.net/blog/2008/01/16/pianoninja-file-formats-midi-or-musicxml-or/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
