Michael J. Wilson Music 256a Fall 2010 Homework #2 ---------------------------------------------------------------------- IDEAS / COMMENTS: I redid how I organized my code from the first homework. I initially started porting my unit generates from HW1 over, but cut them out for the final submission. I revised the unit generator signature to accept one sample and generate one sample per call. I made a Midi instrument class for the Karplus-Strong string model. This will be easy to abstract into a generic Midi instrument later if I desire. I decided to handle over-saturating the polyphony by simply not allowing more notes to play. Since this model has a quick decay, doing it this way will make it more obvious if the polyphony limit needs to be increased. I create a vector of Karplus-Strong strings which can play any note in a specified range (really, above a specified range). I also maintain a list of free strings. When a new note is triggered, we grab a string from the front of the list. When a note is released that string is returned to the end of the list, but continues to output samples at an increased attenuation rate. This results in notes having a natural decay, and in having the most recently released note being used for a different note last. A few notes on the piece ("Let It Ride"): it was composed on Rosegarden 10. The program was run with the following parameters: --port 4 --poly 24, with 44100 sample rate and 128 frames. I set the base attenuation for each string to 0.99999. ---------------------------------------------------------------------- DIFFICULTIES: I encountered denormalization issues causing 100% CPU usage. Clipping to 0.0 once the energy in the delay lines dropped below an epsilon I defined resolved these issues. There were no Midi instruments available for me to test with so I had to stick with generating messages on the computer. But I like that so it wasn't too big of a deal. If the same note is triggered multiple times, there is no bookkeeping or way to recover from the Midi message that I could think of to match a note release with a particular trigger. So my program will simply release one of the notes at random (actually, probably the first one triggered but this is not guaranteed). There are potentially a few ways to handle this but I didn't think it was necessary for this assignment. ---------------------------------------------------------------------- COLLABORATORS: I pretty much did this one on my own.