<?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>ForestMist &#187; Programming</title>
	<atom:link href="http://forestmist.org/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://forestmist.org</link>
	<description></description>
	<lastBuildDate>Tue, 11 Oct 2011 03:17:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>HTML5 Audio Loops</title>
		<link>http://forestmist.org/2010/04/html5-audio-loops/</link>
		<comments>http://forestmist.org/2010/04/html5-audio-loops/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 00:02:01 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Browser]]></category>

		<guid isPermaLink="false">http://forestmist.org/?p=1102</guid>
		<description><![CDATA[One of the neatest things about HTML5 is support for the new &#60;audio&#62; tag. Like &#60;video&#62; it allows you to natively support media in good browsers like Chrome, FireFox, Opera and Safari. Add a touch of JavaScript and a new era of  media applications become possible. Synthesizers, music trackers and games require seamless audio loops though [...]]]></description>
			<content:encoded><![CDATA[<p>One of the neatest things about HTML5 is support for the new &lt;audio&gt; tag. Like &lt;video&gt; it allows you to natively support media in good browsers like Chrome, FireFox, Opera and Safari. Add a touch of JavaScript and a new era of  media applications become possible.</p>
<p>Synthesizers, music trackers and games require seamless audio loops though so we need something a bit simpler for our first foray into HTML5 audio.</p>
<p>Oooh, how about a retro beatbox with individual track adjustments (start/stop/loop/volume) that could be used to build a unique soundscape from many separate instruments. Perfect!</p>
<p>Fantasy can only become reality through hard work so let&#8217;s get started with some tests first.</p>
<h2>Loop Method 1</h2>
<pre><audio id="audio_1" controls preload loop>
	<source src="/wp-content/uploads/2010/04/html5-audio-loop.ogg">
	<source src="/wp-content/uploads/2010/04/html5-audio-loop.wav">
	<source src="/wp-content/uploads/2010/04/html5-audio-loop.mp3">
</audio></pre>
<p>Uses the &#8216;loop&#8217; property.</p>
<pre class="brush: xml; title: ; notranslate">&lt;audio id=&quot;audio_1&quot; controls preload loop&gt;
	&lt;source src=&quot;/wp-content/uploads/2010/04/html5-audio-loop.ogg&quot;&gt;
	&lt;source src=&quot;/wp-content/uploads/2010/04/html5-audio-loop.wav&quot;&gt;
	&lt;source src=&quot;/wp-content/uploads/2010/04/html5-audio-loop.mp3&quot;&gt;
&lt;/audio&gt;</pre>
<h2>Loop Method 2</h2>
<pre><audio id="audio_2" controls preload>
	<source src="/wp-content/uploads/2010/04/html5-audio-loop.ogg">
	<source src="/wp-content/uploads/2010/04/html5-audio-loop.wav">
	<source src="/wp-content/uploads/2010/04/html5-audio-loop.mp3">
</audio></pre>
<p>Uses a JavaScript function to loop when an &#8216;ended&#8217; event is called.</p>
<pre class="brush: xml; title: ; notranslate">&lt;audio id=&quot;audio_2&quot; controls preload&gt;
	&lt;source src=&quot;/wp-content/uploads/2010/04/html5-audio-loop.ogg&quot;&gt;
	&lt;source src=&quot;/wp-content/uploads/2010/04/html5-audio-loop.wav&quot;&gt;
	&lt;source src=&quot;/wp-content/uploads/2010/04/html5-audio-loop.mp3&quot;&gt;
&lt;/audio&gt;</pre>
<pre class="brush: jscript; title: ; notranslate">
document.getElementById('audio_2').addEventListener('ended', function(){
this.currentTime = 0;
}, false);
</pre>
<h2>Loop Method 3</h2>
<pre><audio id="audio_3" controls preload>
	<source src="/wp-content/uploads/2010/04/html5-audio-loop.ogg">
	<source src="/wp-content/uploads/2010/04/html5-audio-loop.wav">
	<source src="/wp-content/uploads/2010/04/html5-audio-loop.mp3">
</audio>
<audio id="audio_4" controls preload>
	<source src="/wp-content/uploads/2010/04/html5-audio-loop.ogg">
	<source src="/wp-content/uploads/2010/04/html5-audio-loop.wav">
	<source src="/wp-content/uploads/2010/04/html5-audio-loop.mp3">
</audio></pre>
<p>Uses two JavaScript functions and two audio elements with the same source to alternate playback duties.</p>
<pre class="brush: xml; title: ; notranslate">&lt;audio id=&quot;audio_3&quot; controls preload&gt;
	&lt;source src=&quot;/wp-content/uploads/2010/04/html5-audio-loop.ogg&quot;&gt;
	&lt;source src=&quot;/wp-content/uploads/2010/04/html5-audio-loop.wav&quot;&gt;
	&lt;source src=&quot;/wp-content/uploads/2010/04/html5-audio-loop.mp3&quot;&gt;
&lt;/audio&gt;
&lt;audio id=&quot;audio_4&quot; controls preload&gt;
	&lt;source src=&quot;/wp-content/uploads/2010/04/html5-audio-loop.ogg&quot;&gt;
	&lt;source src=&quot;/wp-content/uploads/2010/04/html5-audio-loop.wav&quot;&gt;
	&lt;source src=&quot;/wp-content/uploads/2010/04/html5-audio-loop.mp3&quot;&gt;
&lt;/audio&gt;</pre>
<pre class="brush: jscript; title: ; notranslate">document.getElementById('audio_3').addEventListener('ended', function(){
this.currentTime = 0;
this.pause();
document.getElementById('audio_4').play();
}, false);

document.getElementById('audio_4').addEventListener('ended', function(){
this.currentTime = 0;
this.pause();
document.getElementById('audio_3').play();
}, false);</pre>
<pre><script type="text/javascript">		document.getElementById('audio_2').addEventListener('ended', function(){
this.currentTime = 0;
}, false);

document.getElementById('audio_3').addEventListener('ended', function(){
this.currentTime = 0;
this.pause();
document.getElementById('audio_4').play();
}, false);

document.getElementById('audio_4').addEventListener('ended', function(){
this.currentTime = 0;
this.pause();
document.getElementById('audio_3').play();
}, false);
</script></pre>
<h2>Browser Support</h2>
<p>Tests were done on Windows 7 with Chrome 5.0.342.9 beta, FireFox 3.6.3, Internet Explorer 9.0 Preview, Opera 10.51 and Safari 4.0.5. </p>
<p><strong>Chrome</strong> seems to trigger loops before the current sound is completely finished leading to some odd jumpiness. All loop methods are affected.</p>
<p><strong>FireFox</strong> doesn&#8217;t seem to like the &#8216;loop&#8217; property of method 1, odd. Method 2 has the slightest of delays between loops and method 3 was actually perfect! I didn&#8217;t believe it until verification at the millisecond level with <a href="http://audacity.sourceforge.net/">Audacity</a>. Hooray Mozilla!</p>
<p><strong>Internet Explorer 9</strong> doesn&#8217;t support the audio tag yet. Hopefully it will before an official release.</p>
<p><strong>Opera</strong> performs almost as well as FireFox although there is still a small delay even when using method 3.</p>
<p><strong>Safari</strong> seems slow to start playback which is very easy to detect once you hear a loop. All loop methods affected.</p>
<p>Feedback on other browsers/OS compatibility would be very interesting so please feel free to discuss any findings in the comments below.</p>
<h2>Final Thoughts</h2>
<p>As of right now (April 11, 2010) only FireFox can do a perfect loop by cheating a bit and using two &lt;audio&gt; elements with JavaScript.</p>
<p>So yeah, it&#8217;s a bit too early for HTML5 audio loops but don&#8217;t let that stop you from creating sound boards, media players and other fun things.</p>
<p>Hopefully with some more optimizations audio support will continue to improve and a HTML5 beatbox fantasy can become reality.</p>
<p>Until then there are plenty of other fun things to play with.</p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://forestmist.org/2010/04/html5-audio-loops/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>Aha, gotcha!</title>
		<link>http://forestmist.org/2003/10/aha-gotcha/</link>
		<comments>http://forestmist.org/2003/10/aha-gotcha/#comments</comments>
		<pubDate>Tue, 21 Oct 2003 04:33:23 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://forestmist.org/?p=571</guid>
		<description><![CDATA[Squished two bugs in the Lifestone forum. The first was an annoying yet harmless index not defined message. The second was a bug in the Page 1, 2 link code for longer threads. In certain situations with 10 replies, the paging code would not count the topic in it&#8217;s logic. This would cause the topic [...]]]></description>
			<content:encoded><![CDATA[<p>Squished two bugs in the Lifestone forum. The first was an annoying yet harmless index not defined message. The second was a bug in the Page 1, 2 link code for longer threads. In certain situations with 10 replies, the paging code would not count the topic in it&#8217;s logic. This would cause the topic and 9 messages show up on the first page with no links to the second page which contained the 10th reply. I&#8217;m happy to say it&#8217;s all fixed now and thanks to Parr for spotting that one. <img src='http://forestmist.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>In other programming news, I&#8217;m happy to report that my super ultra magic secret project is coming along great. I can&#8217;t reveal too much about it yet but let me just say that it involves <a href="http://www.adobe.com/products/flash/">Flash</a>, <a href="http://www.php.net/">PHP</a> and <a href="http://www.mysql.com/">MySQL</a> working in unison. It&#8217;s also surprisingly efficient and will help everyone in the Lifestone communicate better than ever before.</p>
<p>If you think you know what I&#8217;m working on send me an email with your idea to {email expired}. Close guesses will get their Lifestone accounts upgraded to beta level access which will let you play around with my new creation before it officially comes out for everyone.</p>
<p>Mystery adds so more more excitement than simply surprising you doesn&#8217;t it?</p>
]]></content:encoded>
			<wfw:commentRss>http://forestmist.org/2003/10/aha-gotcha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tweak Tweak Tweak</title>
		<link>http://forestmist.org/2003/09/tweak-tweak-tweak/</link>
		<comments>http://forestmist.org/2003/09/tweak-tweak-tweak/#comments</comments>
		<pubDate>Sun, 28 Sep 2003 04:53:17 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://forestmist.org/?p=590</guid>
		<description><![CDATA[Finally fixed the missing looping texture behind the Lifestone graphic to the top right. That&#8217;s been bugging me for like a year now, just never got around to fixing it. I also changed all php include() statements to require(). English translation of that is a minor speed boost for all pages on the site, woot. [...]]]></description>
			<content:encoded><![CDATA[<p>Finally fixed the missing looping texture behind the Lifestone graphic to the top right. That&#8217;s been bugging me for like a year now, just never got around to fixing it. <img src='http://forestmist.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I also changed all php <a href="http://us2.php.net/manual/en/function.include.php">include()</a> statements to <a href="http://php.net/require">require()</a>. English translation of that is a minor speed boost for all pages on the site, woot.</p>
<p>Other misc updates include more code for the private messaging function. (I can only private message myself for testing which makes for very strange conversations, hehe.) Cleaning up some unused files from an the older odinsrealm and other minor tweaks.</p>
<p>I know it&#8217;s not the <a href="http://www.cockeyed.com/">best site in the world</a> or even the <a href="http://www.dansdata.com/">best site in australia</a> but it&#8217;s my site and I love working on it. It makes me feel like I&#8217;m giving something of myself back to the world. That and I do have some very specific plans to create some web things that you&#8217;ve never seen anywhere before. Muhahaha!</p>
<p>No it doesn&#8217;t involve <a href="http://www.marshmallowpeeps.com">marshmallow peeps</a> but it will be just as adorable.</p>
]]></content:encoded>
			<wfw:commentRss>http://forestmist.org/2003/09/tweak-tweak-tweak/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mod Reader v000 launched!</title>
		<link>http://forestmist.org/2003/06/mod-reader-v000-launched/</link>
		<comments>http://forestmist.org/2003/06/mod-reader-v000-launched/#comments</comments>
		<pubDate>Sun, 22 Jun 2003 05:37:14 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://forestmist.org/?p=518</guid>
		<description><![CDATA[It&#8217;s here, the thing I&#8217;ve been working on for more than a month of countless nights. It&#8217;s a PHP mod file reader and it works bloody great! The project started when I was thinking about hosting my old mod collection so that others could enjoy it. I wanted to make it a bit more informative [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s here, the thing I&#8217;ve been working on for more than a month of countless nights. It&#8217;s a <a href="http://www.php.net">PHP</a> mod file reader and it works bloody great!</p>
<p>The project started when I was thinking about hosting my old mod collection so that others could enjoy it. I wanted to make it a bit more informative than a directory listing though. I wanted to display the song title from inside the file, channels and file size.</p>
<p>After reading up on the mod file format and opening my mind to new concepts, I did just that. I created a nice little php script that could open and parse the mod file format and return the info I wanted. But wait&#8230; there was more goodies buried in the format. Things like the sample list which frequently contains messages from the author plus there was the holy grail, estimating the song length.</p>
<p>I kept working on more features each night, after a bit I was able to read the sample list messages, sample size, loop info and more. Things were going really well and I was learning a lot of new programming skills reading through these binary files. I decided that I would try to loop through all the pattern data and figure out how long each song is. What a quest it would be.</p>
<p>I started our reading the first note position then move on to different channels, rows and then finally patterns. I kept adding new functionality each night. An order reader, recording speed/bpm changes, delay effects, order jumps, pattern jumps and eventually odd song loops. It took me countless hours of work and quite a few major code changes along the way. Each problem brought with it more puzzles and eventual enlightenment when I figured out what was going on.</p>
<p>I can truly say I feel more like a programmer now more than ever. I&#8217;ve taken my lust for knowledge applied to to my beloved music collection and learned a lot of stuff along the way. I feel one step closer to my ultimate dream of becoming a video game programmer. I don&#8217;t know how long it will take or if I&#8217;ll even be successful but I know I&#8217;ll enjoy the quest and I will make a video game one day.</p>
<p>So without further ado please check out the new Music section which contains over 200 mod songs. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://forestmist.org/2003/06/mod-reader-v000-launched/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

