Thursday, September 16, 2004

lab 4 - signalfs

NAME

lab 4 - signalfs; generalize wavefs to a family of file servers that support a variety of sound sources and filters.

SETUP

Inferno 4th edition release 20040830. Using wavefs and the Synthesis Toolkit in C++.

DESCRIPTION

I started with the wavefs source and abstracted out an interface for modules that the fileserver can call. The signal processor implements this interface. The compiled dis module that implements a specific dsp is passed as parameter to the signalfs which exports the standard files

/signal
/signalctl

The interface is quite simple

Signal: module {
 configstr: string;

 init: fn(args: list of string);
 config: fn(s: string);
 tickFrame: fn(): array of real;
};

Messages written to /signalctl are passed to config, and reads return the contents of Signal.configstr. Reads from /signal, which is readonly, are sent data generated by tickFrame. I rewrote the wave loop module using this interface. wave.b The server is now mounted as

% mount {signalfs wave.dis sinewave.raw} /mnt/dsp/wave
% lc /mnt/dsp/wave
signal    signalctl

I implemented a few other DSPs. noise.b envelope.b filter.b The original source for all of these is from the STK. Each signal has it's own config options. Here's an example using the filter

% mount {signalfs filter.dis} dsp/filter
% echo acoef 1.0 0.1 0.5 > dsp/filter/signalctl
% echo bcoef 0.5 0.5 > dsp/filter/signalctl
% echo source dsp/wave/signal
% cat dsp/filter/signalctl
rate 22050
chans 1
gain 1
source dsp/wave/signal
acoef 1 .1 .5 
bcoef .5 .5 
% read 40000 < dsp/filter/signal > /dev/audio

CONCLUSION

It is too slow. We need another iteration to read vectors of ticks instead of single ticks.

I like the layout. It is simple to add new filters and sources. A filter can be applied to another signal file by just writing to the control file.

We'll need a mixerfs or voicefs to combine many voices and something to do the sequencing. It's nice generating sounds from the shell.

REFERENCES

Cook, Perry and Scavone, Gary P. Synthesis Toolkit in C++ http://www-ccrma.stanford.edu/software/stk/

No comments: