The STK opcodes in Csound were unclear to me because they are not documented in the manual. Using "csound -z" shows 27 of these opcodes. In UbuntuStudio10.04 i was building Csound as described in the manual from CVS. The STK opcodes can be found in the STK download section https://ccrma.stanford.edu/software/stk/download.html . Download the source distribution and follow proceedings as described in the text below.
The beauty of the sounds produced i think is that it sounds like a real instrument, not like THE real instrument - not exactly like a flute or a mandolin, but flute-like or mandolin-like sounds, but not at all like rigid samples that sound the same each time they are played. You can check that every time the same STK instrument is played; the output differs a bit every time.
Two people have intergrated several STKopcodes into Csound, mr. Ffitch and mr. Gogins.
I will start with the ones mr. Gogins adapted for Csound.
He has put the letters "STK" in front of the names of those opcodes.
Here is a fragment from the text taken from csound5/Opcodes/stk/stkOpcodes.cpp as found in
http://csound.cvs.sourceforge.net/viewvc/csound/csound5/Opcodes/stk/ :
* CSOUND 5 OPCODES FOR PERRY COOK'S SYNTHESIS TOOLKIT IN C++ (STK) INSTRUMENT
*
* This code is copyright (C) 2005 by Michael Gogins. It is licensed under the
* same terms as the Synthesis Tookit in C++ by Perry R. Cook and Gary P. Scavone.
*
* To compile these opcodes, copy the STK include, src, and rawwaves directories
* to the csound5/Opcodes/stk directory as follows:
*
* csound5/Opcodes/stk/include
* csound5/Opcodes/stk/src
* csound5/Opcodes/stk/rawwaves
*
* Also, specify buildStkOpcodes=1 for SCons.
*
* To use these opcodes, define a RAWWAVE_PATH environment variable that points
* to your rawwaves directory, which contains raw soundfiles with function table
* data.
*
* All these opcodes are named "STK" + the STK classname,
* e.g. "STKBowed" for the Bowed instrument.
*
* All the STK opcodes have the same signature:
*
* aout STKName ifrequency igain {kcontroller0, kvalue1,...,kcontroller3, kvalue3}
*
* They take a frequency in Hertz and a gain parameter in the range [0, 1],
* plus up to four optional krate controller-value pairs, and return an arate
* signal that should be more or less in the range [-1, +1].
* See the STK class documentation to determine the controller numbers
* used by each instrument.
........The text mentions: {kcontroller0, kvalue1,...,kcontroller3, kvalue3}
but when you try to change "kvalue" with something like "kvalue line 128, p3, 1" you get the following error:
error: input arg 'kvalue' of type k not allowed when expecting j
What j is exactly i do not know, but when you give a constant value - like it is i and not k - it works.
Also worth mentioning is that the range of kvalue1, kvalue2, kvalue3 and kvalue3 = 1 - 128........
THIS HAS BEEN CORRECTED IN CVS. ALL VALUES OF THE CONTROLLERS CAN BE CHANGED AT K-RATE NOW
His file CsoundAC.csd in \examples included in the Windows version and in CVS uses these opcodes too.
----------
According to the documentation of the Synthesis ToolKit
( https://ccrma.stanford.edu/software/stk/classes.html ) :
STKBandedWG - Bow Pressure = 2, Bow Motion = 4, Strike Position = 8 (not implemented), Vibrato Frequency = 11, Gain = 1, Bow Velocity = 128, Set Striking = 64, Instrument Presets = 16
Uniform Bar = 0
Tuned Bar = 1
Glass Harmonica = 2
Tibetan Bowl = 3
STKBeeThree - (FM) Operator 4 (feedback) Gain = 2, Operator 3 Gain = 4, LFO Speed = 11, LFO Depth = 1, ADSR 2 & 4 Target = 128
STKBlowBotl - Noise Gain = 4, Vibrato Frequency = 11, Vibrato Gain = 1, Volume = 128
-STKBlowHole - Reed Stiffness = 2 ,Noise Gain = 4 ,Tonehole State = 11,Register State= 1,Breath Pressure = 128
+STKBowed - Bow Pressure = 2, Bow Position = 4,Vibrato Frequency = 11, Vibrato Gain = 1, Volume = 128
+STKBrass - Lip Tension = 2, Slide Length = 4, Vibrato Frequency = 11, Vibrato Gain = 1, Volume = 128
+STKClarinet - Reed Stiffness = 2, Noise Gain = 4, Vibrato Frequency = 11, Vibrato Gain = 1, Breath Pressure = 128
+STKDrummer -
+STKFMVoices - Vowel = 2, Spectral Tilt = 4, LFO Speed = 11, LFO Depth = 1, ADSR 2 & 4 Target = 128
+STKFlute - Jet Delay = 2, Noise Gain = 4, Vibrato Frequency = 11, Vibrato Gain = 1, Breath Pressure = 128
STKHevyMetl - (FM) Total Modulator Index = 2, Modulator Crossfade = 4, LFO Speed = 11, LFO Depth = 1, ADSR 2 & 4 Target = 128
+STKMandolin - Body Size = 2, Pluck Position = 4, String Sustain = 11, String Detuning = 1, Microphone Position = 128
+STKModalBar - Stick Hardness = 2, Stick Position = 4, Vibrato Gain = 1, Vibrato Frequency = 11, Direct Stick Mix = 8, Volume = 128, Modal Presets = 16
Marimba = 0
Vibraphone = 1
Agogo = 2
Wood1 = 3
Reso = 4
Wood2 = 5
Beats = 6
Two Fixed = 7
Clump = 8
STKMoog - Filter Q = 2, Filter Sweep Rate = 4, Vibrato Frequency = 11, Vibrato Gain = 1, Gain = 128
STKPercFlut - Total Modulator Index = 2 Modulator Crossfade = 4 LFO Speed = 11 LFO Depth = 1 ADSR 2 & 4 Target = 128
+STKPlucked -
+STKResonate - Resonance Frequency (0-Nyquist) = 2 Pole Radii = 4 Notch Frequency (0-Nyquist) = 11 Zero Radii = 1 Envelope Gain = 128
STKRhodey - (FM) Modulator Index One = 2 Crossfade of Outputs = 4 LFO Speed = 11 LFO Depth = 1 ADSR 2 & 4 Target = 128
+STKSaxofony - Reed Stiffness = 2 Reed Aperture = 26 Noise Gain = 4 Blow Position = 11 Vibrato Frequency = 29 Vibrato Gain = 1 Breath Pressure = 128
STKShakers - Shake Energy = 2 System Decay = 4 Number Of Objects = 11 Resonance Frequency = 1 Shake Energy = 128 Instrument Selection = 1071
Maraca = 0
Cabasa = 1
Sekere = 2
Guiro = 3
Water Drops = 4
Bamboo Chimes = 5
Tambourine = 6
Sleigh Bells = 7
Sticks = 8
Crunch = 9
Wrench = 10
Sand Paper = 11
Coke Can = 12
Next Mug = 13
Penny + Mug = 14
Nickle + Mug = 15
Dime + Mug = 16
Quarter + Mug = 17
Franc + Mug = 18
Peso + Mug = 19
Big Rocks = 20
Little Rocks = 21
Tuned Bamboo Chimes = 22
STKSimple - Filter Pole Position = 2 Noise/Pitched Cross-Fade = 4 Envelope Rate = 11 Gain = 128
+STKSitar -
+STKStifKarp - Pickup Position = 4 String Sustain = 11 String Stretch = 1
+STKTubeBell - (FM) Modulator Index One = 2 Crossfade of Outputs = 4 LFO Speed = 11 LFO Depth = 1 ADSR 2 & 4 Target = 128
+STKVoicForm - Voiced/Unvoiced Mix = 2 Vowel/Phoneme Selection = 4 Vibrato Frequency = 11 Vibrato Gain = 1 Loudness (Spectral Tilt) = 128
+STKWhistle - Noise Gain = 4 Fipple Modulation Frequency = 11 Fipple Modulation Gain = 1 Blowing Frequency Modulation = 2 Volume = 128
STKWurley - (FM) Modulator Index One = 2 Crossfade of Outputs = 4 LFO Speed = 11 LFO Depth = 1 ADSR 2 & 4 Target = 128
-------------
An simple example of the use of a STKopcode is:
sr=44100
ksmps=10
nchnls=2
instr 1 ;STK Clarinet
;asignal STKName ifreq igain ,cont1,val1,cont2,val2,cont3, val3,cont4, val4
asignal STKClarinet 100, 1, 2, 1, 4, 120, 11, 2, 128, 128
asignal = asignal*30000
;asignal declick asignal
outs asignal, asignal
endin
i1 0 10
e
note: igain is a pregain, so leave it at 1 or less, unless you intend to distort your instrument
note: in the STKopcodes 4 controllers and its values are permitted at the moment (not more, less is ok).
Other examples from mr. Gogins are in his file Csound\examples\CsoundAC.csd in the Windows version of Csound5.
--------------
Then about STK opcodes that are implemented in Csound by mr. Ffitch. They are less recognizable by their names, but are recoded so that there are k-parameters and therefore these parameters can be changed while the note is playing.
The opcodes are:
gogobel, mandolin, marimba, moog, shaker, vibes, voice, wgbow, wgbowedbar, wgbrass, wgclar, wgflute, wgpluck2
These are well documented in the manual.
Menno Knevel


