From the original SynthMaker forum (2004–2014), with its members’ names and dates.
JIftw ·
EDIT SEE POSTS BELOW FOR LATEST WORKING VERSION
Hi all,
Here is my code for a sustain pedal.
You may ignore everything related to Current Voices and Max Voices, I am still working on that part...
For some reason I don't yet understand, the volume of the notes that were held increases upon releasing the pedal, almost as if they are being retriggered. Any idea why ?
Also, I'm slightly confused as my current MIDI keyboard + MIDI pedal combo retains NoteOff messages by itself, making my code useless. Is this the standard spec ? Do all MIDI keyboards behave like so ? (I should then simply remove my code)
Thanks !
trogluddite ·
My netbook screen is too tiny to see all of the logic - but there may be a problem with the '128' and '144' comparisons.
The integer outputs from the MIDI splitter send triggers as well as the integer values, so you shouldn't need the extra connections from the splitter's trigger outputs as well - you will be getting twice as many triggers as you need.
Also, I think the buffer is there only to store note-offs? So status 128 is cool, that is a note off, but status 144 is only a note off if the velocity (D2) is also zero - otherwise you may be buffering note on's as well. That would give you a doubled note when the buffer is flushed.
May be worth checking the trigger order too - the little 'tick marks' on the links next to the connectors tell you what priority the links have - no ticks=executed first, one tick=2nd priority etc. etc. There is a chance that the MIDI Event primitive is receiving data before the logic and multiplex have done their work. You can change the priority by re-making the links in the order that you want the priority to be.
Hope that makes sense... it's a bit past my bedtime. 😉
JIftw ·
For the 128 and 144 comparisons, I used
greater or equal to 128
and strickly inferior to 144
to obtain all note-offs for status codes between 128 and 143 inclusively (channel 1 to 16). Unless I am mistaken, it should therefore not have been buffering note-ons as well.
Thanks for the advice on the trigger order, and also that I don't need to send triggers to integer changes. I have cleaned up the code quite a bit.
For some reason I don't yet understand, the volume of the notes that were held increases upon releasing the pedal, almost as if they are being retriggered.
After further testing on this cleaned-up version, it seems the problem only happens if voices were stolen. Let's say I set max voices to 6. While holding the pedal, I play 6 low notes followed by a few higher notes to steal voices. Upon releasing the pedal, the volume of those low notes has increased.
Interestingly, setting the "Hold stolen notes for returning later" parameter in the MIDI2Voices module to false prevents the problem from occuring, but I cannot consider using this as a permanent workaround. (I need this function for other sounds) (and setting it to false while the pedal is pressed then returning it to true after pedal release would be such an ugly hack ! 😕)
Thanks again
EDIT: I finally implemented the 'ugly hack', which turned out to be real simple, and not so ugly considering that it made no sense for the two conditions to occur simultaneously (pressing the pedal for sustain (piano behaviour) and expecting stolen voices to return once voices are freed. (non-piano, synth behaviour))
trogluddite ·
Glad it worked out 🙂 Sounds like the problem was just inherent in the MIDI to Poly voice management (don't really do synths myself, so I couldn't say for sure - I know it has caused other users to curse at times, though).
Only 16 posts and you are already using 'ugly hacks' - you obviously have the natural talent to be a SynthMaker user 😉 LOL
Personally, I kind of quite like the way SM forces the use of 'ugly hacks'/'workarounds'/'tricks' - if OutSim finally got green timing/MIDI Process/Voice Management fixed, I'd probably get a bit bored with SM and have to go and actually make some music for a change! 😈
P.S.Like the way you documented the osm so folks know how to use it.
AngularMomentum ·
Also, I'm slightly confused as my current MIDI keyboard + MIDI pedal combo retains NoteOff messages by itself, making my code useless. Is this the standard spec ? Do all MIDI keyboards behave like so ? (I should then simply remove my code)
Yeah, I was wanting to test and then figured my synths and MIDI controller already have this. 🙂 Still neat though!
Wrote something here? To have a post removed or your name hidden, write to [email protected].