Problems converting a score back to midi

[email protected] (Dave Turner) Sun, 17 Aug 2003 15:54:10 +0000
Newsgroups perl.midi
Message-ID <a05100303bb654f3d2470@[81.174.192.195]>
I am having problems converting a score file back into a midi file.
After some thought I decided that the best way to do this was to 
convert the score file into a perl script that when run would make 
the midi file for me. The easy parts are done!

Most of the code below will look familiar to you, it is part of the 
perl script that makes westiminster_chimes.mid
===========================
   set_tempo 500000;
   patch_change 1, 1;

   noop c1, f, o2;  # Setup

   n V96, c1, d96,  n37; #   0
   n V96, c1, d96,  n41; #  96
   n V96, c1, d96,  n39; # 192
   n V64, c2, d96, n62, V96, c1, d192, n32 ; # 288 this doesn't work
  # n V96, c1, d192, n32, V64, c1, d96, n62; # 288 this doesn't work
  # n V96, c1, d192, n32, V64, c1, n62; # 288
  # n rest;
  # n V0, c1, d96, n62; # 384 this doesn't work
  # 288 n V64, c1, d96,  n62;  # 288
   n V96, c1, d96,  n37; # 480
   n V96, c1, d96,  n39; # 576

   n V96, c1, d192, n37, V64, c1, d192, n65; #1728 this works

============================
I cannot get the following actions to work:-
1) two notes starting at the same time but with different durations.
  They both end up with the same duration.
  The last duration in the list is the one used.

2) two notes on different channels with the same start time and same durations.
  They both stay on channel 1.

I decided against using the n qn, Cs2; n F; notation because when the 
score is produced the notes are there as numbers and that suits me 
fine. However, if that is the only way to make the above work, then I 
will.

Dave Turner


A bit more detail on the problem for you.
The score below was produced by opening westminster_chimes.mid in a 
sequencer program, adding the extra two notes, and then using midi 
score.
Given the score below, how would you turn it back into a midi file?

@notes = (   # 24 notes...
  ['text_event', 0, 'User:Dave\'s Data:MacPerl 
Scripts:scratch:midiperl01 at Sun Aug  3 21:47:43 2003'],
  ['text_event', 0, 'http://www.ely.anglican.org/parishes/camgsm/chimes.html'],
  ['text_event', 0, 'Lord through this hour/ be Thou our guide'],
  ['text_event', 0, 'so, by Thy power/ no foot shall slide'],
  ['set_tempo', 0, 500000],
  ['patch_change', 0, 1, 8],
  ['note', 0, 96, 1, 37, 96],
  ['note', 96, 96, 1, 41, 96],
  ['note', 192, 96, 1, 39, 96],
  ['note', 288, 192, 1, 32, 96], # two notes, same time, same channel,
  ['note', 288, 96, 1, 62, 64],  # different duration, different volume
  ['note', 480, 96, 1, 37, 96],
  ['note', 576, 96, 1, 39, 96],
  ['note', 672, 96, 1, 41, 96],
  ['note', 768, 192, 1, 37, 96],
  ['note', 960, 96, 1, 41, 96],
  ['note', 1056, 96, 1, 37, 96],
  ['note', 1152, 96, 1, 39, 96],
  ['note', 1248, 192, 1, 32, 96],
  ['note', 1440, 96, 1, 32, 96],
  ['note', 1536, 96, 1, 39, 96],
  ['note', 1632, 96, 1, 41, 96],
  ['note', 1728, 192, 1, 37, 96], # two notes, same time, same channel,
  ['note', 1728, 192, 1, 65, 64], # same duration, different volume
);