# Cakewalk Sonar 7: Apply Dynamics Control To MIDI Data

OBJECTIVE: Add effects like compression, expansion, and limiting to MIDI data. BACKGROUND: Just as audio compression can help smooth out the dynamics of an audio clip, it’s possible to apply compression and other types of dynamics control to MIDI data. In this example, we’ll show how to compress MIDI data values by a 3:1 ratio.

### STEPS

- Right-click in the FX bin of the MIDI track you want to process, and insert the MIDI Velocity plug-in.
- To compress by a specific ratio, first click on the Scale button, double-click on the numerical, and enter a number that’s the inverse of the compression ratio (e.g., for 4:1 compression, choose 25%; for 3:1 compression, choose 33%).
- Click on the MIDI track to select it, then go to the Process menu and click on Apply MIDI Effects. Make sure “Delete the effects from the track effects bin” is unchecked.
- Now it’s time for the MIDI equivalent of adding “makeup gain.” To find the amount of gain you need to add, do the following math: 127 x (1-(the scale value entered in step two/100)). For example, if you entered a scale value of 33%, the equation is 127 x (1-(33/100)) = 85.
- On the Velocity plug-in, click on the Change button, and add the “makeup gain” number you calculated in Step 4 (in this case, 85). Then, repeat Step 3.
- If you also want to set an upper or lower limit, i.e., have no notes higher or lower than a certain velocity value, click on the Limit button and specify high and/or low velocity limits. This example shows that no note will have a velocity lower than 30. Repeat step 3 to make this change permanent, but this time you can delete the effect as we’re done doing any MIDI processing—and now you have “compressed” data.

### TIPS

- Instead of using a single Velocity plug-in and applying two operations, you could also insert two Velocity plug-ins, set the first to scale velocity values and the second to add “makeup gain,” then apply both of them simultaneously.
- Expansion works in reverse: Instead of dividing then adding a constant, you subtract a constant, then multiply.
- In step 4, you needn’t be too precise, and can round numbers off to the nearest integer.