First time here? Check out the FAQ!
x

How can I stop MidiOutputEvent bending notes?

0 votes
304 views

I'm making a sound (a midi shift register) where I'm recording a midi note (!KeyNumber), storing it for a while in an array and then outputing it again using MidiOutputEvent.

But the notes are coming out weird. MidiOutputEvent seems to be sending pitchbend to my synth. If I play a few notes in when they get played back they don't sound the same and if I hold down a key on the keyboard (kurzweil pc3x) while these midi events are coming out of kyma I can hear it changing the note I'm holding, as if it's sending pitchbend. I've got MPE turned off in kyma's midi settings. 

Here's the shift register implemented in the value parameter of an STGC which generates the !NoteOut event:

| shiftRegister pos |  shiftRegister := EventVariable new size: 8. pos := EventVariable new initialValue: 0.  (!KeyDown true: (shiftRegister @< pos) <+ (!KeyNumber rounded) false: nil), (!Gate true: pos <+ ((pos + 1) mod: 8) false: nil), (!Gate evaluate: shiftRegister @< pos).

| shiftRegister pos |

shiftRegister := EventVariable new size: 8.
pos := EventVariable new initialValue: 0.

(!KeyDown true: (shiftRegister @< pos) <+ (!KeyNumber rounded) false: nil),
(!Gate true: pos <+ ((pos + 1) mod: 8) false: nil),
(!Gate evaluate: shiftRegister @< pos).

Here's the MidiOutputEvent:

I've added "rounded" messages to see if that would make a difference but it doesn't.

Here's the Sound.

I'm also getting similar bending behaviour from one of the Sounds in the kyma library, "One key in -> flurry of Pentatonic MIDI out"

I'm not sure if I'm doing something wrong or not.

 

 

asked Dec 5, 2018 in Controllers, OSC & MIDI by alan-jackson (Virtuoso) (15,840 points)

1 Answer

+1 vote
 
Best answer
Hi Alan,

You could try using (!Gate sampleAndHold: !NoteOut rounded) nn to ensure that the pitch is not changing over the course of a single note.
answered Dec 5, 2018 by ssc (Savant) (126,620 points)
selected Dec 6, 2018 by alan-jackson
That works thanks!

MidiOutputEvent has an undocumented feature. In it's description it says:

"Frequency
When MIDIOutputEvent is gated, this frequency is sampled and held and becomes the Pitch portion of the MIDI output key event."

What it could add in the description is if the frequency subsequently changes pitchbend messages will be sent.
Thanks, Alan! Here's the new description for that parameter:
"The value in Frequency is converted to a pitch in units of notenumbers (nn). When MIDIOutputEvent is gated, this pitch is sampled and held and becomes the !KeyPitch portion of the MIDI output key event. If the value of Frequency does not correspond to an integer notenumber, its value is transmitted as an integer pitch ± a !PitchBend. If the value of Frequency continues to change while Gate is down, those deviations from the initial pitch are transmitted as !PitchBend."
...