Kyma Forum
  Kyma Support
  processing midi input

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   processing midi input
Phi Curtis
Member
posted 29 September 2005 10:50         Edit/Delete Message   Reply w/Quote
Hi, I'd just like a quick pointer to what prototypes/areas of Kyma I should be looking at in order to process midi input. For example, while playing my Wacom tablet as a keyboard, I'd like to be able to press one of the PenButtons and change the octave of the next note I'm going to play with the pen, but not change the octave of the currently playing notes (for example, I may have a chord sustaining beneath a melody, or I'm playing a legato line and I don't want to have to precisely coordinate touching the eraser to the pad and pressing the button at the same time).

Any suggestions?

thanks,
Phil

IP: Logged

SSC
Administrator
posted 29 September 2005 11:39         Edit/Delete Message   Reply w/Quote
To send a Pen event but not have it take effect until the next KeyDown, you could use:

!PenButton1 alignWith: !KeyDown

To have this change the octave, you could multiply it by 12 half steps and add it to the pitch from the keyboard or tablet:

!KeyPitch + (12 nn * (!PenButton1 alignWith: !KeyDown))

IP: Logged

Phi Curtis
Member
posted 29 September 2005 13:23         Edit/Delete Message   Reply w/Quote
Looks like I need a smalltalk reference - "alignWith" isn't covered in the Kyma X Revealed Smalltalk appendix (I realize that it wasn't meant to be exhaustive). Do you have any recommendations? I've seen the free downloadable books listed in the Tweaky, but am not sure which would be the best to serve as a reference.

Anyway, a modified version of your suggestion worked for me:

!KeyPitch hz * (1 + (!PenButton1 alignWith: !KeyDown))

However, a problem arises in that I am using a polyphonic sound (preceding the Oscillator with a MidiVoice with polyphony set to 4). So now what happens is the sound changes the octave on the next !KeyDown, but you have to play four notes (going through the 4 notes of the polyphony) before the octave returns to normal.

How can I make this solution work polyphonically?

Thanks,
Phil

IP: Logged

SSC
Administrator
posted 29 September 2005 13:49         Edit/Delete Message   Reply w/Quote
"Looks like I need a smalltalk reference - "alignWith" isn't covered in the Kyma X Revealed Smalltalk appendix"

alignWith: is CapyTalk (not Smalltalk) and it is a relatively new addition (thus, it does not appear in the book). Update notes are available on the download page of the tweaky: http://www.symbolicsound.com/cgi-bin/bin/view/Know/KymaXDownloads

"However, a problem arises in that I am using a polyphonic sound"
I had assumed it was monophonic since you said you were triggering it from the tablet.

"How can I make this solution work polyphonically?"
You could add a check for the VoiceNumber if you know which voice you want to transpose:

!KeyPitch hz * (1 + (!PenButton1 alignWith: (!KeyDown * (?VoiceNumber eq: 1))))


IP: Logged

Phi Curtis
Member
posted 29 September 2005 16:30         Edit/Delete Message   Reply w/Quote
quote:
Originally posted by SSC:
I had assumed it was monophonic since you said you were triggering it from the tablet.
[/B]

I'm using a sustain pedal with the tablet. I suppose I could also be using multiple pens, if I had multiple pens. Hopefully, if I manage to come up with a sound that does some of these kinds of tricks I can post it to the Tweaky eventually.

Now I need a way to keep track of which VoiceNumber is current. Something that involves countTriggersMod?

Incidentally, I get the entire sustaining chord jumping octaves with the code:
!KeyPitch hz * (1 + (!PenButton1 alignWith: (!KeyDown * (?VoiceNumber eq: 1))))

IP: Logged

SSC
Administrator
posted 30 September 2005 14:58         Edit/Delete Message   Reply w/Quote

penButtonoffsetpitchonnextKeyDown.kym

 
OK, it turns out there was a bug in CapyTalk that was interfering with alignWith (and a couple of other expressions as well). This has been fixed but will require that you download a new version of Kyma. We'll try to get one ready for everyone over the weekend.

In the meantime, here is an example of how to do what you want. First, you use !PenButton2 to set !Offset. In the Frequency field, you don't actually sample the new value of !Offset until there is a !KeyDown:

!KeyPitch + (12 nn * (!KeyDown sampleAndHold: !Offset))

Next, you want to *reset* !Offset whenever the next !KeyDown occurs. But !KeyDown is local to each voice and you need a global variable to know when *any* key down has occured. Since continuous controllers are global to all voices, you can use a SoundToGlobalController in the MIDIVoice so that each local !KeyDown generates a global controller (called, in this case, !AnyKeyDown).

Outside the MIDIVoice, you can generate the !Offset controller such that !PenButton2 sets the !Offset to 1 and the *next* keydown (on *any* voice) will reset !Offset to 0:

!PenButton2 hasChangedReset: !AnyKeyDown

To get the full picture you should probably download the attached Sound and take a look at it. (It may not function correctly until you get the new software update this weekend).

IP: Logged

Phi Curtis
Member
posted 30 September 2005 18:38         Edit/Delete Message   Reply w/Quote
Thanks! It's tricky, but I think I get it.

It also seems to mostly work as is, although there's some strange behavior. But take your time with the software update - I can wait.

Phil

IP: Logged

Phi Curtis
Member
posted 05 October 2005 13:34         Edit/Delete Message   Reply w/Quote
quote:
Originally posted by SSC:
[B]OK, it turns out there was a bug in CapyTalk that was interfering with alignWith (and a couple of other expressions as well). This has been fixed but will require that you download a new version of Kyma. We'll try to get one ready for everyone over the weekend.

I just found what I think is a bug, maybe one of the ones that you've also found, but wanted to check:

I've found that in polyphonic Keyboard setups, if I set the attack to a slow attack and then play more notes than I have polyphony, after I've played through the number of midi voices that I have, any notes that are then stolen are played with a short attack.

thanks,
Phil

IP: Logged

SSC
Administrator
posted 05 October 2005 14:53         Edit/Delete Message   Reply w/Quote
Which module was this? (e.g. the AR envelope?) There is a quick release when you voice steal but it is not supposed to affect the attack.

IP: Logged

Phi Curtis
Member
posted 05 October 2005 15:35         Edit/Delete Message   Reply w/Quote
I'm using the ADSR w/sustain, as found in the prototypes, using the expression (!KeyDown sustainBy: !Damper.

IP: Logged

SSC
Administrator
posted 06 October 2005 11:00         Edit/Delete Message   Reply w/Quote
Interesting. I hear what you mean. But the envelope is actually doing the right thing--so it is more of a psychoacoustic effect.

When Legato = 0, a re-attack immediately sets the envelope back to 0 and restarts the attack. However, when you have Legato = 1, the reattack begins from the *current* amplitude level, whatever that is.

If the envelope has not decayed all the way to zero and you reattack with a new pitch, that new pitch pops out at you as a sudden change. Oddly enough, if you put smoothing onto the !KeyPitch, you do not hear this as a sudden attack any more.

One solution would be to set Legato to 0. (This has the disadvantage of introducing a click when you voice steal and the envelope jumps to 0 immediately).

Another solution is to introduce a small amount of portamento (e.g. !KeyPitch smooth: 10 ms). If the pitch does not jump instantaneously to the new value, the reattack no longer pops out at you.

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply

Contact Us | Symbolic Sound Home

This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.


Ultimate Bulletin Board 5.45c