Theo Verelst Additive Synthesis Program

Updated Nov 14 2004

I've made a number of audio programs, like this years ago, of which the most advanced to time is the String Simulator, but here is a start of a socket/text controlled, PA sound lib (v 181) interfaced (OSS under Linux, and also Windows works) additive synthesis samples-based sound program, intended as learning and experimentation tool, and a core to build more sound programs on.

    Screen shot of the prototype program under Linux RedHat 9, windowmaker, linked with Tcl/Tk based BWise.

The sound program, which is organized as a simple command line execution based server, is written in C, and contains a additive synthesis core based on in main memory sound sample memory.

Interfacing with the core sound program is done with text commands which control the virtual sound generators, those commands are in this prototype passed to the sound server by a tcl/tk program sending text messages over a socket.

I've made two Tcl/Tk programs relevant to this setup, called Bwise and Pcom, included in below distribution.

The idea currently is to have a number of sliders which each control a harmonic component in the sound. When a slider control is released, a new waveform will be computed live (causing artifacts in the live sound, possibly) which is then used as the sample to output to the sound card.

Readable commands are sent to the soundtest program live, to interact with it. From the Tcl/Tk (bwise) console window, where commands can be typed, the tcl procedure 'pcsend', which takes one argument, is used to send the soundtest program a text command, like:
   pcsend "genvol 0 100"

will set the generator volume of oscilator 0 to 100.

Possible commands at the moment are:

   genstate <oscilator #> <state>
generator state, 1 is on 0 is off.
   genfreq <osc #> <freq>
set generator frequency, in milliherz, so 440Hz would be 440000 .
   genvol <gen #> <volume>
set generator volume, IIRC 1000 is maximum.
   makeadditivetable <sample table #> <freq 0> <ampl 0> <freq 1> <ampl 1> ... <freq 7> <ampl 7>
make a sample table based on 8 harmonic components, which should be integers.
quits the sound server program.


I'll add more explanation here, for the moment, check the sources for arguments and example scripts.

Download and Installation issues

First, you'll need to have OSS compatible sound on your linux system, which I think is standard on RedHat9 which I used. On windows, you'd have to have a soundcard and normal support for it, which will usually be the case.

For linux, the abovementioned PA sound lib has to be installed first, see the website, compilation shouldn't be a problem on linux or cygwin on windows though possibly not trivial when you're not used to that. There are examples to try out your soundcard and the library access routines to your systems sound resources, mind that you can set the latency (the time it takes for sound to get from the input to the ouput for instance when you use the 'wire' feedthrough example program) by from a command shell typing:
   export PA_MIN_LATENCY_MSEC=50
which sets the number of milliseconds, so in this case 1/20th of a second. The lowest latency varies per system, OS, soundcard and application, probably 50 will work for most modern systems, I could go to 10 on redhat.

The windows sources include the relevant palib soure files so that it should be possible to simply make under cygwin.

I've prepared the following zip files:      54 kilo bytes   sources and RH9 executable , winzip

soundtest1a_win.xip 61 kB sources and .exe (requires cygwin or recent cygwin.dll) , winzip

There are two programs involved in making sounds, the soundtest(.exe) and a tcl interpreter, which connect over a stream. It takes a little while to start up the soundtest program first, and then the user interface and let the connection be established. I the connection doesn't automatically get established, try pushing the 'connect' button in pcom. As soon as the connection is made, soundtest should start to make a sound. which you can then change by the sliders.

On windows, start wish with 'startup.tcl' from the cygwin command like, in my case for instance:
   /cygdrive/c/Tcl/bin/wish startup.tcl
   wish startup.tcl
probably works, too, using cygwins' Tcl.

On Linux (/Unix) there is a simple shell script to do the same:
that will do the above, assumingyou have Tcl/Tk installed.

Note that the drawbars work like on an orgran: lower is louder, and that the result can easily clip.