Skip to content

01 Getting Started

Gene Boggs edited this page Feb 2, 2021 · 31 revisions

First things first

This tutorial assumes that you have Perl installed, and that you know how to use it to run programs. Also, it assumes that if you want to go further, that you will read the documentation for the modules referred to in these pages. Conveniently, the ones used in the examples are all in a cpanfile for easy installation.

Basic installation commands:

git clone https://github.com/ology/MIDI-Perl-HOWTO.git
cd MIDI-Perl-HOWTO
cpanm --installdeps .

MIDI-Perl

The modules in these pages depend upon MIDI and MIDI::Simple. Reading through those documents can be both helpful and possibly give you a headache. ;)

Terminology

MIDI is full of domain specific vocabulary. And MIDI-Perl is full of its own! For instance: channel, track, event, note, duration, control change, etc. A "Track" is a thing in MIDI-Perl, but we will use the term generically to refer to a sequence of notes added to the score on a specific channel. An "Event" is a granular aspect of the score, with which we will not concern ourselves. "Note" is a sort of tricky term. It is used both to refer to the pitch and duration. For us, these two things are considered separately. A "control change" is a message you give to the score to set things like reverb or chorus.

We will be concerned with musical creation not analysis. So loading a MIDI file and considering its contents will also not be on the agenda.

Code essentials

First, make sure things work...

Example 1

Handy debugging

Example 2

Use a MIDI module and create a score object

Example 3

Add notes and rests to the score, and write it to a MIDI file

Example 4

Clone this wiki locally