Thursday, December 19, 2013
Chicago Boss: an Erlang Web Framework
Monday, November 25, 2013
"Decoherence" Music Video
Decoherence from backtrace music on Vimeo.
I've started making some music videos to go with the tracks from Pythagorean Clouds and a few other pieces. I got a new computer last week with a GPU card which, combined with the new OpenCL rendering in the new version of Mandelbulber (1.19) lets me render certain kinds of animations very quickly.
The animation in this video is a transformation of a Mandelbox, which took about half a day to render at 1280x720px. The current OpenCL implementation only allows for a few basic fractal formulas to be rendered, and it's a little crashy on Windows. But it's super fast - cranking out almost 100 frames per minute sometimes, compared to maybe getting 1 frame per minute if I was lucky with my previous setup. I can't do anything with volumetric shaders right now, but I'm kind of getting into this aesthetic. Flat surfaces, "perfect" lighting with no depth of field. (I feel like if there's too many shading effects, you fall into the uncanny valley of being super conscious that you're watching a computer-generated video, and not really being able to experience the visuals for what they are) Because the algorithm gets glitchy when you zoom too close, I've been trying out different effects where the camera stays still and the fractal morphs around it. Overall though I like working within the constraints of a medium, especially when it's kind of minimal and lo-fi, so this works for me.
Tuesday, October 29, 2013
Circles and Euclidian Rhythms
Imagine an alternate universe in which Raymond Scott’s circle machine – a great, mechanical disc capable of sequencing sounds – became the dominant paradigm. We might have circles everywhere, in place of left-to-right timelines now common in media software. Regardless, it’s very likely Scott’s invention inspired Bob Moog’s own modular sequencers; it was almost certainly the young Moog’s exposure to the inventions in Scott’s basement that prompted that inventor to go into the electronic music business, thus setting the course for music technology as we know it.This blog entry includes some nice software examples.
Wednesday, October 23, 2013
"Horizontal Movements"
I composed these 2 pieces almost 2 years ago, but even though they are very autobiographical, I never really talked about the inspiration for them. So I've added a description on SoundCloud.
Like a lot of my music, these 2 pieces are autobiographical, at least in the sense that they were composed during and immediately in response to some significant events in my life - in this case my involvement in the Occupy Wall Street protests. They were composed in late December 2011 through early January 2012, while I was taking some time off from activism to recuperate after police chaos and setbacks of late November and December. The "Frozen Zone" of the titles refers to both the blockade that the NYPD set up in the Financial District in the middle of the night as they evicted protesters from Liberty Square, and more metaphorically to all systemic injustice.
Although the music doesn't convey any overt political messages, the act of writing it was kind of a meditation on the idea of leaderless organizing (the anarchist political philosophy of "Horizontalidad / Horizontalism"). I think of the sounds as being "horizontal" in the sense that there's no hierarchy working to organize them. The musical parts aren't divided into "instruments or "voices" - there's just a single algorithm generating clusters of sine waves. Those individual sine waves, which only differ in pitch and amplitude, converge temporarily to create harmonies, and then dissipate.
Sunday, October 13, 2013
MIDI in the web browser, 2013 style
midi.js is a good starting point.
Jasmid for reading MIDI files with JS.
Grimes "Genesis" extended remix
I haven't done one of these in a few years but I've been really into the song Genesis by Grimes lately so I decided to do an extended granular remix of it, similar to what I'd done with Aisler's Set and Joanna Newsom a few years ago.
This song works well for looping - the melodies are all in the high register, with lots of reverb so they won't sound choppy when overlapped, and there's not a lot of bass so it doesn't sound muddy. The drum track is clean, with the one strong kick drum that adds just the right amount of bass when it's looped.
This is the first time I've really done anything with Garage Band. The granular looping was done in Granulab as usual. With both of these programs I feel like I've pushed them as far as I want to go - it's too bad that in going for simplicity of the user interface you loose a lot of precision in the settings. In Garage Band I really wanted these loops to hit exactly on the beat, but you can only get resolution on the low end of around 0.1 BPM which makes for some noticeable grinding or stuttering. Similar in Garage Band, the resolution when automating parameters is kind of a joke - it's a linear division of the frequency spectrum in Hz, so while I can get like 100 divisions of the octave between 10khz and 20khz, on the low end, settings jump right from 20hz to like 700 hz, with nothing in between. Good luck getting a band pass filter to zero in on one sound.
This went through a bunch of phases where there were a lot more ideas at first - there was a timestretched track with doomy overdrive + reverb, and other rhythmic layers, all fading in and out, but I ditched all of that for a simple one track of the song looped with a little bit of pitch shifting going on.
I'm looking forward to emulating enough of Granulab in SuperCollider that I can do mixes like these with the kind of precision you need eliminate artifacts (or make the artifacts musically significant by harmonizing them with the rest of the song). I've been getting into using the TGrains ugen alot in the Backtrace Livestream project, so this should be a pretty straightforward thing to adapt.
Sunday, October 6, 2013
Saturday, October 5, 2013
Fractal Blog
Monday, July 1, 2013
Granular Amen Break Impromptu
Saturday, June 29, 2013
Upgrading from Snow Leopard to Mountain Lion: Not Bad
- Fixing scrolling, hidden scrollbars etc in Mountain Lion
- Here's some other useful tips for Mountain Lion
- X11 isn't supported, so if you run X11 / GTK apps like Mandelbulber use XQuartz
- Quicksilver stopped working after the upgrade so I switched to Alfred (thanks to Ashe Dryden for the recommendation)
- I used Spaces heavily on Snow Leopard (6 desktops, with apps assigned to workspaces for music, code, social media, graphics, sysadmin and writing), which became useless with 10.7 (one of the biggest reasons I didn't upgrade when 10.7 came out). I'm using TotalSpaces to restore classic Spaces functionality. I'll probably end up paying the $18 for the full version (almost as much as the OS upgrade itself) just because Spaces is so essential to how I work.
- Getting the battery time remaining to show in the menu bar was a chore. In Mountain Lion, you can no longer see the battery time next to the battery icon. There are 2 apps that can fix this for you. One is a simple one called "Battery Time" the other a more-advanced $1 app called "Battery Time Remaining".
- Since 3rd-party menubar items cannot be re-arranged (come on already) I couldn't actually see the battery time remaining on my laptop since the icon was pushed all the way off to the side. There are a few apps that you can get to fix this for you. "Bartender" at a pricey $15 or the more reasonably-priced "Menu Bar Rearranger" at $4.99. But really, why do I have to pay to do something as basic as change the ordering of some icons on my menu?
Sunday, June 23, 2013
New Album: Orbital Slingshot
Thursday, June 20, 2013
How to Block the Sponsored Posts on your Tumblr Dashboard
www.tumblr.com##DIV[class="sponsored_post"]Click the "edit" button, add the line of code, and then click the "paste" button. This will block all sponsored posts that appear on Tumblr.com.
How to Probably get Pandoc Running on a Linux Server
Drink-by date: This post was written based based on work I did in June, 2013. The GHC, Haskell, Cabal and pandoc were all current versions installed in Ubuntu 10.04. If you're reading this documentation after June, 2015, consider it out of date.
This blog post was the original inspiration to use Pandoc
)A few months ago I started putting my resumé on Github. As a freelance software dev it's quicker to send somebody to 1 spot to see both code for projects I work on and descriptive, bulleted-list of accomplishments (without all of the monetization noise of LinkedIn). Recently I spent 5 hours on one of those endlessly-recursive campaigns of compiling things from source code in order to save myself a few minutes of maintaining my online resumé in different formats (pdf and markdown) and since it deals with some bugs in some standard Ubuntu / Debian packages, I'll post instructions here for how I fixed them.
My goal was to be able to update my resumé in markdown, and have run a single deploy script that would commit changes, generate a pdf from the markdown and push the updated markdown and pdf to GitHub. There's a Linux utility called "pandoc" that does this and a whole lot more. It's written in Haskell, a powerful functional programming language that is beloved by academics and high-frequency stock traders and otherwise hasn't broken into mainstream software developement.
My first time around, I did a standard "sudo apt-get install pandoc" on my Ubuntu server and thought I was good to go. The syntax for a basic conversin is simple, and like ffmpeg, the input and output formats are inferred by file extension:
$ pandoc resume.md -o resume.pdf
Except that this yielded the following error:
pandoc: resume.md: hGetContents: invalid argument (Invalid or incomplete multibyte or wide character)
A character-encoding bug. Removing curly quotes from the markdown file confirmed this since it worked fine if the input document was all ascii. But what's the point of a PDF if you have to limit yourself to ugly straight quotes and spelling "resumé" as "resume"? There was some chatter on google groups that this was an issue with setting the right LANG in your locale, but that in later version of pandoc this bug was fixed. Rather than fiddle with global settings, I opted to upgrade pandoc.
The version of pandoc, as well as Haskell and GHC (the Glasgow Haskell Compiler) are all years out of date in debian / ubuntu. (The computer I was working on was running Lucid 10.04 which is supported through 2015). So geting the latest pandoc woudln't be as simple as an apt-get upgrade, and would require upgrading the GHC, Haskell, the Haskell Package Manager (cabal) and finally pandoc. All of these are source-code installs except for the final upgrade of pandoc.
If you've already tried to install pandoc or Haskell via apt-get you'll need to remove the packages via the following command:
$ sudo apt-get autoremove ghc6
Now we're ready to start the installation process. First, install the dependencies via apt-get:
$ sudo apt-get install libgmp3c2 freeglut3 libedit2 libedit-dev freeglut3-dev libglu1-mesa-devpandoc uses LaTeX for formatting, so you'll need to get pdflatex on your system.
$ sudo apt-get install texlive-full
Now you'll want to get the source code to build the GHC and the Haskell Platform. First the GHC. This a standard configure / make install build.
Cabal, the Haskell Package manager, is included in the Haskell Platform
$ wget http://lambda.haskell.org/platform/download/2013.2.0.0/haskell-platform-2013.2.0.0.tar.gz $ gunzip haskell-platform-2013.2.0.0.tar.gz $ tar -xvvf haskell-platform-2013.2.0.0.tar $ cd haskell-platform-2013.2.0.0 $ ./configure $ ./make $ ./sudo make install
You can also get the source for Cabal from GitHub.
Once you have Cabal up and running, first refresh the packages list:
$ cabal updateNow, you can install pandoc
$ cabal install pandocCabal will install a bunch of dependencies. This will tak a few minutes. Cabal installs executables to ~/.cabal/bin/pandoc - you can symlink this to a directory that's already in your path:
sudo ln -s ~/.cabal/bin/pandoc /usr/local/bin/pandoc
Now you should be ready to go. For some pointers as to how I actually automated the generating of pdf's by committing changes to my resumé, check out this shell script: https://github.com/erstwhile/resume/blob/master/deploy
Friday, June 14, 2013
Constructing "Cloud City" - the Mandelbulber settings
Wednesday, June 12, 2013
Saturday, June 8, 2013
James Tenney - Melody, Ergodicity, Indeterminacy
Sunday, April 14, 2013
Going to try using a Git Repo on Dropbox
The more difficult issue here is doing version control in a system that's designed to run entirely as a REPL - how does Smalltalk do version control? Periodic snapshots of object instances? In sclang, you can use Object.archive to dump the state of an object to a text file and from there use Git or whatever to save. Which is kind of a kludge - in Smalltalk you're running in a virtual machine that is a Smalltalk object, with no files. So where do you keep the snapshots?
Here's some StackOverflow conversations on using Git with Dropbox:
Using Git and Dropbox together effectively?
Is this plain stupid: GIT Sharing Via DropBox?
And a tutorial:
How to use Dropbox as a git repository.
Thursday, March 28, 2013
Monday, February 25, 2013
Fractal Return
Last time I was this interested in fractals was around 1999 when I was playing with a MIDI-generating program called "Mu Soft Music Generator" (I think) which would create music based on different fractals, L-Systems or periodic oscillators. This was in between the long-term project from 1997-2003, a Q-Basic application that combined twelve-tone and minimalist techniques to play music on the SoundBlaster 16 soundcard - culminating in Writing Software to Play Music to Write Software To. I was trying to wrap my head around Manfred Schroeder's Fractals Chaos and Power Laws. At the time, seeing any kind of rendering of a fractal was a special thing - I feel like it was one of the first things that really caught my interest about the Web (funny how so many pages relating to fractals and fractal art still date from the late 1990's). Something to look forward to in 15 years will be having computers fast enough to explore high-resolution 3-D fractals in realtime.
I just purchased a copy of Experiments in 4 Dimensions which was one of the books that got me started on all of this, back when I was in 4th or 5th grade (circa 1986). I had that book out from the library multiple times, trying to master the code examples given for rendering and rotating a simple wireframe tesseract (on a 4-color, 8mhz, 640k computer). I don't think I ever got one of the programs completed, because having the source code back in 1986 meant that you had a printout of the source code that you could set in your lap while you typed it into your computer (and probably guessed at how to get Apple Basic to run under DOS). I did build some tesseract and hyperpyramid models out of toothpicks.
When I get the book, I'll see if I can translate the code examples from Experiments in 4 Dimensions to Javascript/html5 so people can share it and play with it.
Monday, February 18, 2013
Friday, February 15, 2013
Mandlebrot Sonifications
//load up all of our servers into an array ~z = Server.all.asArray; //our instrument - phase multiplication of sine waves, in a cluster of 8 phase / pitch shifted voices ~z.collect({|z| SynthDef("sine-cluster",{|freq=100, atk=1, rel=1, slope=1, amp=0.005,pan =0,gate=0,m=0,p=0,ph=0,pl=0,pf=1| var sin = SinOsc.ar( [1,1] * freq *.x (p+[1-p,1,1+p,1+p+p]) ,pl*SinOsc.ar(freq/(pf),ph*(0..3)/3,XLine.ar(freq.sqrt.ceil*pf,pf*slope.abs,pf/(rel*freq.log2.ceil))),(1/(rel+1))+((2-1)/2)*(amp)/(freq+512)); OffsetOut.ar(0,Mix.ar(Pan2.ar(sin ,[-1,1])) * EnvGen.ar(Env.perc(atk,rel, 1,slope),gate, doneAction:2) );}).send(z); }); //the Mandelbrot function, where z is a complex number and c is a real number ~m = {|z,c|squared(z)+c}; //utility function - returns unique values in an array ~unique = {|a|var t = Array.fill(a.size); a.collect({|i,j|(t.includes(i)).if({t.put(j,nil)}, {t.put(j,a[j])})}).reject({|i|i==nil}); t.reject({|i|i==nil}); }; //the pitch set ~p = ~unique.((16..32).reject({|x|x.factors.detect({|n|n>5})!=nil})*.x(2**((-6)..3))).sort; //some sonification parameters ~globalSustain =2; ~d = 10; ~minIters =5; //how many iterations to generate the pitches for an orbit ~maxIters = 1024; ~rows =2; //minibrot on the the real axis ~d = 12; ~minIters =4; ~cx = -1.635; ~ci = -0.0001220703125; ~globalSustain =1.5; ~rows =2; //on our way out to the western point ~cx = -1.875; ~ci = 0; ~cx = -1.95125; ~ci = -1/(2**30); ~globalSustain =0.5; ~cx = -1.957125; ~ci = 0; ~rows =2; //5 arm spirals ~globalSustain =2; ~cx = -0.52482350635; ~ci = 0.62534492645; ~rows =3; ~d = 12; ~minIters =6; ( //start a loop to crawl along the real number axis of the graph //each cycle zooms in 2x closer to the original point, and crawls 1/2 as quickly Routine { (9..9).do({|y| var max = (2**(5+y)).asInt; max.clip(1,2048).do({|x| //the player function is defined outside this loop so it can be tweaked in realtime while the loop is playing ~player.(x,y,max); }) }) }.play; /*recursive function to generate a collection of orbit points - bail out if we reach infinity, zero, or a non-number. Always quit after reaching "safe" number of iterations this function returns an array of "points" which are the Complex values for a particular iteration */ ~mr = {|z,c,safe,points| ((safe > 0).and(z.real.isNaN.not).and(z.real!=inf).and(z.real !=0)).if({ ~mr.(squared(z)+c,c,safe-1,points.add(z)) },points) }; ) ( ~player = {|x,y,max| //we sonfiy a line of points on the imaginary axis together, based on the value of ~rows ~rows.asInt.do({|ii| //slowly crawl along the real axis var c= ~cx+(x/(2**(8+y))) - (max/(2**(9+y))) , z = Complex.new(c,~ci+(1/(2**(8+y))*ii)),points; //our initial point to iterate on z = ~m.(z,c); /* alternate traversal strategy, move our sonification point in a tightening spiral around the orginal values for real and imaginary. var z = Complex(~cx,~ci),points,c=~ci; //z is the original center point. We add the orbit point to this z = (z.asPolar+ Polar(1/2**y,0).rotate(((x*pi*2)/128)).scale(1+((1-(x/1024))/(2**(y-ii))))).asComplex; */ //generate an array of orbit points points= ~mr.(z,c,~maxIters,[]); /* take a slice of the array to sonify it the size of this slice can be tweaked by adjusting ~minIters and ~d. the lower end of the array tends to be more chaotic and the higher end of the array more constant. all of these points sound simultaneously, as a chord */ points.reverse[~minIters.asInt..~d.asInt].collect({|p,i| var ss; z = p; /* z is given as a complex number, but we can also treat it as a polar to get its angle (theta) and radius (rho) from the origin (0,0). it would probably be more interesting to get rho and theta relative to the original z point. */ ((z.real.isNaN)).if({},{ ss = Synth("sine-cluster",nil,~z.wrapAt(x)); //frequency of the pitch, based on the distance from the origin //fundamental pitch of 66hz multiplied by an overtone in the pitch set ~p ss.set(\freq, 66 * ((~p.wrapAt(z.rho*~p.size*~cx)))); //phase offset of the pitch, also based on radius ss.set(\ph,z.rho); //add a small pitch bend ss.set(\p,1/512); ss.set(\gate,1); //this is the amplitude of the 2nd (phase-shifting) oscillator, based on the imaginary value of of z ss.set(\pl, z.imag.abs.log2.clip(-1,1)); //frequency of the 2nd oscillator, based on one of the harmonics in the pitch set ~p. ss.set(\pf, 1/(~p.wrapAt(~p.size *z.theta/pi))); //length of the note, based on the real value of z ss.set(\rel,~globalSustain/((z.real.abs+2).log2).clip(2,32)); //pannign position ss.set(\pan, (z.imag%1) * (z.real%1)); //note attack value, based on the reciprocal of the imaginary of z (maximum value 1 second) ss.set(\atk,1/(1+z.imag.abs)); //slope of the peak amplitude drop - higher negative value = sharper attack, quieter sustain ss.set(\slope,z.real.abs.log * (z.real/z.real.abs)); //tweak the amplitude a little to offset notes with a longer attack ss.set(\amp,2.5 * (2/(1+(z.imag.abs.clip(0,1))))); }); }); }); (1/10).wait; }; )
Visualizing and Sonifying the Iterations of z=z^2+c
Saturday, January 12, 2013
Sunday, January 6, 2013
Almost Anything in Ruby can be a Hash Key
#ugly slug = (post.user.name +" "+post.user.id.to_s).to_sym posts_by_user[slug] << postWhen it turns out that you can use objects themselves as hash keys in Ruby, and then use the Hash.keys method to grab those objects back when you need them. So if you had a Post, which belonged to User, and you wanted to get them all and group them by user (assuming that your ORM or whatever won't do it for you in this instance):
posts = Post.all posts_by_user = Hash.new {|h,k| h[k]=[]} posts.each do |post| #if there is no entry for this user, create one with an empty array posts_by_user[post.user] ||= [] #shovel the post on to the group for that user posts_by_user[post.user] << post endIterate through them like this -
posts_by_user.keys.each do |user| #the user object p user.inspect #referencing the hash with the user object as key posts_by_user[user].each do |post| #each post belonging to that user p post.inspect end end