View on GitHub

mdg2abc

Bash script for generating Musical Dice Game minuets (based on K. 516f, Mozart)

Download this project as a .zip file Download this project as a tar.gz file

mdg2abc.sh

mdg2abc.sh is a Bash script (see Wikipedia:Bash_(Unix_shell) for more info) that can be used for creating a musical score, written in ABC music notation, of a particular Musical Dice Game (MDG) minuet, generated based on the rules given in Musikalisches Würfelspiel, K.516f (Mozart, Wolfgang Amadeus).

To view the generated musical score, one can process it using abcm2ps to produce images in Postscript, PDF, and SVG formats. Another possibility is to use the abcmplugin.so browser plugin and open the ABC file in a web browser (works with Mozilla).

This directory includes:

To use the mdg2abc.sh Bash script, at the command line type:

/path/to/mdg2abc.sh n1 n2 n3 n4 n5 n6 n7 n8 n9 n10 n11 n12 n13 n14 n15 n16

where n1, n2, ..., n16 are any of the 11 possible outcomes of the toss of two ordinary six-sided dice, e.g., are 16 integers, not necessarily unique, chosen from the set {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}. For example, if the script is located in the present working directory and each outcome of the 16 dice tosses was a 3:

./mdg2abc.sh 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3

The output will be the file K516f-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3.abc, containing the score of the MDG minuet corresponding to the 16 outcomes given at the command line (all tosses came up a 3), and will be created under the current working directory. Please see the samples folder in this directory for more samples.

Using mdg2abcRndN.sh and mdg2midRndN.sh

To use the scripts for generating a requested number of randomly-generated of MDG minuets:

./mdg2abcRndN.sh <numberOfMDGsToMake>
./mdg2midRndN.sh <numnberOfMDGsToMake>

Note that abcmidi has to be installed beforehand.

A related Bash script that generates XHTML files that contain the musical scores and audio (plays when the image is clicked-on or tapped) of MDG minuets can be found at the GitHub site mdginabc2svg or its GitHub Pages Site at mdginabc2svg.

Using mdg2abcList.sh and mdg2midList.sh

To use the scripts for generating MDG minuets for 16-toss outcomes provided, one 16-sequence per line, in a text file (say, listfile.txt):

./mdg2abcList.sh listfile.txt
./mdg2midList.sh listfile.txt

Note that abcmidi has to be installed beforehand.

Acknowledgements

My sincerest gratitude to Chris Walshaw et al. for the ABC music notation; Jean-Francois Moine for abcm2ps and abcmplugin, and the accompanying examples, templates, and pointers for the appropriate use of these resources; Guido Gonzato for the ABC Plus Project and the abcmidi resources available there, more especially for the ABC resource book Making Music with ABC 2; James R. Allwright and Seymour Shlien for abcmidi source and binaries; and Artifex, Inc. for Ghostscript (includes the ps2pdf converter). Special thanks also to the International Music Score Library Project (IMSLP) for making available the score for Musikalisches Würfelspiel, K.516f. Ditto to Machtelt Garrels for the book Bash Guide for Beginners, Vivek Gite for the book Linux Script Shell Tutorial, and Steve Parker for the Unix/Linux Shell Cheatsheet. Many thanks, too, to the Debian Project for the Debian 8 (Jessie) GNU/Linux OS, TeXLive for the TeX distribution, to Brian Fox for Bash, and GitHub for its generosity in providing space for this project.

License

Creative Commons License
mdg2abc by Justine Leon A. Uro is licensed under a Creative Commons Attribution 4.0 International License.
Based on a work at https://github.com/justineuro/mdg2abc