sendSC Example

Matt Wright, 7/29/96

Sandy has an SGI machine to run the demosoftcast synthesizer, and she wants to try different synth features from a simple text-based front end.

She opens a shell window to run the synthesizer, and in it she invokes demosoftcast with a command like:

demosoftcast -howmany 50 /usr/local/cast/lib/data/coleman/lick1.fmt

This starts a synthesizer, which listens on UDP port 7005 (the default) for SynthControl messages. For a different port number, e.g., 7123, Sandy would have invoked the synth like this:

demosoftcast -howmany 50 -port 7123 /usr/local/cast/lib/data/coleman/lick1.fmt

When the synthesizer starts, the "rate" of each voice defaults to zero, so no sound is produced yet.

Now Sandy opens another shell window to run sendSC. It would have been possible to run the synthesizer as a background process, and sendSC as the foreground process in the same shell, but that's more confusing, and with separate shells Sandy can kill the synth at any time just by typing an interrupt character in the synth's shell.

To invoke sendSC, Sandy just types:

sendSC 7005

(Or whatever UDP port number the synth is set to.) Now the sendSC program is running, and any command she types will be translated to the SynthControl format and sent to UDP port 7005 on the local machine.

If Sandy wanted to run sendSC on a different machine than the machine the synth is running on, she would have invoked sendSC with a flag naming the synth's machine. For example, if the synth were on port 7099 of machine "foo.bar.edu", she would have typed:

sendSC -h foo.bar.edu 7099

Now the sendSC program is running in a Unix shell. To get the synth to make a sound, Sandy sets the rate for voice one to something besides zero, by typing this to sendSC:

Arate 1.0

It's important for the rate parameter to contain a decimal point. The synth's rate parameter takes a floating point argument, but the sendSC program doesn't know that. The sendSC program just knows that if a numeral has a decimal point it's a float, and otherwise it's an integer.

If Sandy types

Arate 1

to sendSC, sendSC will parse "1" as an integer, and will therefore generate a SynthControl message setting the parameter "rate" for voice 1 to data value 0x0001, the binary representation of the integer 1. But the synth is expecting a float argument to the rate parameter, so it will interpret the data 0x0001 as the floating point number 1.4013e-45. This rate is not very different from the default rate of zero!

Now that the synth's rate is 1.0, the synth's virtual time moves forward at the rate of one virtual second per second. After virtual time advances all the way through Sandy's dataset, Sandy wants to hear the sound again, so she sends a "jam" message to the synth. She types the following to sendSC:

Ajam 0.0

This "jams" voice one's virtual time to the value 0.0, which is the start of the file. Since voice one's rate is still 1.0, time advances from zero through the end of the file again, with the effect of playing back the file a second time. Sandy keeps sending "Ajam 0.0" each time she wants to "play" the file.

Eventually Sandy gets tired of just playing back the same file over and over. To find out what other commands the synth accepts, she reads the list of all the synth's BYO functions to see what each of them does and what parameters it takes.