RE: problems converting a score back to midi

[email protected] (Dave Turner) Mon, 18 Aug 2003 20:54:22 +0000
Newsgroups perl.midi
Message-ID <a05100301bb66e8770343@[81.174.193.34]>
The suggestion from Noel Lairson to use synch() worked.
I can now make chords.

But, I could not get the version using anonymous subroutines to work 
until I put in what I believe to be missing semi-colons after the 
closing curly brackets  };  and then defining them first.
There might be something funny caused by me using MacPerl under 
OS9.2.2 of course, but I do have a way forward now!

Dave Turner


This works
#!perl
# an attempt to use anonymous subroutines
  use warnings;
# use strict;

  &$subref;
  my $subref = sub { print "Hello anonymous subroutine "; };

exit;

This doesn't
#!perl
# an attempt to use anonymous subroutines
  use warnings;
# use strict;

  my $subref = sub { print "Hello anonymous subroutine "; };
  &$subref;

exit;

And For Completeness:-
#!perl
# an attempt to use anonymous subroutines
  use warnings;
  use strict;
  use MIDI::Simple;
  new_score;
no strict 'subs';

   text_event 'User:Dave\'s Data:MacPerl Scripts:scratch:midiperl01 at 
Sun Aug  3 21:47:43 2003';
   text_event 'http://www.ely.anglican.org/parishes/camgsm/chimes.html';
   text_event 'Lord through this hour/ be Thou our guide';
   text_event 'so, by Thy power/ no foot shall slide';
   set_tempo 500000;
   patch_change 1, 1;

   noop c1, f, o2;  # Setup

  my $one = sub { n V64, c1, d192, n37; };

  my $two = sub { n V96, c1, d192, n65; };


   n V96, c1, d96,  n37; #   0
   n V96, c1, d96,  n41; #  96
   n V96, c1, d96,  n39; # 192
  synch(\&three, \&four);   # 288
#  n V96, c1, d192, n32, V64, c1, d96, n62; # 288
   n V96, c1, d96,  n37; # 480
   n V96, c1, d96,  n39; # 576
   n V96, c1, d96,  n41; # 672
   n V96, c1, d192, n37; # 768
   n V96, c1, d96,  n41; # 960
   n V96, c1, d96,  n37; #1056
   n V96, c1, d96,  n39; #1152
   n V96, c1, d192, n32; #1248
   n V96, c1, d96,  n32; #1440
   n V96, c1, d96,  n39; #1536
   n V96, c1, d96,  n41; #1632

   synch(\&$one, \&$two);  #1728
#  synch(\&one, \&two);  #1728
#  n V96, c1, d192, n37, V64, c1, d192, n65; #1728


  write_score 'Z_westminster_chimes2a.mid';

  sub three {
    n V64, c1, d192, n32;
  }

  sub four {
    n V96, c1, d96, n62;
  }


  exit;