# Synthesis ToolKit Actor

last updated: Geoffrey Zheng and Ken Chen, December 6, 1999

STK is a set of audio signal processing C++ classes and instruments for music synthesis, developed by Perry Cook et al. over the years. For detailed description of STK, refer to its website.

The STK Actor is an interface to STK instruments from VSS. To use it, load `stk.so` and create an actor of type `StkActor`.

## StkActor messages

The StkActor does not take any additional message besides those messages understood by all generator actors.

## StkActor handler messages

A common message sequence to use an STK instrument is:

    a = Create StkActor;

    h = BeginSound a;

    SetInstrument h "<instrument name>"; // or SetInstrumentNum h <instrument number>;

    SetControl h <int control number>, <float control value>, <transition time>;

    <Message name> h <control value>, <transition time>;

    NoteOn h <frequency> <amplitude>;

    NoteOff h <amplitude>;

You have to assign an instrument to a handler before you can do anything with it. Available instrument names and their corresponding numbers are:

Physical Models: | Plucked | 0
| Bowed | 1
| BowedBar | 2
| Mandolin | 3
| Brass | 4
| Clarinet | 5
| Flute | 6
Stochastic Event Models: | Shakers | 7
Modal/Formant: | Marimba | 8
| Vibraphn | 9
| AgogoBel | 10
| VoicForm | 11
FM: | HeavyMtl | 12
| PercFlut | 13
| Rhodey | 14
| Wurley | 15
| TubeBell | 16
| BeeThree | 17
| FMVoices | 18
Sampling: | Moog1 | 19
| DrumSynt | 20

The names are kept the same as those used for STK's `syntmono`. All instruments can be controlled by SetControl, NoteOn, and NoteOff messages. Note that transition time may not have any effect on some controls. Each valid control number for a particular instrument corresponds to an instrument-specific message, listed in the tables afterwards. The following messages are equivalent:

    SetInstrument h "Bowed";
    SetControl h 4, 100.5, 5.3;

    SetInstrumentNum h 1;
    SetBowPosition h 100.5, 5.3;

- Physical Models:

Name | Number | Description | VSS messages | Control numbers | SKINI names
--- | --- | --- | --- | --- | ---
Plucked | 0 | basic plucked string |  |  |
Bowed | 1 | not hideous bowed string | SetBowPressure SetBowPosition | 2 4 | __SK_BowPressure_ __SK_BowPosition_
BowedBar | 2 | pretty good bowed bar | SetBowPressure SetBowPosition SetBalance SetSustain SetPortamento | 2 4 8 64 65 | __SK_BowPressure_ __SK_BowPosition_ __SK_Balance_ __SK_Sustain_ __SK_Portamento_
Mandolin | 3 | Perry's own mandolin | SetBodySize SetPluckPosition SetStringDamping SetStringDetune SetPluckStrength SetMic | 2 4 11 1 208 411 | __SK_BodySize_ __SK_PickPosition_ __SK_StringDamping __SK_StringDetune_ __SK_AfterTouch_ (none)
Brass | 4 | not so bad brass instrument | SetLipTension SetSlideLength | 2 4 | __SK_LipTension_ __SK_SlideLength_
Clarinet | 5 | pretty good clarinet | SetReedStiffness SetNoiseGain | 2 4 | __SK_ReedStiffness_ __SK_NoiseLevel_
Flute | 6 | pretty good flute | SetJetDelay SetNoiseGain | 2 4 | __SK_JetDelay_ __SK_NoiseLevel_

Common messages:

SetBreathPressure | 128 | __SK_AfterTouch_Cont_
SetVibFreq | 11 | __SK_ModFrequency_
SetVibGain | 1 | __SK_ModWheel_

- The Mandolin doesn't take SetBreathPressure, and it interprets SetVibFreq and SetVibGain differently as shown in the table.
- The Plucked doesn't take any message except NoteOn and NoteOff

- Stochastic Event Models:

