shithub: neindaw

ref: af6b3f2488b4bb5f6650c24b941dbe75184a8fe9
dir: /README.md/

View raw version
# faust9p

Tools to compile [Faust](https://faust.grame.fr) DSP code to a 9p
server running on Plan 9.

![code](kick.png) → ![result](cfg.png)

## Installing

```
cd /tmp && \
hget https://github.com/ftrvxmtrx/microui/archive/master.tar.gz | tar xz && \
cd microui-master && mk install && cd .. && \
hget https://github.com/ftrvxmtrx/faust9p/archive/master.tar.gz | tar xz && \
cd faust9p-master && mk install && cd cfg && mk install
```

## Testing

So far only one instrument provided, which is a kick drum.

```
daw/kick_drum -m /n/kick
cd /n/kick
```

Allocate one instance.
```
cd `{cat clone}
cd K*
```

Check the A oscillator frequency, the order is `type value initial min max step`.
It's different for different UI elements.
```
cat A/Frequency/ctl
vslider	100	100	10	200	5
```

Raise frequency to 160Hz.
```
echo 160 > A/F*/ctl
```

Pipe sound to /dev/audio in background.  The numbers are how many
bytes of the output should be read.
```
while() { for(i in 22050 22050 22050 44100 44100) { audio/pcmconv -i f32c1r44100 -l $i < ../data } } > /dev/audio &
```

Set B oscillator parameters and enable it.
```
echo 400 > B/Frequency/ctl
echo 0.001 > B/Attack/ctl
echo 1 > B/Enable/ctl
```

Run `cfg` to configure the kick drum in a GUI.
```
daw/cfg /n/kick
```

## 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
 * 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
 * make all of that compile and run on Linux as well?