{"id":351,"date":"2009-04-10T05:21:00","date_gmt":"2009-04-10T04:21:00","guid":{"rendered":"http:\/\/www.celesteh.com\/blog\/2009\/04\/10\/twitter-supercollider-app\/"},"modified":"2015-06-19T00:23:53","modified_gmt":"2015-06-18T23:23:53","slug":"twitter-supercollider-app","status":"publish","type":"post","link":"https:\/\/www.celesteh.com\/blog\/2009\/04\/10\/twitter-supercollider-app\/","title":{"rendered":"Twitter Supercollider App"},"content":{"rendered":"<p>There are some people twittering supercollider code.  They do sound generating apps in 140 characters or less!  I&#8217;ve just created some code to fetch and play these.  It uses a yahoo pipe which looks for tweets tagged with #supercollider and which seem to contain a playable piece of code.  It also does some sanitizing to ignore potentially evil content.<br \/>\nThis is a first draft, so it requires a helper script, written in bash, which is called fetch.sh:<\/p>\n<pre>\n#!\/bin\/bash\n\ncurl http:\/\/pipes.yahoo.com\/pipes\/pipe.run?_id=sqg4I0kl3hGkoIu9dPQQIA&_render=r\nss  >   \/tmp\/rss.xml\n<\/pre>\n<p>The SC code is:<\/p>\n<pre>\n\n(\nr = { \n\n\n Routine.new({\n \n  var code, new_code, syn, doc, elements;\n  \n  inf.do({\n  \n   \"fetching\".postln;\n  \n   \"\/path\/to\/fetch.sh\".unixCmd;\n   \n   doc = DOMDocument.new(\"\/tmp\/rss.xml\");\n   doc.read(File.new(\"\/tmp\/rss.xml\", \"r\"));\n   elements = doc.getElementsByTagName(\"description\");\n   \n   \n   elements.notNil.if ({\n   \n    new_code = elements.last.getText;\n   \n    ((new_code == code).not).if ({\n   \n     code = new_code;\n   \n     code.postln;\n      \n     (syn.notNil).if ({ syn.free; s.freeAll; });\n     syn = code.interpret;\n    });\n   });\n   60.yield;\n  });\n });\n \n};\n\n)\n\nr.play;\n<\/pre>\n<p>Replace the path information with the correct one, start the server, select all the code and hit enter.  If you find a bug or a way to be evil, please leave a comment.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are some people twittering supercollider code. They do sound generating apps in 140 characters or less! I&#8217;ve just created some code to fetch and play these. It uses a yahoo pipe which looks for tweets tagged with #supercollider and which seem to contain a playable piece of code. It also does some sanitizing to &hellip; <a href=\"https:\/\/www.celesteh.com\/blog\/2009\/04\/10\/twitter-supercollider-app\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Twitter Supercollider App<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[1],"tags":[76,64,16],"class_list":["post-351","post","type-post","status-publish","format-standard","hentry","category-uncategorised","tag-celesteh","tag-supercollider","tag-twitter"],"_links":{"self":[{"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/posts\/351","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/comments?post=351"}],"version-history":[{"count":1,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/posts\/351\/revisions"}],"predecessor-version":[{"id":2560,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/posts\/351\/revisions\/2560"}],"wp:attachment":[{"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/media?parent=351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/categories?post=351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/tags?post=351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}