SCORE in Linux/X-Windows using Dosemu
Contents
Versions of SCORE compiled for MS-DOS can be run in X-windows (typically on unix or linux computers, but possibly OS X as well) with DOS emulators. This page describes how to run SCORE 4 with dosemu using freedos.
Getting started
Installing and setting up dosemu
Dosemu is one of the DOS/Windows emulators in which SCORE can run. First you will have to install dosemu for your particular operating system and configuration. In Gentoo this is easy to do (as root):
emerge dosemu
On other linux systems, you can try "yum install dosemu", "rpm -Uvh dosemu" or "apt-get install dosemu", or download and compile the source code manually from the dosemu website. Freedos was installed at the same time as dosemu when "emerge dosemu" was run, but you may also need to install that before running dosemu, particularly if you are installing manually.
Once dosemu is installed, type:
dosemu
This will intialize various files in ~/.dosemu which are needed to run dosemu. Dosemu can be run from a non-X terminal or from X-windows in this setup process. To run SCORE for DOS interactively, you will need to run in X-windows for viewing graphical screens, but for the setup process, X-windows is not necessary. Hopefully you will not get any errors... Here is a screenshot of the dosemu terminal which should appear with a C:\> prompt:
To exit from dosemu, type:
exitemu
You should now have a directory called .dosemu in your home directory. Within this directory is a subdirectory called "drive_c". This directory contains files which dosemu calls the C drive when you are running dosemu. Install the SCORE program in this subdirectory. If you have SCORE installed on the C: drive in DOS/Windows, then you should not need to change the SCORE preference file (SCOR4\LIB\PREF-4.SCR).
Disk drives
- The C: drive maps to this subdirectory within your homedirectory: ~/.dosemu/drive_c.
- The D: drive maps to your unix home directory. This allows unix/dos file interactions within DOSemu but outside of the ~/.dosemu directory. For example, you can process your SCORE files on the D: drive in dosemu which allows you to store them in your unix home directory (or a subdirectory within your home).
Running SCORE in dosemu
To run SCORE in dosemu with linux, you must use X-windows. Most linux systems are running X-windows by default, so this should not be a problem; otherwise, you would type "startx" at the text-only console. In an X-window terminal, you should now type:
dosemu
Alternatively, if you have an X-server running, but are using a non-X terminal, you may need to type:
dosemu -X
Then you can run SCORE as usual in DOS:
cd scor4 scor4.exe
or if you are located in the C:\ root directory:
scor4\scor4.exe
or from any DOS drive:
c:\scor4\scor4.exe
After the SCORE splash-screen you should see something like this:
Now SCORE can be used as usual. Sometimes the mouse cursor does not appear when starting dosemu. Restarting it solves the problem. Here is some example music (PMX 1, PMX2) being edited in SCORE within dosemu:
Useful dosemu commands
exitemu
To exit from dosemu, as mentioned above, type:
exitemu
unix
A useful command within dosemu is unix.com which has the the ability to run unix commands within dosemu. Prefix any unix command with the word "unix" to run the arguments on the operating system which is running dosemu as if they were a command:
unix uname -a Linux hostname 2.6.32-gentoo-r7 #1 SMP Mon Jul 12 05:51:36 PDT 2010 i686 Intel(R) Core(TM)2 Duo CPU E6750 @ 2.66GHz GenuineIntel GNU/Linux
Useful dosemu options
For lists of all options, try these two man pages:
man dosemu man dosemu.bin
-input option
The -input option can be used to pre-type characters into DOS when dosemu is first called. For example, the following unix command will start dosemu and then start SCORE 4 in a single step:
dosemu -quiet -input "\\P1;c:\\\\scor4\\\\scor4.exe\\r\\r"
Deconstruction of the input string:
- \\P1; == set the keypress rate to 1/100th of a second. This will type the characters in the input string as fast as possible into dosemu.
- c:\\\\score4\\\\score4.exe == this is full DOS path name of the score4 program. Four backslash characters are needed to generate a single backslach in the path name. The unix terminal first converts "\\" pairs into single backslashes. Then the dosemu will take "\\" pairs and generate a single backslash which is finally sent to DOS as a keypress. So the final command typed into DOS with this string is:
c:\scor4\scor4.exe
- \\r == this is the enter key in DOS. The second "\\r" in the input string is used to skip the SCORE editor without pausing at the splash screen.
This command can be used more conveniently in a shell script, or as an alias. To use as an alias in the bash shell, you can type or permanently add this line to ~/.bashrc
alias scor4="dosemu -quiet -input '\\P1;c:\\\\scor4\\\\scor4.exe\\r\\r'"
Log out and in again or type this command to activate the alias within the ~/.bashrc file:
. ~/.bashrc
Then you can type:
scor4
in an X-windows terminal which will start dosemu and open the scor4.exe program in a single step.
The -quiet option is used in this case to prevent dosemu from asking for a keypress to continue (which will happen in certain circumstance and option configurations).
-t option
Dosemu will start up in X-windows mode by default if an X-windows server connection can be found. Use the -t option to force it to open in terminal mode. This is useful for batch-processing with SCORE, since the graphics screens can be avoided which will speed up file processing.
-dumb option
To run a single DOS command, the -dumb option will suppress startup text until the provided command has been started, and then exit after the command has finished. For example, to display a list of files in the default startup directory (the C:\ drive), type this command in a unix terminal:
dosemu -dumb dir
The -dumb option only opens a terminal (like the -t option), so this option is not useful for interactive use of SCORE.
The -dumb option allows standard output processing of the output from dosemu, such as this command to scroll through a long list of files:
dosemu -dumb dir | less
or
dosemu -dumb dir > listing.txt
to save a list of the files in a file called listing.txt.
-s option
The -s option is used to access the hardware (video, keyboard, mouse) directly. This might give the most realistic emulation of DOS for SCORE (but untested).
Dosemu configuration
The dosemu configuration file is found in /etc/dosemu/dosemu.conf. Useful settings are given below.
Keyboard layout
By default the keyboard layout variable is set to "auto". This may cause problems if you are running dosemu without X-windows. In this case, dosemu asks you to press ↵ Enter so that it can identify the type of keyboard. This feature is not useful for batch processing in dosemu. This need to press ↵ Enter can be removed by setting the $_layout variable in the configuration file, such as a US keyboard layout:
$_layout = "us";
Process priority
The priority level of the dosemu process. By default the priority is set to be the nicest at 1. Increasing this (probably up to 15) will give a higher priority to the dosemu program. Using a priority of 0 will use all computer resources to run dosemu (probably dangerous to do if you are not careful). To set to a mid-level priority add this line to dosemu.conf:
$_hogthreshold = (7)
CPU speed emulation
By default dosemu sets the emulated cpu speed. You can set manually:
$_cpuspeed = (2000)
This seems to speed up the emulation.
Disable CD-ROM drive
To disable use of the CD-ROM drive (or have dosemu search for it when starting), change this line in ~/.dosemu/drive_c/autoexec.bat:
lredir e: linux\fs/media/cdrom c
to
rem lredir e: linux\fs/media/cdrom c
SCORE in batch mode using dosemu
SCORE can be used in an automatic manner with dosemu. In this case the -I option of dosemu can be used to feed keystrokes to SCORE as if you were typing them.
As an example, suppose that you have a file called mytest.pmx which contains ASCII data for a page of music:
8. 1.0 .000 .00 .00 .00 3. 1.0 1.500 17. 1.0 9.500 .00 1.00 1. 1.0 14.300 1.00 10.00 .00 1.0000 1. 1.0 29.275 2.00 10.00 .00 1.0000 1. 1.0 44.250 3.00 10.00 .00 1.0000 1. 1.0 59.225 4.00 10.00 .00 1.0000 14. 1.0 74.200 1.00 1. 1.0 77.700 5.00 10.00 .00 1.0000 1. 1.0 92.675 6.00 10.00 .00 1.0000 1. 1.0 107.650 7.00 20.00 .00 1.0000 1. 1.0 122.625 8.00 20.00 .00 1.0000 14. 1.0 137.600 1.00 1. 1.0 141.100 9.00 20.00 .00 1.0000 1. 1.0 156.075 10.00 20.00 .00 1.0000 1. 1.0 171.050 11.00 20.00 .00 1.0000 1. 1.0 186.025 12.00 20.00 .00 1.0000 14. 1.0 200.000 1.00 2.00
To create an Encapsulated-PostScript file of this music, you can type this command in the unix terminal (run from the ~/.dosemu/drive_c directory (or any subdirectory within) and assuming mytext.pmx is in the same subdirectory):
LANG=utf-8 dosemu -input "\P1;c:\\scor4\\scor4.exe\r\rre mytest.pmx\rprint\r1 mytest.eps\ry\rg\rexit\ry\rexitemu\r"
The "LANG=utf-8" may not be necessary, but is used in this case to prevent an error/warning about the character encoding being undefined. The -I option is used to configure dosemu. In this case the -I option is used to pass keystrokes to dosemu. The special characters used in the keystroke string:
\r = carriage return \\ = backspace \P1; = feed 100 characters per second to dosemu. \P20; would feed 5 characters per second (useful for debugging)
Other useful control characters:
\F10; = press the F10 key. \p15; = wait 150 milliseconds before typing next key. \^[ = escape character
The above keystroke string contains the text script necessary to print mytest.pmx into the file mytest.eps:
c:\score\scor4.exe # start SCORE <enter> # skip the splash screen re mytest.pmx # read the macro text print # go to the print menu 1 mytest.eps # save output to mytest.eps y # overwrite mytest.eps (if it exists) g # start printing to file exit # exit from SCORE y # exit without saving any changes exitemu # exit dosemu
You can adjust the script as necessary, adding any special characters such as \r for the enter key.
The final result is a file called mytest.eps.
For more information on the non-interactive modes of dosemu see: http://www.dosemu.org/docs/HOWTO/x304.html#AEN309
Converting SCORE EPS into PDF, PNG or SVG files
EPS to PDF
The Encapsulated PostScript files generated by SCORE can be converted to a pdf file with the command-line program ps2pdf (if it is installed):
ps2pdf mytest.eps
which will automatically create mytest.pdf. Or used in a pipeline:
cat mytest.eps | ps2pdf - - > mytest.pdf
EPS to PNG
Here is an example of converting the EPS file into a PNG image using ImageMagick's convert program:
cat mytest.eps | pstopnm -dpi=300 | convert - -trim -resize '40%' mytest.png
which results in this image:
EPS to SVG
To generate an SVG graphic from EPS, the EPS file should be processed in two steps. The first step is optional if the EPS file does not contain text:
gs -q -dNOPAUSE -dBATCH -dSAFER -dNOCACHE -sDEVICE=epswrite \ -sOutputFile=embeddedfonts.eps input.eps
The above GhostScript script will embed fonts into the EPS data file which is written to embeddedfonts.eps. After fonts have been inserted into the EPS file (or there were no fonts to begin with), use this command to create the SVG file:
inkscape `pwd`/embeddedfonts.eps -T -l output.svg --vacuum-defs
which generates this image:
The above image is actually a PNG file, since WikiMedia automatically converts SVG files (vector graphics) into PNG files (bitmap graphics) so that the image can be viewed on any browser. Click on the above image twice to view the raw SVG image in the browser.
The options to inkscape used for this conversion from EPS into SVG:
- `pwd`/file.eps → Inkscape (v0.48) cannot read EPS files unless they are given with absolute path names. Pwd is the unix command which displays the present working directory.
- -l → Set the output type to plain SVG (as opposed to Inkscape SVG).
- --vacuum-defs → remove unnecessary code from SVG data. This is optional.
- -T → convert text characters into outlines. This is needed for portable display of text since necessary fonts may not be available on client browsers. The gs command above must be used first to embed the fonts in the EPS file for this option to work.
The above image is automatically converted into a PNG file in mediawiki (click twice on the image to see the raw SVG image). Here is a raw display of the same SVG graphic directly on this webpage (which will not display on older Internet Explorer versions and has scaling problems in recent IE versions) with a size carefully chosen to minimize anti-aliasing:
If this page is printed to a 600 dpi printer, then the above raw SVG image will be printed at 600 dpi (even though it is displayed on the screen around 100 dpi).
Here is a PERL script which can be used to automatically convert from EPS to SVG files in one step:
#!/usr/bin/perl # Program name: eps2svg # Usage: eps2svg [eps file(s)] # Converts EPS files into SVG files, converting # text into outlines. my $ext; my $base; my $file; my $command1; my $command2; my $tempfile = "1cB246g52f2A3.eps"; foreach $file (@ARGV) { $base = $file; $base =~ s/\.[^.]*//; $ext = $file; $ext =~ s/^$base\.//; next if $ext !~ /[e]ps/i; # first embed fonts in file $command1 = "gs -q -dNOPAUSE -dBATCH -dSAFER -dNOCACHE"; $command1 .= " -sDEVICE=epswrite"; $command1 .= " -sOutputFile=$tempfile"; $command1 .= " $file"; # then convert to SVG $command2 = " inkscape `pwd`/$tempfile -T -l $base.svg --vacuum-defs"; print "Processing $file...\n"; `$command1`; `$command2`; `rm -f $tempfile`; }
Conversion scripts
To run any of the following PERL scripts, save the contents of the program to a file. And then on the command-line type the command:
chmod 0755 program
Where program is the name of the file with the PERL script, and 0755 set the permissions so that anyone can run the program. To run the program, you may have to add "./" (without the quotes) before the command name, such as:
./score2eps *.pmx *.mus
score2eps: Converting MUS or PMX data into EPS files
Here is a short PERL script which converts PMX files or MUS files into EPS files, with multiple PMX/MUS files given as an argument. This automatic method of converting SCORE data into EPS images is not so great because time delays proportional to the amount of data on the page are required (or always use a long delay before starting to print so that music can be drawn on the screen).
#!/usr/bin/perl # Program name: score2eps # Usage: score2eps [.pmx and/or .mus file(s)] # This will create .eps with same base filename as input files. use strict; my $debug = 0; # run without -t option to see what problem may be my $file; foreach $file (@ARGV) { my $basename = $file; $basename =~ s/\.[^.]*//; my $extension = $file; $extension =~ s/^$basename\.//; if (-r $file) { print "Processing file $file\n"; createEPS($basename, $extension); } } sub createEPS { my ($base, $ext) = @_; my $keystrokes = "\\P3;"; # set keypress speed if ($debug != 0) { $keystrokes = "\\P20;"; # slow down keystrokes for debugging $keystrokes .= "\\r"; # detect keyboard type in -t mode } # Run the SCORE program: $keystrokes .= "c:\\\\\\\\scor4\\\\\\\\scor4.exe\\r"; # Add extra \r to skip the splash screen: $keystrokes .= "\\r"; if ($ext =~ /mus/i) { $keystrokes .= "g"; # Get binary data (.mus files) } else { $keystrokes .= "re"; # REad ASCII data (.pmx files) } $keystrokes .= " $base.$ext\\r"; # the file to read # longer pauses needed for larger input files... if ($debug == 0) { $keystrokes .= "\\p20;"; # pause 0.2 seconds } else { $keystrokes .= "\\p200;"; # pause 2 seconds } $keystrokes .= "print\\r"; # go to print menu $keystrokes .= "\\p10;"; $keystrokes .= "1 $base.eps\\r"; # set the print output file $keystrokes .= "y\\r"; # answer yes to possible overwrite question $keystrokes .= "\\F6;"; # print the file data # Longer pauses needed for larger input files... if ($debug == 0) { # About 1 second / 800 objects is needed. $keystrokes .= "\\p100;"; # pause 1 second } else { # About 1 second / 80 objects is needed. $keystrokes .= "\\p1000;"; # pause 10 seconds } $keystrokes .= "exit\\r"; # exit from SCORE $keystrokes .= "y\\r"; # don't save data file $keystrokes .= "exitemu\\r"; # exit from dosemu if (-r "$base.$ext") { my $command = "LANG=none dosemu -quiet"; if ($debug == 0) { $command .= " -t"; } $command .= " -input \"$keystrokes\""; if ($debug == 0) { $command .= " >& /dev/null"; } `$command`; # run the command } }
Here is example PMX data which was converted to EPS with the above script, and then converted to SVG using these two steps:
gs -q -dNOPAUSE -dBATCH -dSAFER -dNOCACHE \ -sDEVICE=epswrite -sOutputFile=withfonts.eps input.eps
The above gs (GhostScript) command embeds the fonts used in the input.eps file into the file withfonts.eps. The withfonts.eps file can be converted to the final output.svg image with this command:
inkscape `pwd`/withfonts.eps -T -l output.svg
Here is the final SVG image (rendered automatically by mediawiki into a PNG file, so click twice on the image below to see the raw SVG file displayed in the browser):
Compare the above rendering as a PNG image to a direct display of the SVG image below (not viewable on older versions of Internet Explorer, and does not scale well on recent IE versions). The difference will be more noticeable if this page is printed.
mus2eps: Faster script for converting MUS into EPS files
The previous script prints directly in SCOR4 which allows the flexibility of automating any commands. However, pauses in the keystroke typing rate is necessary to accommodate switching between the graphics and text screens. The following script uses the SCORLAS4 program. This special-purpose program only prints binary SCORE data files (which end with .mus).
An advantage of printing by this method is that it can be done faster, since the keystrokes do not need to be buffered in any way because no graphics need to be displayed, and the video mode remains text. A disadvantage is that it only prints binary SCORE data files. So ASCII numeric data with possible macro instructions cannot be printed with this method.
#!/usr/bin/perl # Program name: mus2eps # Usage: mus2eps [.mus file(s)] # This will create .eps with same base filename as input files. use strict; my $debug = 0; my $file; foreach $file (@ARGV) { my $basename = $file; $basename =~ s/\.[^.]*//; my $extension = $file; $extension =~ s/^$basename\.//; if ((-r $file) && ($extension =~ /mus/i)) { print "Processing file $file\n"; createEPS($basename, $extension); } } sub createEPS { my ($base, $ext) = @_; my $keystrokes = "\\P1;"; # set keypress speed # run the SCORLAS4 program: $keystrokes .= "c:\\\\scor4\\\\scorlas4.exe\\r"; $keystrokes .= "1\\r"; # 1 = print file $keystrokes .= "\\r"; # print single page $keystrokes .= "$base.$ext 1\\r"; # input filename and count $keystrokes .= "\\r"; # continue $keystrokes .= "1 $base.eps\\r"; # set the print output file $keystrokes .= "y\\r"; # answer yes to possible overwrite question $keystrokes .= "\\F6;"; # print the file if ($debug == 0) { $keystrokes .= "\\p50;"; # pause a little for printing to finish } else { $keystrokes .= "\\p200;"; # pause a little for printing to finish } $keystrokes .= "n\\r"; # don't print another page $keystrokes .= "exitemu\\r"; # exit from dosemu if (-r "$base.$ext") { my $command = "LANG=none dosemu"; if ($debug == 0) { $command .= " -t"; } $command .= " -quiet -input '$keystrokes'"; if ($debug == 0) { $command .= " >& /dev/null"; } `$command`; } }
pmx2mus: Converting PMX into MUS files
The following script will convert ASCII notation data into binary data. Binary data can be printed with SCORLAS4.exe. ASCII data can contain plain numeric data, or macro commands.
#!/usr/bin/perl # Program name: pmx2mus # Usage: pmx2mus [.pmx file(s)] # This will create .mus with same base filename as input files. use strict; my $debug = 0; # run without -t option to see what problem may be my $file; foreach $file (@ARGV) { my $basename = $file; $basename =~ s/\.[^.]*//; my $extension = $file; $extension =~ s/^$basename\.//; if ((-r $file) && ($extension !~ /mus/i)) { print "Processing file $file\n"; createMUS($basename, $extension); } } sub createMUS { my ($base, $ext) = @_; my $keystrokes = "\\P3;"; # set keypress speed if ($debug != 0) { $keystrokes = "\\P20;"; # slow down keystrokes for debugging $keystrokes .= "\\r"; # detect keyboard type in -t mode } # Run the SCORE program: $keystrokes .= "c:\\\\\\\\scor4\\\\\\\\scor4.exe\\r"; # Add extra \r to skip the splash screen: $keystrokes .= "\\r"; if ($ext =~ /mus/i) { $keystrokes .= "g"; # Get binary data (.mus files) } else { $keystrokes .= "re"; # REad ASCII data (.pmx files) } $keystrokes .= " $base.$ext\\r"; # the file to read # longer pauses needed for larger input files... if ($debug == 0) { $keystrokes .= "\\p20;"; # pause 0.2 seconds } else { $keystrokes .= "\\p200;"; # pause 2 seconds } $keystrokes .= "sa $base.mus\\r"; if (-r "$base.mus") { # overwite .mus file if it already exists $keystrokes .= "y\\r"; } $keystrokes .= "exit\\r"; # exit from SCORE $keystrokes .= "exitemu\\r"; # exit from dosemu
mus2pmx: Converting from MUS into PMX files
#!/usr/bin/perl # Program name: mus2pmx # Usage: mus2pmx [.mus file(s)] # This will create .pmx with same base filename as input files. use strict; my $debug = 0; # run without -t option to see what problem may be my $file; foreach $file (@ARGV) { my $basename = $file; $basename =~ s/\.[^.]*//; my $extension = $file; $extension =~ s/^$basename\.//; if ((-r $file) && ($extension !~ /pmx/i)) { print "Processing file $file\n"; createPMX($basename, $extension); } } sub createPMX { my ($base, $ext) = @_; my $keystrokes = "\\P3;"; # set keypress speed if ($debug != 0) { $keystrokes = "\\P20;"; # slow down keystrokes for debugging $keystrokes .= "\\r"; # detect keyboard type in -t mode } # Run the SCORE program: $keystrokes .= "c:\\\\\\\\scor4\\\\\\\\scor4.exe\\r"; # Add extra \r to skip the splash screen: $keystrokes .= "\\r"; if ($ext =~ /mus/i) { $keystrokes .= "g"; # Get binary data (.mus files) } else { $keystrokes .= "re"; # REad ASCII data (.pmx files) } $keystrokes .= " $base.$ext\\r"; # the file to read # longer pauses needed for larger input files... if ($debug == 0) { $keystrokes .= "\\p20;"; # pause 0.2 seconds } else { $keystrokes .= "\\p200;"; # pause 2 seconds } $keystrokes .= "pmx\\r"; $keystrokes.= "$base.pmx\\r"; if (-r "$base.mus") { # overwite .mus file if it already exists $keystrokes .= "y\\r"; } $keystrokes .= "exit\\r"; # exit from SCORE $keystrokes .= "exitemu\\r"; # exit from dosemu if (-r "$base.$ext") { my $command = "LANG=none dosemu -quiet"; if ($debug == 0) { $command .= " -t"; } $command .= " -input \"$keystrokes\""; if ($debug == 0) { $command .= " >& /dev/null"; } `$command`; # run the command } }
mac2pmx: Converting TXT into PMX files
ASCII SCORE data read into the program with RE or RES may contain macros as well as numeric data. Numeric data describing the score is equivalent to the binary data stored in .mus (or .pag) files. Converting macro data into numeric data is non-trivial and essentially can only be done within SCORE itself. The following script will convert any ASCII SCORE file into purely numeric data. The file-naming convention for this program is to store macro data in a file ending in .txt. Any filename ending except .pmx, .mus or .pag will also work.
For example, the following data from user input mode can be loaded into SCORE via the RES command exactly like purely numeric text can. RES is better for loading such macro text non-interactively since this version of RE will not prompt the user to see if they want to edit the input.
IN1 0 0 1.0000 100 0 100 TR/K4F/E4/G/F/A/B/M/EU/D/C/PB/A/B/MH; EX4/Q/SX4/Q/Q; S 6:9/FE 11/C+ 1 5/C- 6 10; 2B; 1 2/3 4; lj 1 1
Using the txt2pmx will generate a fully numeric description of the notation:
8. 1.0 .000 .00 1.00 100.00 3. 1.0 1.500 17. 1.0 9.315 .00 -4.00 1. 1.0 23.215 3.00 10.00 .00 .5000 .50 .00 4. 1.0 23.215 -3.50 999.00 49.29 6. 1.0 23.215 3.50 5.00 29.59 11.0000 5. 1.0 23.215 1.00 2.00 29.59 -1.3117 -1.00 1. 1.0 29.595 5.00 10.00 .00 .5000 .00 .00 1. 1.0 35.974 4.00 10.00 .00 .5000 .50 .00 6. 1.0 35.974 4.50 6.00 42.35 11.0000 5. 1.0 35.974 2.00 4.00 42.35 -1.4117 -1.00 1. 1.0 42.354 6.00 10.00 .00 .5000 .00 .00 1. 1.0 49.287 7.00 20.00 .00 1.0000 14. 1.0 58.395 1.00 1. 1.0 61.526 10.00 20.00 .00 .2500 2.00 .00 .00 7.00 4. 1.0 61.526 -3.50 999.00 80.75 -1.0000 6. 1.0 61.526 8.00 7.00 75.94 22.0000 1. 1.0 66.332 9.00 20.00 .00 .2500 1.33 .00 .00 7.00 1. 1.0 71.138 8.00 20.00 .00 .2500 .67 .00 .00 7.00 1. 1.0 75.945 7.00 20.00 .00 .2500 .00 .00 .00 7.00 1. 1.0 80.751 6.00 10.00 .00 1.0000 1. 1.0 90.043 7.00 20.00 .00 1.0000 .00 .00 .00 14.00 14. 1.0 100.000 1.00 2.00
Either of the above SCORE data files can be converted into an EPS graphical score using score2eps:
Here is the PERL script which can convert macro text into PMX data (ASCII numeric SCORE data).
#!/usr/bin/perl # Program name: mac2pmx # Usage: mac2pmx [.txt file(s)] # This will create .pmx with same base filename as input files. use strict; my $debug = 0; # run without -t option to see what problem may be my $file; foreach $file (@ARGV) { my $basename = $file; $basename =~ s/\.[^.]*//; my $extension = $file; $extension =~ s/^$basename\.//; if ((-r $file) && ($extension !~ /pmx/i)) { print "Processing file $file\n"; createPMX($basename, $extension); } } sub createPMX { my ($base, $ext) = @_; my $keystrokes = "\\P3;"; # set keypress speed if ($debug != 0) { $keystrokes = "\\P20;"; # slow down keystrokes for debugging $keystrokes .= "\\r"; # detect keyboard type in -t mode } # Run the SCORE program: $keystrokes .= "c:\\\\\\\\scor4\\\\\\\\scor4.exe\\r"; # Add extra \r to skip the splash screen: $keystrokes .= "\\r"; if ($ext =~ /mus/i) { $keystrokes .= "g"; # Get binary data (.mus files) } else { $keystrokes .= "res"; # REad ASCII data (.pmx files) } $keystrokes .= " $base.$ext\\r"; # the file to read # longer pauses needed for larger input files... if ($debug == 0) { $keystrokes .= "\\p20;"; # pause 0.2 seconds } else { $keystrokes .= "\\p200;"; # pause 2 seconds } $keystrokes .= "pmx\\r"; $keystrokes.= "$base.pmx\\r"; if (-r "$base.mus") { # overwite .mus file if it already exists $keystrokes .= "y\\r"; } $keystrokes .= "exit\\r"; # exit from SCORE $keystrokes .= "exitemu\\r"; # exit from dosemu if (-r "$base.$ext") { my $command = "LANG=none dosemu -quiet"; if ($debug == 0) { $command .= " -t"; } $command .= " -input \"$keystrokes\""; if ($debug == 0) { $command .= " >& /dev/null"; } `$command`; # run the command } }