6.2.11. MIDI Tutorial #2 – MIDI Tremolo V2

../../../_images/midi2.png

Fig. 6.48 MIDI controlled tremolo effect, upgraded from previous tutorial

The above algorithm is an expansion upon the algorithm explored in MIDI Tutorial #1. The amount of amplitude modulation is now dependent on MIDI key pressure, instead of being manually controlled by a knob. This is achieved using the “velocity” control output from the midinote module to target the “modamt” control input of ampmod.

Download the sigfile here: MIDI Tremolo V2.

6.2.11.1. MIDI Velocity Monitoring

The previous MIDI tutorial explored creating a MIDI monitor menu to display data associated with incoming MIDI messages. This tutorial utilizes velocity, or how hard a key/pad is pressed on a MIDI controller, to control tremolo depth. Let’s add velocity to our MIDI monitor.

../../../_images/midimonitor2.png

Fig. 6.49 VSIG module structure used to display MIDI data to users

Velocity does not require any control operations to be performed on it to be properly displayed to users. Midinote outputs velocity in a range of 0 to 1, 0 representing minimum key pressure and 1 representing maximum key pressure.

6.2.11.2. Controlling Tremolo Depth with Velocity

Now that we can view velocity in real time, the next step is to target ampmod’s “modamt” control input with the incoming velocity value. The “modamt” parameter, however, accepts values from –10 to 10, whereas velocity only goes up to 1. We can remedy this by scaling velocity before routing it to ampmod.

../../../_images/scalers2.png

Fig. 6.50 Scaling operations performed on velocity of incoming MIDI note

Pictured above, the c_multiply module labeled “depthscale” multiplies the incoming velocity value by 10, after which it is sent to ampmod’s “modamt” input. The second c_multiply module labeled “scaletoprcnt” multiplies the output of “depthscale” by 10 once more, but this value is only sent to a monitor. This is done so that depth may be viewed by users as a percentage, as opposed to an arbitrary value between 0 and 10.

../../../_images/emotemidi2.png

Fig. 6.51 Menus displayed in Emote showing incoming MIDI data and tremolo parameters based off of MIDI data. Notice the relationship between “Velocity” and “Depth,” as well as “Frequency” and “Rate.”

The output after these scaling operations is shown above. Notice how the displayed depth value is simply the velocity value multiplied by 100, and how the displayed rate value is the frequency value divided by 100.

Upon exporting to Emote, the menu pictured in the above section will be displayed to the user. While the algorithm features no controls in the UI, both tremolo rate and depth are entirely controllable via an external MIDI controller. Rate depends on the pitch of an incoming MIDI signal, while depth depends on velocity.