I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2007-05-11 12:55:05-07 by cnoocy
MIDI::Simple and multiple channels
Greetings!
I'm using MIDI::Simple to generate some algorithm-based music and I'm starting to have a need for multiple channels. As I understand the platform, I need to create the MIDI::Simple objects, get their interior Score objects, convert those into sequences of events, and add those events to a new MIDI::Track within a MIDI::Opus. Am I missing something? Is there a Simple-like interface that I can use for multiple channels?
Thank you.
Direct Responses: 5123 | Write a response
Posted on 2007-05-12 11:58:29-07 by cnoocy in response to 5114
Re: MIDI::Simple and multiple channels
To answer my own question, I used the steps I described above, but they were not as tedious as I feared they might be. Here is my code:
my $opus = MIDI::Opus->new(); my @tracks; foreach my $simple (@simples){ my $track = MIDI::Track->new(); my $events_r = MIDI::Score::score_r_to_events_r($simple->Score_r); $track->events_r($events_r); push (@tracks, $track); } $opus->tracks(@tracks); $opus->write_to_file($filename);
which is pretty straightforward.
Direct Responses: Write a response