There are some people twittering supercollider code. They do sound generating apps in 140 characters or less! I'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.
This is a first draft, so it requires a helper script, written in bash, which is called fetch.sh:
#!/bin/bash curl http://pipes.yahoo.com/pipes/pipe.run?_id=sqg4I0kl3hGkoIu9dPQQIA\&_render=r ss > /tmp/rss.xml
The SC code is:
( r = { Routine.new({ var code, new_code, syn, doc, elements; inf.do({ "fetching".postln; "/path/to/fetch.sh".unixCmd; doc = DOMDocument.new("/tmp/rss.xml"); doc.read(File.new("/tmp/rss.xml", "r")); elements = doc.getElementsByTagName("description"); elements.notNil.if ({ new_code = elements.last.getText; ((new_code == code).not).if ({ code = new_code; code.postln; (syn.notNil).if ({ syn.free; s.freeAll; }); syn = code.interpret; }); }); 60.yield; }); }); }; ) r.play;
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.
1 comment:
Lovely blog you have here
Post a Comment