Skip to content
Snippets Groups Projects
pae2xml.pl 24.42 KiB
#!/usr/bin/perl


# Copyright (C) 2003 Rainer Typke
# Copyright (C) 2010 Reinhold Kainhofer <reinhold@kainhofer.com>
#pae2xml is licensed under the terms of the GNU General Public License Version
#2 as published by the <a href="http://www.fsf.org/" target="_top">Free Software Foundation</a>.
#This gives you legal permission to copy, distribute and/or modify <em>pae2xml</em> under
#certain conditions. Read
#the <a href="http://www.gnu.org/copyleft/gpl.html" target="_top">online version of the license</a>
#for more details. pae2xml is provided AS IS with NO WARRANTY OF ANY KIND,
#INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.

our $script = "pae2xml.pl";
our $version = "1.0";

### Handle command-line options

# import module
use Getopt::Long;
use File::Basename;

our $format = 'rism';

sub print_help {
  print 'pae2xml.pl [OPTIONS...] FILE

  Converts the Plaine & Easie file FILE to MusicXML. If FILE is -, STDIN is used.

  Possible options:
    -h, --help          Prints out this help message
    --format=FORMAT, -f FORMAT
                        Interprets input file as FORMAT. Possible values are
                           rism, pae (default: rism)
    -v, -- version      Prints out version information
';
}
sub print_version {
  print "$script $version
  Copyright (C) 2003 Rainer Typke
  Copyright (C) 2010 Reinhold Kainhofer <reinhold\@kainhofer.com>
";
}
sub handle_options {
  my $print_help = 0;
  my $print_version = 0;
  my $result = GetOptions ("f|format=s" => \$format, "help|h" => \$print_help, "version|v" => \$print_version);
  if ($print_version) {
    print_version ();
    exit 0;
  }
  if ($print_help || (@ARGV == 0)) {
    print_help ();
    exit 0;
  }
}
handle_options ();



$divisions = 960;
$old_duration = $divisions;
$old_type = "";
$old_octave = 4;
$BEAM = 0;
@rhythmic_model = ();
$rhythmic_model_index = 0;

# Store all alterations already used in the current measure, so that e.g.
# xCC also detects the second note as a Cis! Needs to be reset at the