{"id":494,"date":"2010-05-22T15:04:15","date_gmt":"2010-05-22T14:04:15","guid":{"rendered":"http:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/"},"modified":"2010-05-22T15:04:15","modified_gmt":"2010-05-22T14:04:15","slug":"wiimote-perl-hacks","status":"publish","type":"post","link":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/","title":{"rendered":"Wiimote Perl hacks"},"content":{"rendered":"<p>The <b>wiimote<\/b> is a geek toy. Here&#39;s what I did with it so far.<\/p>\n<h3>3D Earth<\/h3>\n<p>I wrote this <b>OpenGL<\/b> program in Perl more than a year ago. It can <b>display Apache access logs in real time, as geolocated spikes<\/b> on the rotating planet (if your machine is powerful enough :). It was a fun way for me to learn tiny bits of OpenGL, enough to run it. I thought it would be cool to use the wiimote to control the planet, twisting and spinning the Earth with your hands. It worked pretty well, and I&#39;m really <a href=\"http:\/\/search.cpan.org\/dist\/OpenGL-Earth\/\" rel=\"nofollow\">satisfied with the result<\/a>.<\/p>\n<h3>Fast forward&#8230;<\/h3>\n<p>During last couple of weeks, I managed to find some spare time to play with the wiimote again. Here&#39;s the result, the <b><a href=\"http:\/\/github.com\/cosimo\/wiimote-tools\" rel=\"nofollow\">wiimote tools<\/a><\/b>.<\/p>\n<h3>Wiimote tools<\/h3>\n<p>Tools it&#39;s probably not the right word. It&#39;s small hacks. It 3 different hacks in one box. I know there&#39;s already stuff out there that let you do everything like this, but honestly I don&#39;t care at all. The interesting part is writing something, preferably in Perl, to do that myself. And if my kids can have fun with it, it&#39;s the best a father-hacker can hope for&#8230; :)<\/p>\n<p>Copy-paste from the README follows:<\/p>\n<h4>wiimote-drumkit<\/h4>\n<p>This is something I made for my small kids, so they could just play with sounds. You can write a small config file to assign random mp3s\/wav\/&#8230; to each button of the wii.<\/p>\n<p>Take a look at <a href=\"http:\/\/github.com\/cosimo\/wiimote-tools\/blob\/master\/drumkit.conf\" rel=\"nofollow\">drumkit.conf<\/a> or <a href=\"http:\/\/github.com\/cosimo\/wiimote-tools\/blob\/master\/animals.conf\" rel=\"nofollow\">animals.conf<\/a> as examples.<\/p>\n<p>Then every time you press a button, or wave the wii in the air (pretending you&#39;re playing drums), you will hear the corresponding sounds. It requires <code>&#39;paplay&#39;<\/code>, the Pulse audio command line player. My daughter almost managed to fork bomb my PC pressing buttons everywhere :)<\/p>\n<h4>wiimote-joystick<\/h4>\n<p> <span class='imgright'><img alt='' src='http:\/\/files.myopera.com\/cstrep\/blog\/ladybug.png' \/><\/span><\/p>\n<p>This is a quick hack that I put together to use the wiimote together with any of my favorite games as a digital joystick.<\/p>\n<p>I can use it to play with mame (see pic), of course with legal roms or c64 emulators (with games I of course owned when I was a kid) and so on. Currently it works well with a few games, because of the way the keys are sent to X11, and it works really bad with other games, because of the way the keys are sent to X11. :)<\/p>\n<p>Requires the <a href=\"http:\/\/search.cpan.org\/dist\/X11-GUITest\" rel=\"nofollow\">X11::GUITest<\/a> module, install with <code>sudo cpan X11::GUITest<\/code>.<\/p>\n<h4>wiimote-conductor<\/h4>\n<p>This is the stupidest of the lot. It can control the speed of a movie (or song?) by pretending to use the wiimote like a drunk orchestra conductor would.<\/p>\n<p>It&#39;s a bit sucky because it doesn&#39;t get the actual tempo from the sound, so you have to pretend the normal (1.0x) speed is represented by wii-beats distanced by 1 second. So if you want to double the speed of the movie\/song, you have to wave the wii in the air every 0.5 seconds. Pretty lame, eh? :)<\/p>\n<p>Requires <a href=\"http:\/\/search.cpan.org\/dist\/Audio-Play-MPlayer\" rel=\"nofollow\">Audio:: Play:: MPlayer<\/a> with <a href=\"http:\/\/github.com\/cosimo\/audio-play-mplayer\" rel=\"nofollow\">a trivial patch I made to add the <b>speed<\/b> command.<\/a><\/p>\n<p>Everything is <a href=\"http:\/\/github.com\/cosimo\/wiimote-tools\" rel=\"nofollow\">nicely packaged here<\/a>, if you want to experiment with it.<\/p>\n<p>&#8230; and this is for <a href=\"http:\/\/shadowcat.co.uk\/blog\/matt-s-trout\/iron-man-lost?colour=chartreuse&amp;title=The+evolution+of+MVC+from+Pacman+to+Django\" rel=\"nofollow\">mst<\/a>, have fun!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The wiimote is a geek toy. Here&#39;s what I did with it so far. 3D Earth I wrote this OpenGL program in Perl more than a year ago. It can display Apache access logs in real time, as geolocated spikes on the rotating planet (if your machine is powerful enough :). It was a fun [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[63,439,438,436,50,440,437],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Wiimote Perl hacks - Random hacking<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Wiimote Perl hacks - Random hacking\" \/>\n<meta property=\"og:description\" content=\"The wiimote is a geek toy. Here&#039;s what I did with it so far. 3D Earth I wrote this OpenGL program in Perl more than a year ago. It can display Apache access logs in real time, as geolocated spikes on the rotating planet (if your machine is powerful enough :). It was a fun [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/\" \/>\n<meta property=\"og:site_name\" content=\"Random hacking\" \/>\n<meta property=\"article:published_time\" content=\"2010-05-22T14:04:15+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/files.myopera.com\/cstrep\/blog\/ladybug.png\" \/>\n<meta name=\"author\" content=\"cosimo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"cosimo\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/\"},\"author\":{\"name\":\"cosimo\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\"},\"headline\":\"Wiimote Perl hacks\",\"datePublished\":\"2010-05-22T14:04:15+00:00\",\"dateModified\":\"2010-05-22T14:04:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/\"},\"wordCount\":525,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\"},\"image\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/files.myopera.com\/cstrep\/blog\/ladybug.png\",\"keywords\":[\"github\",\"hacks\",\"ironman\",\"OpenGL\",\"perl\",\"wiimote\",\"wiimote-tools\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/\",\"url\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/\",\"name\":\"Wiimote Perl hacks - Random hacking\",\"isPartOf\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/files.myopera.com\/cstrep\/blog\/ladybug.png\",\"datePublished\":\"2010-05-22T14:04:15+00:00\",\"dateModified\":\"2010-05-22T14:04:15+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/#primaryimage\",\"url\":\"http:\/\/files.myopera.com\/cstrep\/blog\/ladybug.png\",\"contentUrl\":\"http:\/\/files.myopera.com\/cstrep\/blog\/ladybug.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.streppone.it\/cosimo\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Wiimote Perl hacks\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#website\",\"url\":\"https:\/\/www.streppone.it\/cosimo\/blog\/\",\"name\":\"Random hacking\",\"description\":\"Assume nothing. Code defensively. Keep it simple, stupid!\",\"publisher\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.streppone.it\/cosimo\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\",\"name\":\"cosimo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g\",\"caption\":\"cosimo\"},\"logo\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.streppone.it\/cosimo\/blog\/author\/cosimo\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Wiimote Perl hacks - Random hacking","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/","og_locale":"en_US","og_type":"article","og_title":"Wiimote Perl hacks - Random hacking","og_description":"The wiimote is a geek toy. Here&#39;s what I did with it so far. 3D Earth I wrote this OpenGL program in Perl more than a year ago. It can display Apache access logs in real time, as geolocated spikes on the rotating planet (if your machine is powerful enough :). It was a fun [&hellip;]","og_url":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/","og_site_name":"Random hacking","article_published_time":"2010-05-22T14:04:15+00:00","og_image":[{"url":"http:\/\/files.myopera.com\/cstrep\/blog\/ladybug.png"}],"author":"cosimo","twitter_card":"summary_large_image","twitter_misc":{"Written by":"cosimo","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/#article","isPartOf":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/"},"author":{"name":"cosimo","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1"},"headline":"Wiimote Perl hacks","datePublished":"2010-05-22T14:04:15+00:00","dateModified":"2010-05-22T14:04:15+00:00","mainEntityOfPage":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/"},"wordCount":525,"commentCount":0,"publisher":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1"},"image":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/#primaryimage"},"thumbnailUrl":"http:\/\/files.myopera.com\/cstrep\/blog\/ladybug.png","keywords":["github","hacks","ironman","OpenGL","perl","wiimote","wiimote-tools"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/","url":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/","name":"Wiimote Perl hacks - Random hacking","isPartOf":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/#primaryimage"},"image":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/#primaryimage"},"thumbnailUrl":"http:\/\/files.myopera.com\/cstrep\/blog\/ladybug.png","datePublished":"2010-05-22T14:04:15+00:00","dateModified":"2010-05-22T14:04:15+00:00","breadcrumb":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/#primaryimage","url":"http:\/\/files.myopera.com\/cstrep\/blog\/ladybug.png","contentUrl":"http:\/\/files.myopera.com\/cstrep\/blog\/ladybug.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/wiimote-perl-hacks\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.streppone.it\/cosimo\/blog\/"},{"@type":"ListItem","position":2,"name":"Wiimote Perl hacks"}]},{"@type":"WebSite","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#website","url":"https:\/\/www.streppone.it\/cosimo\/blog\/","name":"Random hacking","description":"Assume nothing. Code defensively. Keep it simple, stupid!","publisher":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.streppone.it\/cosimo\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1","name":"cosimo","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g","caption":"cosimo"},"logo":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/"},"url":"https:\/\/www.streppone.it\/cosimo\/blog\/author\/cosimo\/"}]}},"_links":{"self":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/posts\/494"}],"collection":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/comments?post=494"}],"version-history":[{"count":0,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/posts\/494\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/media?parent=494"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/categories?post=494"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/tags?post=494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}