Unified · Split
| @@ -1,12 +1,13 @@ | |||
| 1 | #+TITLE: The "Siren" Patch | 1 | #+TITLE: The "Siren" Patch |
| 2 | * Overview | 2 | * Overview |
| 3 | This document provides a rosetta stone for a =siren= patch. | 3 | This document provides a rosetta stone for a =siren= patch. |
| 4 | It's not exactly the most interseting patch, but it is | 4 | It's not exactly the most interesting patch, but it |
| 5 | succinctly shows how to work with a stack-based | 5 | succinctly shows how to work with a stack-based |
| 6 | modular environment. | 6 | modular environment. |
| 7 | 7 | ||
| 8 | I originally wrote this patch as a bridge to show the | 8 | I originally wrote this patch as a bridge to show the |
| 9 | relationship between runt code and C + patchwerk code. | 9 | relationship between runt code and C + patchwerk code |
| 10 | (included amongst the examples). | ||
| 10 | Now, I have adapated a version of it that works in sndkit! | 11 | Now, I have adapated a version of it that works in sndkit! |
| 11 | * Patch Description | 12 | * Patch Description |
| 12 | The siren patch can be generally described in the following | 13 | The siren patch can be generally described in the following |
| @@ -60,6 +61,11 @@ computes 10 · 47 unmodified lines | |||
| 60 | This implementation shows the siren written in C using | 61 | This implementation shows the siren written in C using |
| 61 | the sndkit @!(ref "core" "core API")!@. The core | 62 | the sndkit @!(ref "core" "core API")!@. The core |
| 62 | patch construction can be seen in the =patch= function. | 63 | patch construction can be seen in the =patch= function. |
| 64 | What's really cool is how closely it matches the LIL code. | ||
| 65 | If you take away the syntactic sugar in LIL, the underlying | ||
| 66 | sndkit calls are essentially 1:1. This patch was written by | ||
| 67 | hand looking at the LIL code above. It was a surprisingly | ||
| 68 | trivial process! | ||
| 63 | 69 | ||
| 64 | #+NAME: siren.c | 70 | #+NAME: siren.c |
| 65 | #+BEGIN_SRC c :tangle siren.c | 71 | #+BEGIN_SRC c :tangle siren.c |
| @@ -160,7 +166,10 @@ int main(int argc, char *argv[]) · 94 unmodified lines | |||
| 160 | * Implementation 3: Monolith and Runt | 166 | * Implementation 3: Monolith and Runt |
| 161 | =Monolith= is a realtime computer music environment I wrote | 167 | =Monolith= is a realtime computer music environment I wrote |
| 162 | for myself as a precursor to sndkit. =runt= is a quirky | 168 | for myself as a precursor to sndkit. =runt= is a quirky |
| 163 | stack based language used to notate patches. | 169 | homemade stack based language used to notate patches. |
| 170 | |||
| 171 | Even though sndkit uses TCL and C syntax, the thought | ||
| 172 | process and structure I use is still in stacks. | ||
| 164 | 173 | ||
| 165 | #+NAME: siren.rnt | 174 | #+NAME: siren.rnt |
| 166 | #+BEGIN_SRC runt :tangle siren.rnt | 175 | #+BEGIN_SRC runt :tangle siren.rnt |
| @@ -186,9 +195,12 @@ add · 19 unmodified lines | |||
| 186 | sr 10 * _compute rep | 195 | sr 10 * _compute rep |
| 187 | #+END_SRC | 196 | #+END_SRC |
| 188 | * Implementation 4: Monolith and Scheme | 197 | * Implementation 4: Monolith and Scheme |
| 189 | =monolith= is primarily controlled via a Scheme REPL spawned | 198 | =monolith= is usually controlled via a Scheme REPL spawned |
| 190 | inside of Emacs, the flavor of scheme being a fork of s9 | 199 | inside of Emacs, the flavor of scheme being a fork of s9 |
| 191 | scheme. | 200 | scheme. Runt code is then executed in scheme as inline code. |
| 201 | The scheme language is used as a kind of macro language, | ||
| 202 | making it possible to build more complex structures and | ||
| 203 | abstractions. | ||
| 192 | 204 | ||
| 193 | The scheme =ugens= are wrappers around runt code, so it is | 205 | The scheme =ugens= are wrappers around runt code, so it is |
| 194 | structurally identical to the runt and monolith code. | 206 | structurally identical to the runt and monolith code. |