14
« on: February 04, 2016, 12:02:19 AM »
I am trying to modify voice allocation in preenfm2, and I'm currently studying the code.
I want to make it more playable by keyboard - for instance, in current implementation, when monophonic mode is chosen, when I press and hold 3 keys in some order, and then I lift first and last, second one isn't triggered.
What I want to do is add stack which will hold all pressed keys in order they are pressed, and as a player depresses some key, it is removed from stack and replaced by the one before it.
Few top keys on stack (depending on the polyphony) will activate voices, and as they are released, the ones before them will jump into freed voice, and trigger a note. (I don't know if I explained it well)
I have a basic logic figured out, and implemented a very simple test console application (it will surely need some work to be adapted to preenfm2).
Now I want to understand as much as possible logic around current implementation, so I could do it with as smoothly as possible.
For now, I have few questions about some specific details:
I understand (maybe incorrectly) that first for loop in preenNoteOn iterates through all voices reserved for this timbre to check if they are free to use. I think I understand remaining logic, as well, but I don't quite understand what "index" of a voice is used for. I suppose it has something to do with the order of voice allocation, but it may not be the case...
Anyway, thank you Xavier for making this very great synth, and above all for making it open source, so people can see how things are done in real world. I am really inspired to make my own, if I find enough free time, and after I get my hands dirty enough with preen.
edit:
Attached first working changes - patch file and two firmware variants (optimized and non-optimized).
In monophonic mode it works perfectly, as far as I have tested it. In polyphony it doesn't work as I intended it to, so I will investigate it further.
I am uploading it here as it is for anyone that want's to check it out, but I will continue working on this, depending on my free time.
Anyway, changes are miniscule as note_stack is already there and used by arpeggiator (I've added separate instance for manual performance), and I've added one method to it that I needed, and few small changes in other places...
another edit (mar 15, 2016):
New upload. I've experimented with polyphony and note stack, and when implemented correctly, it feels strange - imagine 4x polyphony, you hold 3 note chord with one hand, and than press another 3 note chord with another hand, than release second chord. When released, first chord gets triggered, and most of the time it doesn't sound like something you would have wanted to play on keys.
So I've decided to leave keyboard behavior in polyphony as it is originally implemented by Xavier, it's probably the best way to do it in poly. In this latest patch, stacked legato is active only when glide parameter is greater than 0.
I could (and will, as I find some more time) clean this patch a bit, as I think nextGlidingNote might be redundant after this change... And probably few other things.
Attached are both prepared firmware (including compressor/distortion/fuzz effect) and patch with newest changes. Old versions are removed, as this new version is like totally better than the older one.