I have a program which generates sound events at given points in time. An event may be to play a sample, to begin looping or to stop looping a sample. The program is not running in real time, it may be slower or faster than real time. What I want to do is record the output of the program to a wave file on disk.