diff --git a/oregano/Hacking.md b/oregano/Hacking.md index 7219083..18d3ae2 100644 --- a/oregano/Hacking.md +++ b/oregano/Hacking.md @@ -5,7 +5,7 @@ ## Goal I planned on writing a client for the SuperCollider (SC) music synthesis server for use in the Music Programming section of CSC123. Using the interface to SuperCollider, students will have access to real-time synthesis techniques. -## First hope +## Initial steps In the first quarter, after examining implementations in various languages, I set out on creating a new implementation in Racket from scratch. Quickly, however, it appeared that two quarters is not enough time, so I looked into porting the scheme implementation of a supercollider client, rsc3, to Racket. ### The Porting process @@ -24,27 +24,45 @@ One tricky part was a difference in the list representations between r6rs scheme ## Features added -It would be hard for first year students to use rsc3 directly, so I created simplified functions to perform common tasks of creating and controlling sounds. +It would be hard for first year students to use rsc3 directly, so I created simplified abstractions (functions and structures) to perform common tasks of creating and controlling sounds. ### Instruments -One main feature of SuperCollider is the Synthdef. +Students could create instruments with parameters that could be changed in real-time. Students can use this defined instruments to play notes + +I used a Racket macro to create the instrument creation form. + +An instrument corresponds to a Synhtdef in SuperCollider. A Synthedef is a composition of functions called ugens. ugens, which stands for unit generator, + +Instruments are associated with functions that play notes. A note contains the instrument name and frequency. The functions can turn on a note, turn it off, and change some instrument parameters, which will only affect the playing note, while the note is playing. + +### GUI elements to control parameters + +One interesting feature I implemented is the ability to easily create GUI elements to control note parameters. Currently there is a slider and checkbox. The slider works by passing a label, start value, end, initial, values, and a callback function that accepts the value of the slider. + +While this uses a lambda function, it could be easily changed to accept a particular note and the parameter string to change. + +I also added a slider funciton that can be used directly in the definition of an instrument. This encourages experimentation with parameter values. + + +### Filters + +I added functions that can be used to chain effects, such as reverb and low pass filters. An effect added after a previous effect will act on the output of the previus effect. To implement this, I originally planned on chaining nodes using SuperCollider's audio buses. However, I found a ugen that could do that called replace-out that provides this functionality. That is, replace-out can read, modify, and write to the same bus. + + +## Cross platform issues + +SuperCollider has versions for Windows, Linux and OS X. On Windows and OS X, SuperCollider doesn't need dependencies, but on Linux, SuperCollider requires a Jack server to be running. Students will have to install Jack, which is a different procedure depending on their Linux distribution. It's one line in a terminal on a Debian based distribution such as Ubuntu. + + + + + + -Students could create instruments with parameters that could be changed in real-time. -## Outline -- scratch & porting rsc3 - - how I started - - challenges - -- features - - instruments - - sliders - - effect chaining - -- cross platform