BobTheDog

Joined: Feb 28, 2005 Posts: 4041 Location: England
Audio files: 32
G2 patch files: 15
|
Posted: Fri May 15, 2009 1:29 am Post subject:
Kyma Resonator FX Example Subject description: Early days but you may be interested. |
 |
|
Hi Guys,
I know there are a few guitar players here interested in Kyma so I thought I would post this here.
It is a sort of resonator patch based on an example that comes with Kyma.
It is early days as I am still working on it but I quite like the sound of it.
There is an MP3 example attached and also an image of the patch which is a Clean guitar signal into Kyma and into Waves GTR providing some compression, a little chorus and a delay and into a warmish amp.
So how does the patch work (there is an image down the bottom)?
GtrResonator is a script which is used to "create" multiple instances of the modules to the left of it. For each instance of the modules It creates a variable called ?freq which it passes to them, more on this latter.
PinkNoise is a Pink noise generator.
DualFilter1 is a dual parallel two pole bandpass filter. The first filters frequency is locater at ?freq and the second at ?freq + 7 semitones. The bandwidth of the first filter is 11Hz and the second is 30Hz. The amplitudes of these filters are fixed.
DualFilter2 is also a dual parallel two pole bandpass filter. The frequencies are the same as the other filter but the bandwidths are 1Hz and 2Hz. The amplitudes of these filters are not fixed, they are set from a smoothed envelope provided by the FrequencyDetectorGate. This amplitude of this envelope can be attenuated by midi or a Kyma gui.
GtrSource is the source for the guitar.
EnergyAtFrequency is used to generate an envelope showing how much energy is at the frequency defined by ?freq. The release time of the envelope can be changed via midi or gui.
FrequencyDetectorGate is a Kyma Threshold module. The threshold and hysteresis can be modified via midi or a gui. So basically this is allowing us to gate the envelope based an an amplitude threshold.
This gated envelope is then fed into DualFilter2 to set the amplitude of the filters.
InputGain is just used to set the original guitar level to output based on midi or the gui.
So now we get back to the script in GtrResonator. This is a smalltalk script which is used to create the "Sound" based on the modules to its left in the signal chain.
Here is the script:
Code: |
| pchs |
pchs := #(c d e f g a b).
"The low number is the lowest octave and the high number is the highest octave (where 4 c is middle c)"
2 to: 7 do: [:oct |
((1 + (oct mod: 2)) to: 7 by: 2) do: [:pch |
DualFilter2 start: 0 s
freq: (oct perform: (pchs at: pch))]].
InputGain start: 0 s.
|
Lets look at it a bit at a time:
Code: |
| pchs |
pchs := #(c d e f g a b).
|
The above is declaring a variable that is a collection of the whole notes c, d, e, f, g, a, b
Code: |
2 to: 7 do: [:oct |
|
This is a loop. It is looping through octaves 2 to 7, each time through the loop the variable oct is set to the octave. so oct will have the vales 2 then 3 then 4 then 5 then 6 then 7. So it will travel through 6 octaves.
Code: |
((1 + (oct mod: 2)) to: 7 by: 2) do: [:pch |
|
This is also a loop which looks pretty complicated so lets take it a bit at a time.
The start of the loop is defined by the following
mod: is a modulo operator which in simpler terms is the remainder left after an integral division. Wikipedia has a confusing section at http://en.wikipedia.org/wiki/Modulo_operation for anyone interested.
Here is a table showing the result for the different results based on the value of oct:
Code: |
oct (oct mod: 2) (1 + (oct mod: 2))
2 0 1
3 1 2
4 0 1
5 1 2
6 0 1
7 1 2
|
So the mod: basically it is just a way of alternating between 1 and 0 for each octave. We than add 1 to it so we are alternating between 1 and 2 based on the octave.
The above just means that no value can be greater than 7 and each time around the loop :pch will be incremented by 2.
so lets have another table showing the octave and the values that :pch will get around this loop.
Code: |
oct pch values
2 1, 3, 5, 7
3 2, 4, 6
4 1, 3, 5, 7
5 2, 4, 6
6 1, 3, 5, 7
7 2, 4, 6
|
Now these values are going to be used to lookup note values in the pchs collection (c d e f g a b), index 1 is c, index 2 is d etc.
The following returns the note at an index defined by :pch
So we Get:
Code: |
oct pch values Note values
2 1, 3, 5, 7 c, e, g, b
3 2, 4, 6 d, f, a
4 1, 3, 5, 7 c, e, g, b
5 2, 4, 6 d, f, a
6 1, 3, 5, 7 c, e, g, b
7 2, 4, 6 d, f, a
|
So basically what we have done is slip the whole notes roughly in two and assigned them to different octaves.
Now the inside of the inner loop looks like this:
Code: |
DualFilter2 start: 0 s
freq: (oct perform: (pchs at: pch))]].
|
This is creating a new instance of the DualFilter2 module which also creates a new instances of DualFilter1, FrequencyDetectorGate and EnergyAtFrequency.
It is starting this immediately using "start: 0 s" which means start at 0 seconds and is passing a parameter (:freq) defined by "(oct perform: (pchs at: pch))". This :freq parameter is placed in the ?freq variable for the instances.
Ok nearly there!
Code: |
"(oct perform: (pchs at: pch))"
|
We already know that (pchs at :pch) is looking up the note in the collection. perform: is used to send this note as a message to oct.
So the first time arounfd the loops oct will equal 2 and pch will equal 1 so we will get the following placed in ?freq:
2 c
In kyma this is a note definition for c at octave 2.
The next time round the loops we will get
2 e
So we will end up with 21 new instances of the DualFilter2, DualFilet1, FrequencyDetectorGate and EnergyAtFrequency chain. Each will be using different frequencies set by the following notes:
Code: |
2 c, 2 e, 2 g, 2 b
3 d, 3 f, 3 a
4 c, 4 e, 4 g, 4 b
5 d, 5 f, 5 a
6 c, 6 e, 6 g, 6 b
7 d, 7 f, 7 a
|
So what does it all mean then?
When you play a note on the guitar the 21 EnergyAtAFrequency modules are generating envelopes based on the energy in the signal at the pitches defined above. These envelopes are then used control the amplitude of the bandpass filters at the same frequency letting various frequencies of the Pink noise through to the output.
This might wet your appetite to what is possible with Kyma scripting, or it may make you think bugger that wheres my pedals.
Cheers
Andy
Description: |
|
Filesize: |
95.92 KB |
Viewed: |
770 Time(s) |
This image has been reduced to fit the page. Click on it to enlarge. |

|
Last edited by BobTheDog on Fri May 15, 2009 12:49 pm; edited 2 times in total |
|