Santa's Secret Music Studio
Santa's Secret Studio
Privately, Santa was a musician. He practiced his scales and arpeggios diligently any time he could find a spare minute. Although who his teacher is or was remains a mystery.
In Santa's little music studio next to the Workshop, he had some guitars, an old Fender Jazz bass, a modern Arturia MIDI controller keyboard, a few classic synths, and even a bit of modular eurorack gear, too.
Over the years, he has given many, many a present to the likes of Keith Emerson, Rick Wakeman, and Trent Reznor even.
Anyway, he was fine with playing his individual instruments, by themselves, for a long time. He is old fashioned, you know. But he decided to hook his devices together with MIDI ("Musical Instrument Digital Interface") and play them with his superior Arturia (a Christmas present to himself, recently). So he got the necessary cables and connected his synthesizers and computer.
Now with a "digital audio workstation" app ("DAW"), you can orchestrate all your external MIDI instruments and record a masterpiece. But you can also control everything with Perl programs!
North Pole Perlers
Like any programmer worth his or her salt, he and the elves often used the Perl programming language to get things done without much fuss. And since he was also a musician, he wondered how to make musical things easier and fun with code.
It turns out that Santa is a geek at heart and occasionally searches MetaCPAN and checks out the recent uploads. One he found and installed was the idi module. That seemed to fit the bill for many quick and simple things, including playing any synth through MIDI with a controller.
Controlling MIDI
But before he could control anything, he had to know what his MIDI ports were named! In order to find that out, he ran the handy script he found while studying Perl real-time MIDI: list_devices.pl. Here it is:
#!/usr/bin/env perl
use strict;
use warnings;
use MIDI::RtMidi::FFI::Device;
my $midi_in = RtMidiIn->new;
my $midi_out = RtMidiOut->new;
print "Input devices:\n";
$midi_in->print_ports;
print "\n";
print "Output devices:\n";
$midi_out->print_ports;
Running this on his computer said,
> perl list_devices.pl
Input devices:
0: USB MIDI Interface
1: KeyLab mkII 49 MIDI
Output devices:
0: USB MIDI Interface
1: KeyLab mkII 49 MIDI
The "USB MIDI Interface" was currently his microKORG synth, and the "KeyLab mkII 49 MIDI" was his Arturia controller. So by using the idi module on the terminal command line:
> perl -Midi -E "i(@ARGV)" 'KeyLab mkII 49 MIDI' 'USB MIDI Interface'
He was able to control his synth! And what did it sound like?
Not especially Christmas-y at all, but it illustrates that with a single line, you can control a MIDI synthesizer without using a full-blown DAW.
It also implies that you can make a program do ANYTHING YOU WANT with live, real-time MIDI synthesizers. Hmmmmm...
Santa was satisfied and set out to dive deeper after Christmas and study MIDI::RtMidi::FFI::Device and its derivatives: MIDI::RtController, MIDI::RtController::Filter::Tonal, and related control modules next.
Conclusion
Be like Santa and, when you're not busy delivering presents to the children of the world, control your MIDI devices with Perl!