tag:blogger.com,1999:blog-7907041730854363272024-03-12T19:29:36.229-07:00Ken Moore DesignFun with CodeKen Moorehttp://www.blogger.com/profile/06947879646420390697noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-790704173085436327.post-21283535610799139222014-05-04T10:00:00.001-07:002014-05-04T10:54:21.384-07:002Like all of us, I found myself quickly addicted to the game <a href="http://gabrielecirulli.github.io/2048/">2048</a>. Today, thanks to the <a href="https://www.udacity.com/course/ud248">Make Your Own 2048</a> course on Udacity.com, I've created my own variant, dubbed "2".<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://kenmoore.github.io/2"><img border="0" src="http://2.bp.blogspot.com/-Xb1lwhMcXuQ/U2Z-nVQYbNI/AAAAAAAAFDY/QdNnrFOLv2w/s1600/2-screenshot.png" height="318" width="320" /></a></div>
<br />
<br />
<br />
Enjoy!<br />
KenKen Moorehttp://www.blogger.com/profile/06947879646420390697noreply@blogger.com0tag:blogger.com,1999:blog-790704173085436327.post-87409717484144126202011-01-09T11:53:00.000-08:002011-01-09T11:56:04.743-08:00Kinect Theremin - Sneak Peek<object width="480" height="385" style="margin-left:-20px"><param name="movie" value="http://www.youtube.com/v/RHFJJRbBoLw?fs=1&hl=en_US&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/RHFJJRbBoLw?fs=1&hl=en_US&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object><br />
<br />
Not surprisingly I've contracted Kinect fever :) From the moment I heard about the Kinect I knew it would be perfect for a Theremin simulator. Well, it turns out it's not perfect, but it is super fun.<br />
<br />
<b>How does the interface work?</b><br />
When you step in front of the Kinect controller you see a contour map of yourself in gray. Once you position your hands before you they are detected and mapped to corresponding pitch (right hand z-axis), volume (left hand y-axis) and modulation (left hand x-axis). The color hue represents the pitch where C is red, D is orange, etc. The brightness of the colors represents the volume, so soft sounds are very faint where loud sounds are bright.<br />
<br />
<b>Describe the gear you're using?</b><br />
Aside from a Kinect controller and a PC, no special hardware is needed, unlike the Wii Theremin. <br />
I wrote the code in C++ for Windows using the C driver package written by Stijn Kuipers / "Zephod". The program uses only the 3D depth information to detect where the performer's hands are in space, then sends corresponding MIDI messages for pitch bend, volume and modulation. I use <a href="http://www.maplemidi.com/Maple_driver.html">Maple Virtual MIDI Cable</a> to route the messages to <a href="http://www.native-instruments.com/#/en/products/producer/absynth-5/">Absynth 5.0</a> software synthesizer by Native Instruments. Rather than sending distinct Note On / Note Off messages, the program sends a single Note On at startup and subsequently sends only Pitch Bend messages based on your hand position. Most software synthesizers don't support fluid multi-octave pitch bend, but Absynth handles this with grace.<br />
<br />
<b>So what's wrong with Kinect?</b><br />
Don't get me wrong, the Kinect is a great device - it enables applications like this where the user doesn't need to hold anything or don special gloves to control the system. However, unlike the Wii Theremin, there are some limitations to the Kinect hardware that make it more difficult to play musically. First off, the Kinect controller has significant latency (time between the user's action and the delivery of the data). I haven't done any precise measurements but it's probably 200 to 300 milliseconds, which is really tricky for an instrument that depends so heavily on player feedback to target a specific pitch. Even if you can position your hands precisely by muscle memory you need to hit the note a fraction of a second before you want the note to sound, which makes even moderately fast musical passages difficult to play.<br />
<br />
Secondly, the Kinect delivers data frames just 30 times per second so when playing a smooth glissando (slide) between two notes -- a common element in Theremin performance -- the gaps between pitches are fairly audible. The Wii Theremin, on the other hand, samples data 100 times per second so glissandos are very smooth.<br />
<br />
<b>When can I download and play with it?</b><br />
Currently I have no idea when or if I'll share the code. I'm investigating product and performance opportunities so I'm not sharing the source at this point, sorry :(<br />
<br />
<b>Where have you been since creating the Wii Theremin two years ago?</b><br />
Working on my other big <a href="http://3.bp.blogspot.com/_lzQKwpo3owc/TSlksxkYeDI/AAAAAAAAB9k/fdA6i-rWnLo/s1600/sidney.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em">work in progress</a>.Ken Moorehttp://www.blogger.com/profile/06947879646420390697noreply@blogger.com8tag:blogger.com,1999:blog-790704173085436327.post-33334161156710915432008-12-17T06:20:00.001-08:002009-01-02T10:49:03.275-08:00Wii Theremin - Santa Claus is Coming to TownThis <span style="text-decoration: line-through;">is</span> was my submission for NPR's <a href="http://www.npr.org/templates/story/story.php?storyId=98477435">National Caroling Party</a>. The gist is that people submit their own recordings of a common Christmas carol, and NPR blends selections together into the most diverse set of voices, instruments and interpretations you could imagine. When I heard about this I knew the Wii Theremin would be a perfect 'voice' to add to the choir.<br /><br /><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/2-K-7T8ZIWA&hl=en&fs=1&ap=%2526fmt%3D18&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/2-K-7T8ZIWA&hl=en&fs=1&ap=%2526fmt%3D18&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br /><br />[<em>Wondering what the heck is going on here? See my earlier post <a href="http://www.kenmooredesign.com/2008/11/wii-theremin.html">Wii Theremin - How It Works</a></em>]<br /><br />I'm sure they're inundated with very qualified entries, but my fingers are crossed that they'll pick mine to share with their listeners.<br /><br /><b>UPDATE: I heard back from the producer - I made the cut! So, if playing this video over and over just isn't enough Santa Claus is Coming to Town on the Wii Theremin for you, then be sure to tune in to All Things Considered on Sunday, December 21st to hear it again!</b><br /><br />Click here for the <a href="http://www.kenmooredesign.com/blog/content/SantaClausIsComing-KenMoore-WiiThereminOnly.mp3">mp3 of the Theremin solo</a>.<br /><br />Click here for the <a href="http://www.kenmooredesign.com/blog/content/SantaClausIsComing-KenMoore-WiiThereminAndPiano.mp3">mp3 of the Theremin with piano</a>.<br /><br />Enjoy!<br />Ken<br /><br />PS - hugs and kisses to my wife, <a href="http://www.evidentlyblog.com">Kali</a>, who lit, filmed and tolerated the many attempts it took to get it (this close to) right.<br /><br />PPS - I've just gotten a request for <b>Rudolph the Infrared-Nosed Reindeer</b>! However, Kali's eager for me to bust out Tiptoe Through the Tulips next. Should be a fun 2009 :)Ken Moorehttp://www.blogger.com/profile/06947879646420390697noreply@blogger.com9tag:blogger.com,1999:blog-790704173085436327.post-69505339167763518912008-12-14T16:51:00.000-08:002008-12-15T22:47:03.631-08:00Wii Theremin - Doctor Who ThemeA holiday gift for those of you who requested the Doctor Who theme played on my Wii Theremin -- my own original arrangement!<br /><br />Despite my mad Google Search skillz, I couldn't find a "karaoke" version of the theme without the lead synth, so I decided to create my own.<br /><br />Over the years the Doctor Who theme has become more and more modern, but to me the triplet rhythm is a little tired and limits the music's edginess -- I broke the mold and adopted a driving sixteenths rhythm reminiscent of Heart's <em>Barracuda</em>. I hope you like it, and I hope the ghosts of Ron Grainer and Delia Derbyshire (who composed the original theme in 1963) don't haunt me too much!<br /><br /><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/Ix_Yu7bA4Qw&hl=en&fs=1&showsearch=0&ap=%2526fmt%3D18&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Ix_Yu7bA4Qw&hl=en&fs=1&showsearch=0&ap=%2526fmt%3D18&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br /><br /><br />Click here to <a href="http://www.kenmooredesign.com/blog/content/DoctorWhoTheme_KenMooreArrangement.mp3">Download the MP3</a>. It sounds much more pleasant since I recorded the lead with a keyboard, not the tricky Wii Theremin.<br /><br />Happy Holidays!<br />KenKen Moorehttp://www.blogger.com/profile/06947879646420390697noreply@blogger.com3tag:blogger.com,1999:blog-790704173085436327.post-79595745419563036772008-11-16T21:07:00.000-08:002008-12-04T09:04:56.495-08:00More Wii Theremin VideosVideos of me playing my homemade Wii Theremin.<br /><br />Star Trek Theme:<br /><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/lnYOC9tKUBs&hl=en&fs=1&showsearch=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/lnYOC9tKUBs&hl=en&fs=1&showsearch=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br /><br /><br /><br />Sound Play:<br /><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/DkZ1Or_D-g8&hl=en&fs=1&showsearch=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/DkZ1Or_D-g8&hl=en&fs=1&showsearch=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br /><br />Credit and many thanks to my wife, <a href="http://www.evidentlyblog.com">Kali</a>, who lit and recorded all my shots and tolerated days of miserable noisemaking!Ken Moorehttp://www.blogger.com/profile/06947879646420390697noreply@blogger.com3tag:blogger.com,1999:blog-790704173085436327.post-40855293871060889362008-11-16T17:48:00.000-08:002009-02-28T09:11:39.330-08:00Wii Theremin - How It WorksHow I constructed a Wii Theremin with a computer, synthesizer and a Wiimote.<br /><br /><center><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/wINCstV50HA&hl=en&fs=1&showsearch=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/wINCstV50HA&hl=en&fs=1&showsearch=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></center><br /><br /><center><img src="http://www.kenmooredesign.com/blog/images/theremin_small.jpg" alt="Léon Theremin" /></center><br /><em>The Theremin</em>, invented in 1920 by Russian physicist Léon Theremin, was one of the world's first electronic instruments. It's the only instrument that is played without being touched. The proximity of the hands to the two antennae determines the pitch and volume of the sounds produced.<br /><br />You've likely heard the eerie Theremin before - they became popular in those 1950's science fiction movie soundtracks that sound so cheesy today.<br /><br />While Theremins are always a popular attraction, they remain pretty rare (I've only once seen a Theremin -- at a shi-shi company event during the dot com boom). A new Theremin costs about $450, so I'm not likely to get one as a stocking stuffer, but luckily thanks to the Wii and the inspiration of <a href="http://www.cs.cmu.edu/~johnny/projects/wii/">Wii hacking pioneer Johnny Lee</a> I've been able to create my own.<br /><br />To be precise, I've built a Theremin simulator using a computer, a Roland JV-1080 synthesizer, and a Wiimote (remote controller from the Wii game console).<br /><br />At just $35, the Wiimote is an AMAZING piece of technology. It has an infrared camera in it which tracks the position up to 4 infrared light sources. So I bought a pair of leather gloves, wired up a couple infrared LEDs to 1.5 volt batteries, and poked an LED through the tip of the index finger of each glove.<br /><br /><center><img src="http://www.kenmooredesign.com/blog/images/glove.jpg" alt="Wii Theremin glove with infrared LED fingertip"/></center><br /><br />Then, I connected my Wiimote to my computer (the Wiimote also supports Bluetooth connections): building on top of <a href="http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx">Brian Peek's Wiimote hacking software library</a>, I wrote a program which detects the two infrared gloves and converts the vertical position of the left hand to volume, and converts the horizontal position of the right hand to pitch. That information is then sent via MIDI to the synthesizer which creates the actual sound.<br /><br />One awesome thing about this design is that I'm not restricted to the sine wave sound of a traditional Theremin so the sonic possibilities are endless. My father-in-law, a <a href="http://sakaidentistry.com/">Vancouver Washington dentist</a>, suggested I should make it sound like a dental drill :)<br /><br />I've had a lot of fun creating my Theremin, and I've learned a lot. I think my biggest lesson, though, is that while playing the Theremin is simple in concept, it's VERY difficult to <a href="http://www.youtube.com/watch?v=X-ywH1Vj8_U">play well</a>.Ken Moorehttp://www.blogger.com/profile/06947879646420390697noreply@blogger.com17tag:blogger.com,1999:blog-790704173085436327.post-7644275665035432792008-11-12T10:56:00.000-08:002010-04-25T20:36:59.512-07:00How to make an infrared LED light penSimple instructions and shopping list for a great LED light pen.<br />
<br />
If you want to experiment with <a href="http://www.cs.cmu.edu/~johnny/projects/wii/">Johnny Lee's Wiimote Whiteboard</a> or other Wiimote hacking projects, I recommend starting by making your own IR LED light pen. My design shown here is sturdy, self-contained, cheap and easy to make.<br />
<br />
<center><img src="http://www.kenmooredesign.com/blog/images/Wiimote_Whiteboard_Pen.jpg" alt="Infrared LED pen for Wiimote Whiteboard"/></center><br />
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/czs2oJZY7hU&hl=en&fs=1&showsearch=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/czs2oJZY7hU&hl=en&fs=1&showsearch=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br />
<br />
Click here for <a href="http://www.kenmooredesign.com/blog/content/MakingAnLEDLightPen.pdf">printable shopping list and instructions</a> (PDF).<br />
<br />
<h3>Here's your shopping list (makes 2 pens):</h3><table><thead>
<tr><th>ITEM</th><th>WHERE</th><th>PART #</th><th>COST</th></tr>
</thead><tbody>
<tr><td><a href="http://www.officemax.com/office-supplies/pens-pencils-markers/markers/dry-wet-erase-markers/product-prod2040157">EXPO markers</a></td><td>Office Max</td><td>21671870</td><td>$6.00</td></tr>
<tr><td><a href="http://www.radioshack.com/product/index.jsp?productId=2062565">IR LED</a> x 2</td><td>Radio Shack</td><td>276-143</td><td>$4.00</td></tr>
<tr><td><a href="http://www.radioshack.com/product/index.jsp?productId=2062559">LED holders</a></td><td>Radio Shack</td><td>276-080</td><td>$1.50</td></tr>
<tr><td><a href="http://www.radioshack.com/product/index.jsp?productId=2062546&tab=summary">SPST momentary switches</a></td><td>Radio Shack</td><td>275-1571</td><td>$3.00</td></tr>
<tr><td><a href="http://www.radioshack.com/product/index.jsp?productId=2146411">N-size batteries</a></td><td>Radio Shack</td><td>23-023</td><td>$5.00</td></tr>
<tr><td><a href="http://www.radioshack.com/product/index.jsp?productId=2062250">N-size battery holder</a> x 2</td><td>Radio Shack</td><td>270-405</td><td>$2.00</td></tr>
<tr><td><a href="http://www.radioshack.com/product/index.jsp?productId=2062758">Soldering kit</a></td><td>Radio Shack</td><td>64-2802</td><td>$8.00</td></tr>
</tbody></table><br />
<strong>TOTAL: $29.50</strong><br />
<hr/><h3>Directions:</h3><ol><li>Over a trash-can remove the marker tip and core with a pair of pliers (be careful as the ink can spray a bit).</li>
<li>Wipe out the inside of the marker to remove any remaining ink.</li>
<li>Drill a quarter-inch hole for the pushbutton switch at the spot where your thumb naturally rests on the grip. The pushbutton is a hair larger than 1/4" diameter so you'll need to grind at the edges a bit to widen the hole until the pushbutton fits in snugly.</li>
<li>With a fine piece of sandpaper, scuff up the surface of the LED - this helps diffuse the light to improve tracking.</li>
<li>Remove and discard the nut and washer from the LED holder.</li>
<li>Put the LED stems through the LED holder and slide the rubber plug onto the stems until it’s tight – having the LED on the outside of the LED holder helps more light shine out to improve tracking.</li>
<li>Solder an 8 inch length of red wire to the positive lead, which is the longer one (you can also tell by looking inside the bulb - the positive electrode is the smaller of the two).</li>
<li>Solder an 8-inch length of black wire to the negative lead.</li>
<li>Thread the wires through the body of the pen and use a set of pliers to screw the LED holder into the tip of the pen. This takes SIGNIFICANT force to expand the hole slightly, but the end result is nice and snug.</li>
<li>Fish the black wire through the hole for the pushbutton.</li>
<li>Snip the wire about an inch from the hole, then solder that to one terminal of your pushbutton.</li>
<li>Slip the remaining black wire back into the pen body and solder it to the other pushbutton terminal.</li>
<li>Gently press your pushbutton into place.</li>
<li>To leave more room for the battery, trim the excess wire leaving about an inch extending from the bottom of the pen body. Also trim the battery holder wires to about 1.5 inches each.</li>
<li>Solder the battery holder wires to those of the pen (red-to-red!) [NOTE: this is your first chance to test your connections. The IR LED is invisible to the eye but it IS visible to the CCD of digital cameras. Point your camera at the light, press the button and you should be able to see it light up on the camera's screen.]</li>
<li>Slide the battery and wire into the back of the pen and push the end cap back on as far as it'll go comfortably.</li>
</ol><br />
<br />
Good luck... let me know how it goes!Ken Moorehttp://www.blogger.com/profile/06947879646420390697noreply@blogger.com61tag:blogger.com,1999:blog-790704173085436327.post-91852671827626472142008-11-06T21:31:00.000-08:002008-12-04T09:22:27.837-08:00Connecting a Wiimote to your PCClear, simple instructions on connecting a Wiimote to your PC.<br /><br />You can do some pretty cool stuff these days with just a Wiimote, some software and a Bluetooth-capable computer. If you haven't seen <a href="http://www.cs.cmu.edu/%7Ejohnny/projects/wii/">Johnny Lee's Wiimote experiments</a> yet you must check them out - it's required viewing!<br /><br />If you're yearning to join the Wiimote hacker's club, the first skill to learn is how to make a Bluetooth connection between your Wiimote and your computer. You can find the steps elsewhere on the web, but I have a few tips that might save you some time. (Note: I'm using Windows Vista and these steps will vary on other operating systems)<br /><br /><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/A7uj1uZkAPs&hl=en&fs=1&showsearch=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/A7uj1uZkAPs&hl=en&fs=1&showsearch=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br /><br />First, from the Control Panel open Bluetooth Devices.<center><img src="http://www.kenmooredesign.com/blog/images/connecting1.jpg" /></center><br />Now on the Devices tab click the Add button at the bottom.<center><img src="http://www.kenmooredesign.com/blog/images/connecting2.jpg"/></center><br />This will bring up the Add Bluetooth Device Wizard. Click the checkbox that says "My device is set up and ready to be found".<center><img src="http://www.kenmooredesign.com/blog/images/connecting3.jpg"/></center><br />Now, before clicking Next, press 1 and 2 simultaneously on your Wiimote. The blue lights on the wiimote should start blinking letting you know it's ready to make a connection. Click Next.<br /><br />After a moment the wizard should locate a device named Nintendo RVL-CNT-01. That's your Wiimote. Select the device and click Next.<center><img src="http://www.kenmooredesign.com/blog/images/connecting4.jpg"/></center><br />The next screen asks about setting up a Bluetooth passkey, which we don't need. So, select the fourth option - Don't use a passkey.<center><img src="http://www.kenmooredesign.com/blog/images/connecting5.jpg"/></center><br />By this time your Wiimote has probably stopped searching for a connection (the blinking only lasts for 20 seconds). So, before clicking Next reactivate the connection mode by pressing 1 and 2 once again.<br /><br />Now click Next.<br /><br />That's it - if all has gone well you'll see this success dialog. <center><img src="http://www.kenmooredesign.com/blog/images/connecting6.jpg" /></center><br />You can click Finish and know that your computer now has access to your Wiimote.<br />NOTE: once you've made the connection, the Nintendo device icon remains in your Bluetooth Devices list, HOWEVER, whenever the Bluetooth connection shuts down -- if your computer goes to sleep, or if the Wiimote gets turned off, for example -- you'll need to run through these steps once again. It may seem like a pain, but it only takes a couple system crashes before this will become a habit :)<br /><br />Now that your Wiimote is connected you need a way to confirm that it's working -- I like this <a href="http://www.designerwpf.com/2008/01/29/wpf-multi-point-tutorials-part-15-wpf-visualization-of-wii-data/">Wiimote Data Visualizer</a> written by Matthias Shapiro. <center><img src="http://www.kenmooredesign.com/blog/images/connecting7.jpg" /></center><br /><p>It shows the current state of all the controls on the Wiimote and even lets you toggle the blue lights and trigger the Wiimote's Rumble feedback.</p><br /><br /><p>Good luck to you and happy hacking!</p>Ken Moorehttp://www.blogger.com/profile/06947879646420390697noreply@blogger.com19