Shakers | 7 | Type | Number | SetShakerType (0-12) SetShakerNum SetShakerRes SetShakerDecay SetShakerEnergy SetShakerEnergy | 1071 11 1 4 2 128 | __SK_ShakerInst_ __SK_ModFrequency_ __SK_ModWheel_ __SK_FootControl_ __SK_Breath_ __SK_AfterTouch_Cont_
Maraca | 0
Cabasa | 1
Sekere | 2
Guiro | 3
Water Drops | 4
Bamboo | 5
Tambourine | 6
Sleigh Bells | 7
Sticks | 8
Crunch1 | 9
Wrench | 10
Sand Paper | 11
Coke Can | 12

- The `<freq>` argument in NoteOn is not used. Just put any number there.

- Resonance models

Marimba Vibraphn AgogoBel | 8 9 10 | Modal (based on the 4-resonance Modal4 class) | SetStickHardness SetStrikePosition SetStrikeSpeed SetVibFreq SetVibGain | 2 4 128 11 1 | __SK_StickHardness_ __SK_StrikePosition_ __SK_AfterTouch_Cont_ __SK_ModFrequency_ __SK_ModWheel_
VoicForm | 11 | Formant: source/filter voice | SetVoice SetPhoneme SetVibFreq SetVibGain SetPole | 2 4 11 1 128 | __SK_Breath_ __SK_FootControl_ __SK_ModFrequency_ __SK_ModWheel_ __SK_AfterTouch_Cont_

- Vibraphn doesn't take SetStrikePosition
- Marimba doesn't take SetVibFreq

- FM Synthesis:

HeavyMtl PercFlut Rhodey Wurley TubeBell BeeThree | 12 13 14 15 16 17 | distorted synthesizer percussive flute Rhodes-like electric piano Wurlitzer electric piano classic FM bell cheezy organ for Paul(who?) |  |  |
FMVoices | 18 | 3-formant voice synthesizer | SetGain SetFormant SetModSpeed SetModDepth SetTilt(?) | __SK_Breath_ __SK_FootControl_ __SK_ModFrequency_ __SK_ModWheel_ __SK_AfterTouch_Cont_ | 2 4 11 1 128

- Only the FMVoices takes extra messages besides NoteOn and NoteOff.

- Sampling Synthesis:

Moog1 | 20 | Moog Synth | SetQ SetSweepRate SetModSpeed SetModDepth SetEnvelope(?) | __SK_FilterQ_ __SK_FilterSweepRate_ __SK_ModFrequency_ __SK_ModWheel __SK_AfterTouch_Cont_ | 2 4 11 1 128
DrumSynt | 21 | drum synthesizer covering a small subset of General MIDI drums | No extra message. The first argument of NoteOn is MIDI key number instead of frequency. | Drum type bass drum snare drum low tom high hat mid tom high tom ride cymbal crash cymbal tambourine cowboy bell "dope" | Key # 36 38, 40 41, 43 42, 44 45, 47 48, 50 46 49 54 56 else

## Test Case

The usual testcase.aud and testcase.ap pair is created for all STK instruments. It has 10 presets:

Preset | Instruments | Comment
--- | --- | ---
PhysMod | 0 Plucked 1 Bowed 2 Brass 3 Clarinet 4 Flute | First choose a type
BowedBar | BowedBar | Click Init to SetInstrument
Mandolin | Mandolin | No place for Init, so the sound is always there
Shakers | Shakers | First choose a type
Modal | 0 Marimba 1 Vibraphn 2 AgogoBel | First choose a type
VoicForm | VoicForm | Click Init to SetInstrument
FM | 0 HeavyMtl 1 PercFlut 2 Rhodey 3 Wurley 4 TubeBell 5 BeeThree | First choose a type
FMVoices | FMVoices | Click Init to SetInstrument
Moog1 | Moog1 | Click Init to SetInstrument
DrumSynt | DrumSynt | Click Init to SetInstrument

Changes made to STK

- Changed `RAWWAVE_PATH` and `SRATE` in Object.h
- Changed all "rawwaves" to "/rawwaves" to work with getenv()
- Shakers don't change type with frequency
- DrumSynt takes note number instead of frequency
- Add #ifndef in phontabl.h
- Comment out Zs[i][2] in BowedBar.cpp to avoid subscript out-of-range