Unified · Split
| @@ -1,12 +1,13 @@ | ||
| 1 | 1 | #+TITLE: The "Siren" Patch |
| 2 | 2 | * Overview |
| 3 | 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 | 5 | succinctly shows how to work with a stack-based |
| 6 | 6 | modular environment. |
| 7 | 7 | |
| 8 | 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 | 11 | Now, I have adapated a version of it that works in sndkit! |
| 11 | 12 | * Patch Description |
| 12 | 13 | The siren patch can be generally described in the following |
| @@ -60,6 +61,11 @@ computes 10 · 47 unmodified lines | ||
| 60 | 61 | This implementation shows the siren written in C using |
| 61 | 62 | the sndkit @!(ref "core" "core API")!@. The core |
| 62 | 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 | 70 | #+NAME: siren.c |
| 65 | 71 | #+BEGIN_SRC c :tangle siren.c |
| @@ -160,7 +166,10 @@ int main(int argc, char *argv[]) · 94 unmodified lines | ||
| 160 | 166 | * Implementation 3: Monolith and Runt |
| 161 | 167 | =Monolith= is a realtime computer music environment I wrote |
| 162 | 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 | 174 | #+NAME: siren.rnt |
| 166 | 175 | #+BEGIN_SRC runt :tangle siren.rnt |
| @@ -186,9 +195,12 @@ add · 19 unmodified lines | ||
| 186 | 195 | sr 10 * _compute rep |
| 187 | 196 | #+END_SRC |
| 188 | 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 | 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 | 205 | The scheme =ugens= are wrappers around runt code, so it is |
| 194 | 206 | structurally identical to the runt and monolith code. |