{"id":1954,"date":"2011-10-09T15:01:51","date_gmt":"2011-10-09T19:01:51","guid":{"rendered":"http:\/\/nickm.com\/post\/?p=1954"},"modified":"2012-02-15T16:46:19","modified_gmt":"2012-02-15T21:46:19","slug":"the-sounds-of-little-c","status":"publish","type":"post","link":"https:\/\/nickm.com\/post\/2011\/10\/the-sounds-of-little-c\/","title":{"rendered":"The Sounds of Little C"},"content":{"rendered":"<p>A group of sonic and code explorers has been discovering excellent super-short C programs that, piped to an 8-bit audio device, generate music. Here&#8217;s the <a href=\"http:\/\/www.youtube.com\/watch?v=GtQdIYUtAHg\">first video<\/a> and a <a href=\"http:\/\/www.youtube.com\/watch?v=qlrs2Vorw2Y\">second video<\/a> with sounds and code.<\/p>\n<p>Here&#8217;s the code for one example, &#8220;Lost in Space,&#8221; from video #2:<\/p>\n<blockquote><p><code><br \/>\nmain(t){<br \/>\nfor(t=0;;t++)putchar(<br \/>\n((t*(t>>8|t>>9)&46&t>>8))^(t&t>>13|t&lt;&lt;6)<br \/>\n);}<\/code><\/p><\/blockquote>\n<p>If you are also a righteous Ubuntu user, you can paste that into a file (let&#8217;s call it &#8220;lost_in_space.c&#8221;) and compile it with:<\/p>\n<blockquote><p><code>% gcc lost_in_space.c -o lost_in_space<\/code><\/p><\/blockquote>\n<p>Then, pipe it (or pretend to pipe it, using padsp, since recent versions of Ubuntu don&#8217;t have \/dev\/dsp) to your audio device using:<\/p>\n<blockquote><p><code>% .\/lost_in_space | padsp tee \/dev\/dsp &gt; \/dev\/null<\/code><\/p><\/blockquote>\n<p>Thanks to Andrew Stern for tipping me off about this one.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A group of sonic and code explorers has been discovering excellent super-short C programs that, piped to an 8-bit audio device, generate music. Here&#8217;s the first video and a second video with sounds and code. Here&#8217;s the code for one example, &#8220;Lost in Space,&#8221; from video #2: main(t){ for(t=0;;t++)putchar( ((t*(t>>8|t>>9)&#038;46&#038;t>>8))^(t&#038;t>>13|t&lt;&lt;6) );} If you are also &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/nickm.com\/post\/2011\/10\/the-sounds-of-little-c\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;The Sounds of Little C&#8221;<\/span><\/a><\/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":[21,17,14,15],"class_list":["post-1954","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-constraint","tag-digital","tag-music","tag-programming"],"_links":{"self":[{"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/posts\/1954","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/comments?post=1954"}],"version-history":[{"count":11,"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/posts\/1954\/revisions"}],"predecessor-version":[{"id":2254,"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/posts\/1954\/revisions\/2254"}],"wp:attachment":[{"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/media?parent=1954"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/categories?post=1954"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/tags?post=1954"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}