NAME idi - Easy, command-line MIDI SYNOPSIS perl -Midi -E 'x(qw(c1 f o5)); n([qw(qn Cs)],"F","Ds",[qw(hn Gs_d1)])' | timidity -Od - # or with fluidsynth # Compare with: perl -MMIDI::Simple -E 'new_score; noop qw(c1 f o5); n qw(qn Cs); n "F"; n "Ds"; n qw(hn Gs_d1); write_score shift()' idi.mid timidity -Od idi.mid # Play a drum back-beat: perl -Midi -E 'u(4,["1000000010000000"],["0000100000001000"],["1010101010101010"])' | timidity -Od - # Control a MIDI device (uniquely named "usb") in real-time perl -Midi -E 'i(@ARGV)' keyboard usb DESCRIPTION Easy, command-line MIDI! FUNCTIONS b b(100) Set BPM c c(15) Channel Default: 0 d d(128) Duration Default: 96 e e(0) Play at end Default: 1 g Return the MIDI::Simple score object. i Invoke MIDI::RtController to control the second argument with the first. n n(qw(hn C)) n(qw(hn 60)) n(qw(hn C E G)) n(qw(hn 60 64 67)) n([qw(hn 60 64 67)], [qw(hn 65 69 71)], ...) n(\@note_spec1, \@note_spec2, ...) Add notes as either a list of a single note-spec or a list of array-references of note-specs. Please see the MIDI::Simple documentation for what a "note_spec" is. o o(3) Octave Default: 5 p p($channel, $patch_number) Patch Default: "0, 0" (channel 0, piano) r r($note_duration) Add rest. See the MIDI::Simple documentation for what "note_durations" are valid. t t("$numerator/$denominator") Time signature Default: "none" u u($bars, $kick, $snare, $hihat) u(4, ["1000000010000000"], ["0000100000001000"], ["1010101010101010"]) # extended example: use String::Random (); my $gen = String::Random->new; my $pat = sub { $gen->randregex("[01]{16}") }; u(4, map { [$pat->()] } 1 .. 3); Play a drum pattern à la MIDI::Drummer::Tiny with 16th-note beat resolution. v v(127) Volume Default: 64 w w("filename.mid") Write score to a file. x No-op (with "MIDI::Simple::noop") SEE ALSO The t/01-methods.t file in this distribution Exporter File::Slurper File::Temp MIDI::Drummer::Tiny MIDI::RtController MIDI::Simple Music::Tempo Moo AUTHOR Gene Boggs COPYRIGHT AND LICENSE This software is Copyright (c) 2022-2025 by Gene Boggs. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible)