Skip to content
Daniel Field edited this page Aug 20, 2018 · 2 revisions

How to run the algorithm:

  1. Save the two Python files Field_D_main.py and Field_D_SupportingClasses.py together in a folder on a computer that has Python 2 (preferably Python 2.7) installed.
  2. Copy your text input file into the same folder.
  3. Use the computer’s Python 2 environment to open and run Field_D_main.py. a. For example, if using the IDLE Python 2.7.10 shell, select File > Open… then navigate to the folder and open Field_D_main.py. Once the file is open, run it by selecting Run > Run Module (or by pressing the F5 key). If using an environment other than IDLE, follow the process specific to that environment to open and run Field_D_main.py.
  4. You will be prompted to enter the name of the text input file. Enter the filename in full including the file extension (.txt). A reminder: the text file must be in the same folder as the two Python files.
  5. You will be prompted to enter a title for the work. Enter any text and press Enter, or simply press Enter for the default title.
  6. You will be prompted to enter the Lyricist’s name. Enter any text and press Enter, or simply press Enter for the default text.
  7. You will be prompted to enter a name for the output file. Enter your desired filename for the MusicXML file without any extension; the .musicxml extension will be added automatically by the Python script.
  8. The script will run, and will save the output MusicXML file in the same folder as the Python files and the text input file.

A few tips on input text files, for best results:

The algorithm is written for text in the English language. It will probably work with some success on other languages, but only to the extent that the word breakdowns into syllables are similar. It will not recognise text characters that are not commonly used in English (e.g. accented vowels, vowels with umlauts). It is written in such a way that any unrecognised character is treated like a consonant; in many cases, this may allow it to function on text that contains unrecognised characters. However, any such apparent success is merely coincidental.

The algorithm will set the input text to music. Every bit of text in the file will be included; for that reason, the text file should be ‘cleaned up’ so that it includes only the text that is intended to be set to music.

An empty line will be interpreted as a new verse. It is recommended that the input text should include at least three verses (each not too short) in order to experience the full harmonic variety of the algorithm.

The algorithm cannot sound out numbers or symbols. Any numbers or symbols should be spelled out in full (e.g. “the Summer of sixty nine” rather than “the Summer of ‘69”). It recognises only the most basic punctuation as commonly seen in poetry (full stop, comma, exclamation mark, question mark, semicolon and full colon). It recognises apostrophes only in common usages such as won’t. It does not recognise quotation marks or brackets – for best results, these should be removed from the input text. It does not recognise hyphens; hyphenated words should be written out as separate words.

The algorithm cannot be guaranteed to work on all English words, due to the complexities and inconsistencies within the English language together with the fact that the entire algorithm was developed very rapidly.

Clone this wiki locally