Skip to content

03 Adjusting parameters

Gene Boggs edited this page Jan 26, 2023 · 24 revisions

Setting channels, patches, and note volume

Use the MIDI::Util set_chan_patch($score, $channel, $patch) function to set the channel and the patch.

To set an individual note volume, add "v$num" as an argument to the $score->n method, where $num is an integer from 0 to 127.

Example 1

Tempo as "beats per minute"

Example 2

MIDI control change messages

These can be used to set a few of the many listed MIDI parameters, like reverb, chorus, and pan. Unfortunately, things like attack (CC#73) do not seem to work, even if you are using General MIDI, Level 2.

my $channel = 0; # 0-15
my $pan = 10;
my $value = 63; # 0-127
$score->control_change($channel, $pan, $value);

And here's how to set the reverb (CC#91 0-127):

my $channel = 0;
my $verb = 91;
my $value = 0; # No reverb
$score->control_change($channel, $verb, $value);

Clone this wiki locally