ref: a68874bd0c571dfff06ee6ee3d9b2c5d8c283008
dir: /README.md/
# faust9p Tools to compile [Faust](https://faust.grame.fr) DSP code to a 9p server running on Plan 9. ## Testing Since Faust isn't(?) ported to Plan 9 (yet?), first you need to generate some code on some other OS that supports it, by running `./gen.sh`. So far only one instrument provided, which is a kick drum. ``` % ./6.out -m /n/kick % cd /n/kick # allocate one instance % cd `{cat clone} # check the A oscillator frequency # the order is: type value initial min max step # it's different for different UI elements % cat K*/a/frequency/ctl vslider 100 100 10 200 5 # raise frequency to 160Hz % echo 160 > K*/a/f*/ctl # pipe sound to /dev/audio in background % audio/pcmconv -i f32c2r44100 < data > /dev/audio & # start toggling the gate to get the kicks % while() { echo 1 > K*/control/gate/ctl && sleep 0.2 && echo 0 > K*/control/gate/ctl } & # set B oscillator parameters and enable it % echo 600 > K*/b/frequency/ctl % echo 0.001 > K*/b/attack/ctl % echo 1 > K*/control/b*/ctl ``` ## Description A DSP fs presents an interface to create instances of a DSP class by reading the `clone` file. In the resulting directory `metadata` is used to read general info about the dsp, `data` is used to supply input to the DSP (if it has any inputs) by writing to it, and output can be read from it. The format is raw stream of `float`. Each DSP instance, in addition to the mentioned files, provides a file tree that reflects the UI elements. UI elements provide `ctl` file to read initial and current, maximum and minimum, step, and may be used to write a new value to it. `metadata` is provided to read/write UI-specific metadata key/values. Several DSPs may be connected by chaining their `data` interfaces together. If some parameters need to be changed dynamically during processing with frame accuracy, it can be achieved by running the chain for a chunk of data, changing the parameters, then continuing processing. ## TODO * a program to control DSP through an actual UI in rio * `<ui>/value` to watch the changes, add frame offset as well to know when it actually changed * optional frame offsets for all commands, perhaps that's easier than running and stopping the processing all the time * `reset` command for groups * forbid writing values that are out of min/max range: return an error * add writable `metadata` for each instance * allow adding new key/values to `metadata` * add some way to read and write the whole configuration of an instance in an easy way, so instances can be cloned, or configs saved to disk as presets