florian
2006-11-06 15:28:07
Hi, a user requested how the following conversion can be done with Midi Translator:
Explanation:
ga is a variable with the current fade value. "gb" is a variable with the value by how much ga should be increased/decreased every 50 milliseconds.
Now when you press down the key on the keyboard, the first Translator is triggered, setting gb to 1 (i.e. the control value ga is increased by 1 every 50 millis), and the timer is started, which will trigger the timer called "Fade" every 50 milliseconds.
Now every 50 milliseconds, the 3rd translator is triggered. It will increase the ga variable by gb (meaning by 1 in the example) and send out a controller MIDI message with ga as value (in the example, chanel volume message 0x07 is sent). The rules prevent this message to be sent when the ga variable is too high (128) or too low (-1).
The last Translator stops the timer when the ga variable has reached its maximum or minimum.
You can make the fade faster (slower) by decreasing (increasing) the repeat time of 50 milliseconds, and/or by increasing the step size of gb (e.g. 2 and +2).
Florian
This is easily possible with Midi Translator Pro: use timers to do the fade in and fade out:When I press down a key on my keyboard, I want the notes on that channel to slowly fade in. When I release the note, all notes are slowly faded out. Is that possible?
Code: Select all
Translator 1: Note On / set timer to increase controller
Incoming: 90 pp qq
Rules:
IF qq=0 THEN exit Rules, skip Outgoing Action
gb = 1
Outgoing: Start Timer "Fader", infinite repeat
initial delay: 0, repeat delay: 50 milliseconds
Translator 2: Note Off / set timer to decrease controller
Incoming: 90 pp 00
Rules:
gb = -1
Outgoing: Start Timer "Fader", infinite repeat
initial delay: 0, repeat delay: 50 milliseconds
Translator 3: Do the fade
General: Stop Processing: unchecked
Incoming: Timer "Fader"
Rules:
ga = ga + gb
IF ga<=-1 THEN exit Rules, skip Outgoing Action
IF ga>=128 THEN exit Rules, skip Outgoing Action
Outgoing: MIDI B0 07 ga
Translator 4: Stop fade
Incoming: Timer "Fader"
Rules:
IF ga<=-1 THEN exit Rules, execute Outgoing Action
IF ga>=128 THEN exit Rules, execute Outgoing Action
exit Rules, skip Translator
Outgoing: Stop Timer "Fader"
ga is a variable with the current fade value. "gb" is a variable with the value by how much ga should be increased/decreased every 50 milliseconds.
Now when you press down the key on the keyboard, the first Translator is triggered, setting gb to 1 (i.e. the control value ga is increased by 1 every 50 millis), and the timer is started, which will trigger the timer called "Fade" every 50 milliseconds.
Now every 50 milliseconds, the 3rd translator is triggered. It will increase the ga variable by gb (meaning by 1 in the example) and send out a controller MIDI message with ga as value (in the example, chanel volume message 0x07 is sent). The rules prevent this message to be sent when the ga variable is too high (128) or too low (-1).
The last Translator stops the timer when the ga variable has reached its maximum or minimum.
You can make the fade faster (slower) by decreasing (increasing) the repeat time of 50 milliseconds, and/or by increasing the step size of gb (e.g. 2 and +2).
Florian