lab 60 - sequencer using channels
In the comments to lab 53 Rog suggested using channels to parse buffers between processes in place of the one-sample-at-a-time technique I was using in my earlier DSP attempts.
This lab is an attempt at Rog's suggestion. It's one limbo file that acts as a simple sequencer and generates it's own voices.
Each instrument should have an interface:
f: fn(c: chan of (array of real, chan of array of real), ctl: chan of (int, real));
This function is spawned and control messages are sent on the ctl channel, and the request for samples and the response channel are sent down c.
It really requires jit to be turned on to sound acceptable.
Here's a sample setup,
% bind -a '#A' /dev % echo 1 > /dev/jit % sequencer4 < bachfugue.ski > /dev/audio
Uncomment sequencer.b4:60 to add a little echo to the music.
I think I'm getting closer to Rog's ideas, but I'm not sure I'm still exploiting it to the fullest. I'm already liking this approach better. I do feel I can change things quicker and plug the modules together easier.
I'll try rearranging things some more.