makechart6.pl.txt

binmode STDIN;

print << "HEADER";

<HTML>

<HEAD><TITLE>SC-88 Pro tone names list</TITLE></HEAD>

<BODY>

<H3>SC-88 Pro tone names list</H3>

HEADER

@model = ("","Pro","88","55");

@variation = ("Piano","Chromatic Percussion","Organ",

"Guitar","Bass","Strings/Orchestra",

"Ensemble","Brass","Lead","Pipe",

"Synth Lead","Synth Pipe","Synth SFX",

"Ethnic","Percussive","SFX" );

undef $/;

$buf = <>;

$pmax = length($buf);

for ($p = 0; $p < $pmax; $p += 16) {

($cc0_,$map_,$pc_,$name_) = unpack("CCCxA12",substr($buf,$p,16));

if ($map_ == 3) {

$map_ = 1;

} elsif ($map_ == 1) {

$map_ = 3;

}

$k_ = substr("00".$pc_, -3, 3) .

substr("00".$cc0_, -3, 3) .

substr("00".$map_, -3, 3);

$pc{$k_} = $pc_;

$cc0{$k_} = $cc0_;

$map{$k_} = $map_;

$name{$k_} = $name_;

push(@ky, $k_);

}

@ky = sort {$a <=> $b} @ky;

print "<TABLE BORDER=\"1\"><CAPTION>Capital tone list</CAPTION>\n";

foreach (@ky) {

if ($cc0{$_} == 0 && $map{$_} == 1) {

if ($pc{$_} % 8 == 0 && $cc0{$_} == 0 && $map{$_} == 1) {

$v = $pc{$_} / 8;

if ($pc{$_} > 0) {

print "</TR>\n";

}

print "<TR><TH ROWSPAN=\"2\"><FONT SIZE=\"-1\">$variation[$v]</FONT></TH>";

}

$pc = $pc{$_} + 1;

print "<TD><FONT SIZE=\"-1\"><A HREF=\"#$_\">$pc: $name{$_}</A></FONT></TD>";

if ($pc{$_} % 8 == 3 && $cc0{$_} == 0 && $map{$_} == 1) {

print "</TR>\n";

if ($pc{$_} < 127) {

print "<TR>";

}

}

}

}

print "</TABLE>\n<HR>\n";

$tablehead = "<TABLE BORDER=\"1\">\n

<TR><TH>PC</TH><TH>CC0</TH><TH>88Pro map</TH>

<TH>CC0</TH><TH>88 map</TH>

<TH>CC0</TH><TH>55 map</TH></TR>\n";

$tmpstr = "";

$pcs = 1;

print "<H4>$variation[0]</H4>\n$tablehead";

foreach (@ky) {

$pc = $pc{$_} + 1;

$cc0 = $cc0{$_};

$map = $model[$map{$_}];

if ($pc != $pc_) {

if ($pc != 1) {

printf "<TR>\n<TH ROWSPAN=\"%d\">[%s] %s</TH>\n%s</TR>\n",$pcs,$pc-1,$lastname,$tmpstr;

$tmpstr = "";

$pcs = 1;

if (($pc - 1) % 8 == 0) {

print "</TABLE>\n";

printf "<HR>\n<H4>%s</H4>\n$tablehead",$variation[($pc-1)/8];

}

}

} elsif ($cc0 != $cc0_) {

if ($cc0 < 126) {

$tmpstr .= "</TR>\n<TR>\n";

$pcs++;

}

}

if ($cc0 < 126) {

if ($cc0 == 0) {

$tmpstr .= "<TD ALIGN=\"RIGHT\"><STRONG>$cc0</STRONG></TD><TD><STRONG><A NAME=\"$_\">$name{$_}</A></STRONG></TD>\n";

if ($map eq "Pro") {

$lastname = $name{$_};

}

} else {

$tmpstr .= "<TD ALIGN=\"RIGHT\">$cc0</TD><TD><A NAME=\"$_\">$name{$_}</A></TD>\n";

}

}

$pc_ = $pc;

$cc0_ = $cc0;

$map_ = $map;

}

printf "<TR>\n<TH ROWSPAN=\"%d\">[%s] %s</TH>%s</TR>\n</TABLE>",$pcs,$pc-1,$lastname,$tmpstr;

print << "FOOTER";

</BODY>

</HTML>

FOOTER