Risset Bell in SuperCollider

Update: Moved the code into a pair of gists. (2013-07-05)

Trying to get my feet wet with SuperCollider, I decided to implement a version of Risset’s bell using additive synthesis. There’s an example in the help files for Pd (also described on Miller Puckette’s site) that I used for reference.

After some searching I came upon a solution in Mark Polishook’s tutorial. He suggests wrapping the entire series of partials in an envelope, and put the done action on that overarching envelope. To make this happen I had to do a bit of refactoring: I threw the partials into an array and then mixed them down inside of the overlapping envelope. I left the doneAction of 0 on the individual partials, and gave the new envelope a doneAction of 2.

This was just the trick I needed. The bell rings loud and clear all the way to the end, and all the pieces are neatly cleaned up afterwards.