electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » Instruments and Equipment » Strings and things
Kyma Resonator FX Example
Post new topic   Reply to topic Moderators: BobTheDog
Page 1 of 1 [8 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
BobTheDog



Joined: Feb 28, 2005
Posts: 4044
Location: England
Audio files: 32
G2 patch files: 15

PostPosted: Fri May 15, 2009 1:29 am    Post subject: Kyma Resonator FX Example
Subject description: Early days but you may be interested.
Reply with quote  Mark this post and the followings unread

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

Code:

(1 + (oct mod: 2))


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.

Code:

to: 7 by: 2


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

Code:

(pchs at: 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


CorrectImage.jpg
 Description:
 Filesize:  95.92 KB
 Viewed:  787 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

CorrectImage.jpg



Last edited by BobTheDog on Fri May 15, 2009 12:49 pm; edited 2 times in total
Back to top
View user's profile Send private message
BobTheDog



Joined: Feb 28, 2005
Posts: 4044
Location: England
Audio files: 32
G2 patch files: 15

PostPosted: Fri May 15, 2009 1:35 am    Post subject: Reply with quote  Mark this post and the followings unread

That mp3 has some cracking on it for some reason, making another now.....

This one has as well, must be something wrong with the Kyma patch MP3 encoding seems to bring it out more.

Oh well you get the idea!


KymaResonatorFX.mp3
 Description:

Download
 Filename:  KymaResonatorFX.mp3
 Filesize:  2.98 MB
 Downloaded:  1604 Time(s)

Back to top
View user's profile Send private message
DrJustice



Joined: Sep 13, 2004
Posts: 2114
Location: Morokulien
Audio files: 4

PostPosted: Fri May 15, 2009 12:41 pm    Post subject: Reply with quote  Mark this post and the followings unread

An excellent worked example, Andy!

The only thing I don't quite get is why DualFilter1, FrequencyDetectorGate and EnergyAtFrequency are instantiated with each explicit instance (as done in the script) of DualFilter2. I'll just accept that they are for now. Also, what does the little box with a "2" in it on the output wire of FrequencyDetectorGate mean?

(The module names in the explanation of the script are different from those in the picture of the patch, which had me scratching my head for a moment...)

DJ
--
Back to top
View user's profile Send private message Visit poster's website
BobTheDog



Joined: Feb 28, 2005
Posts: 4044
Location: England
Audio files: 32
G2 patch files: 15

PostPosted: Fri May 15, 2009 12:50 pm    Post subject: Reply with quote  Mark this post and the followings unread

Sorry about that, I have replaced the image. The previous one was from an earlier version.
Back to top
View user's profile Send private message
BobTheDog



Joined: Feb 28, 2005
Posts: 4044
Location: England
Audio files: 32
G2 patch files: 15

PostPosted: Fri May 15, 2009 1:01 pm    Post subject: Reply with quote  Mark this post and the followings unread

DrJustice wrote:
The only thing I don't quite get is why DualFilter1, FrequencyDetectorGate and EnergyAtFrequency are instantiated with each explicit instance (as done in the script) of DualFilter2. I'll just accept that they are for now. Also, what does the little box with a "2" in it on the output wire of FrequencyDetectorGate mean?
--


I think it is as follows:

When a DualFilter2 is created, Kyma looks back at the chain of modules feeding into it. If a module uses the variable ?freq it also creates an instance of that module using the value of freq that DualFilter2 has been given by the script. DualFilter1 and EnergyAtAFrequency use ?freq. FrequencyDetectorGate (and here I am guessing) is created as one of its inputs has been created.

I am not fully sure of the rules yet as I haven't read this part of the manual. I will have a look and report back with some more knowledge.


The little 2 signifies that the preceding module is used twice by the module to the right.

Dualfilter uses it to set the amplitude of both of the filters which are set via Scale1 and Scale2 shown in the included image. The L means use the left input, smoothed meens interpolate changes over 100ms, the !amp is a hot variable that can be set by midi or say a slider in the gui.

Cheers

Andy


DualFilter2Params.jpg
 Description:
 Filesize:  46.36 KB
 Viewed:  668 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

DualFilter2Params.jpg


Back to top
View user's profile Send private message
DrJustice



Joined: Sep 13, 2004
Posts: 2114
Location: Morokulien
Audio files: 4

PostPosted: Fri May 15, 2009 2:10 pm    Post subject: Reply with quote  Mark this post and the followings unread

BobTheDog wrote:
When a DualFilter2 is created, Kyma looks back at the chain of modules feeding into it. If a module uses the variable ?freq it also creates an instance of that module using the value of freq that DualFilter2 has been given by the script. DualFilter1 and EnergyAtAFrequency use ?freq. FrequencyDetectorGate (and here I am guessing) is created as one of its inputs has been created.

Aha - so in effect ?freq becomes a vector when the script runs and thus everything that references it get instantiated... ok. I assume that if you reference a variable, e.g. ?freq, in a module before it has been defined, e.g. by the script module, it is simply seen as void (hmm... or is it here that Kyma requires a user-initiated compilation step and would flag an error for referencing an undefined object...)

Anyway, I begin to see what the power of Kyma is about. It'll be interesting to see a similar'ish hexaphonic guitar patch some time Smile

DJ
--
Back to top
View user's profile Send private message Visit poster's website
BobTheDog



Joined: Feb 28, 2005
Posts: 4044
Location: England
Audio files: 32
G2 patch files: 15

PostPosted: Fri May 15, 2009 2:31 pm    Post subject: Reply with quote  Mark this post and the followings unread

If you run a sound that hasn't had the ?variable defined Kyma asks you for it in a dialog windows and then runs with the value you enter.
Back to top
View user's profile Send private message
GovernorSilver



Joined: Apr 26, 2004
Posts: 1349
Location: Washington DC Metro
G2 patch files: 1

PostPosted: Mon May 18, 2009 2:40 pm    Post subject: Reply with quote  Mark this post and the followings unread

Great demo!

With a Kyma, who needs MIDI guitar?

_________________
Current and recent work on Soundcloud

Some old stuff on VIRB
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: BobTheDog
Page 1 of 1 [8 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » Instruments and Equipment » Strings and things
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use