Convert midi single channel to multiple


#1

Hi,

I'm wondering if it's possible to get data from a keyboard, with multiple notes on channel 1 on DIN MIDI IN and convert to multi channel notes up to a certain channel # on MIDI OUT. A round robin way. My interest is that Nord Drum 2 has some nice synth like modes where it expects a note on different channels (per voice) but my keyboard does not have built in MPE...


#2

ok, this is 'theoretically' trivial... what we can do is reuse the voice allocation done by axoloti, as midi channel allocation.
(building your own allocation scheme, would require a more complex patch, or your own object, and probably not necessary for your use)

the most efficient way to do this is with a midi script, but then it just ends up as C code,
... so i'll show another way :slight_smile:

a) create an embedded subpatch, make it poly with (e.g.) 16 voices
b) in this subpatch connect a midi/in/keyb to midi/out/note

ok, now what we want to do, is use the voice's index (aka polyIndex) as the midi channel,
now you'll say, the issue is I cannot change the channel, on midi/out/note - correct

so what we need to change the midi/out/note object... and create a specialisation.

so, select the object, and select embed as object.

now here I have a choice, i could just 'hack it' or make a reusable (for me) variation, lets look at both approaches:

a) the 'hack' approach
i) edit the object
ii) delete attribute channel
iii) in the midi code , replace attr_channel - 1 with parent->polyIndex
(note: polyIndex is already 0 to 15, so we dont need the minus 1)

thats it, done

b) the improved object approach
i) edit the object
ii) delete attribute channel
iii) add a new inlet, called channel, and type int32 positive
iv) in the k-rate code , replace attr_channel - 1 with inlet_channel
(again polyIndex is already 0 to 15, so we dont need the minus 1)
v) then add a polyIndex object to the patch, and attach it to the channel inlet

thats it, done

both things do the same, just the latter allows you to mess about with channels, in the patch rather than editing the code.

the reason Ive shown this is, ... you can see, it takes 15 seconds to create variations,
so in axoloti, we dont need 100's of varieties of objects in the factory (etc), with every possible variation... its so trivial to create our own variations.

I use this approach all the time. I don't bother saving these variations in my library (unless I plan to use on many project), I just simply embed the object. ... you can even cut n paste them between patches, if you need to reuse in one or two patches.

hopefully this is helpful
Mark

ps. I didn't actually test the above, so there may be some oddities I've not considered... but should give you basically what you need :slight_smile:


USB Midi Controllers
#3

Hello TB I have a digitakt and the above function (midi dispatcher) where each note press sends to a different channel would be very desirable for polyphonic play or for polyphonic aftertouch in the guitar mode of my matrix1000.

I am very new to Axoloti and have tried for a while now to implement both your hack and improved object approach, but I cannot get it to work. It is highly likely this is user error and me perhaps trying to run before I can walk.

Has anyone else tried to implement this function?

Bafonso did you get it working?


#4

When I try to load the patch I get this error.....
Shell task failed exit level: 2


#5

I ended up coding a new module myself. Unfortunately I didn't back it up so I lost it. :frowning: I glanced at the midipal code for inspiration. More than one person have asked me, maybe I will write the code again once I'm back home. Sorry I can't be of help now.


#6

Awesome that you had some success, I am a code novice but I could take a look at the midipal code too I guess.
Losing modules must be a nightmare. Thankyou for getting back to me though...at least now I know it's possible, and hopefully the midipal code will make some sense to me...


#7

Well, just my luck I happened to have it in my downloads folder which is the only one not backed up with time machine... Let's just say I would do it differently. :wink:

Fundamentally, It boils down to building a container (array) into where you store what notes are being played in what channel. And then you need to decide how you handle when you have more notes than polyphony, ie, do you replace the oldest note, or the highest/lowest pitch, etc. I can look at this in a couple of weeks, not before. It's a good coding exercise though :slight_smile:


#8

thank you again for the help, and for detailing the rough concept, I sincerely appreciate it. I'll do my best to cobble something together....with the directions you've given hopefully at least I can get myself safely out of the downloads folder and into that time machine


#9

Marks tip works perfeclty well!
I tried the second approach, improving the obejct.

You have to make sure, that you replace "attr_channel - 1" with "inlet_channel" everywhere in the code!!! It appears several (two?) times. Thats it.
... and thanks a lot, Mark for your Tip. Very helpful while leraning Axoloti.


#10

Hey I have a Nord Drum 2 too and also wanted to use as a poly synth, so this is working great following technobear's instructions! Saved me from having to buy a midipal descendant! First time i've edited an object too! Now hopefully i can do some more customizing.

It works almost as expected though there's one weirdness, i have the patch/patcher embedded subpatch in polyphonic mode with 6 notes because that's all the Nord Drum has. Everything works fine, (sometimes I'm not sure why it chooses a channel but it works for my purposes regardless of what channel it plays,) and when I hit a 7th or 8th note, it does nothing as expected. But if I release the 7th or 8th note, it will send a note off on a (seemingly random) previous 1-6 channel.

I think it's fine, I'll just not hit more than six notes at a time, plus the sounds I'll be using on the nord won't have super long sustains, maybe it won't even be noticed. I just thought it was weird behavior.

Anyhow, thanks to all in this thread for the help!