First time here? Check out the FAQ!

How do I output midi pitch-bend data from kyma?

0 votes

I have a couple of Doepfer Dark Energies which give a CV out for pitch bend. I want to send pitch bend data out from Kyma over midi from a sequencer sound I'm building.

The midiOutputEvent and midiOutputController sounds don't do pitchbend do they?

Do I have to use the MidiOutputEventInBytes? If I do, can anyone give some pointers to what I'd put in the Bytes parameter?

Would it be something like:

16rE0 16r00 (((((1 bpm: !BPM) nextIndex) mod: 4) of: {(1 to: 4) collect: [:i | !PitchBend suffix: i]}) * 127)

... for sending PitchBend on Midi channel 1, sequency through four faders in the VCS that set the pitchbend value. Here I'm ignoring the least significant bits ("16r00"), how would I deal with them?




asked Mar 7 in Controllers, OSC & MIDI by alan-jackson (Adept) (2,850 points)
edited Mar 7 by alan-jackson
I seem to have answered my own question in trying to ask it. Thank you Q&A forum for being my teddy bear.

What I wrote above works I had just forgotten that the midi channel part of the byte starts at 0 not 1. So I should have started with the byte "16rE0" for midi channel 1 and not "16rE1" which is what I originally wrote. An out by one error, typical.

I'll go edit the original question to fix that.
Hi Alan, how are you using the pitch-bend at the destination?  If you're using it to get pitches that are other than equal tempered integer note numbers, you could just send those note numbers as !KeyNumbers.  For example if you output 60.5 nn as the !KeyNumber in the MIDIOutputEvent, it will send it as a combination of 60 and a pitch bend to your external MIDI destination.
I'm using a Doepfer Dark Energy as a midi-CV converter. It provides CVs for note, velocity, pitchbend and one other CC.

I'm basically using pitchbend as a generic CC. I'm using it to control the vowel sound of the Mutable Instruments Braids oscillator. So it's not synchronised with the gate - so fractional note numbers wouldn't work for me. But thanks for the suggestion!
One way to change pitch difference into a generic output controller would be to sample-and-hold the pitch on the keydown, take the difference between current pitch and that sampled pitch, and use this as the expression in MIDIOutputController.  That would output the bend as any MIDI controller number you like (for example, for example the CC number the Doepfer can convert).

1 Answer

+1 vote
Best answer

The MIDIOutputEvent Sound outputs pitch bend continuously as the Frequency parameter value changes. The range for the pitch bend output is 12 nn, so you could use:

60 nn + ((!LocalTime gt: 0.001) * !YourOutputValueInRangeOfPlusOrMinusOne * 12 nn)

in the Frequency field and


in the Gate field. This will cause the MIDIOutputEvent to initially send a key down with 60 nn and then, after the first millisecond, it will output the EventValue using pitch bend messages.

You could use the simpler expression

60 nn + (!YourOutputValueInRangeOfPlusOrMinusOne * 12 nn)

in the Frequency field if you can be sure that !YourOutputValueInRangeOfPlusOrMinusOne will be zero when your Sound starts.

answered Mar 8 by ssc (Savant) (57,610 points)
selected Mar 11 by alan-jackson
That's great. That's  a lot nicer than using hex in the MidiOutputEventInBytes.

I'm trying to work out why this works... Oh I see. So by putting !LocalTime in the Gate parameter, that will start at 0 then after a milisecond it will be greater than 0 and that will trigger the Gate and hold it on indefinitely.

The (!LocalTime gt: 0.001) expression will ensure that as the Gate is triggered, at LocalTime = 0.001, the Frequency parameter is 60nn and pitchbend isn't generated until LocalTime = 0.002.

Got it. Brilliant. Thanks!