Music Score Trainer is a Python script that generates a music score of random notes and an accompanying audio file to aid in practicing note recognition and sight-reading skills.
- Generates a music score with random notes.
- Creates an audio file matching the generated score.
- Ideal for practicing note recognition and improving sight-reading skills.
- Python 3 - required to run the script.
- LilyPond - used to generate PDF and MIDI files.
- TiMidity++ - used to convert MIDI files to audio.
- LAME - used to compress the generated audio to MP3.
-
Modify the Script:
- Open
sight_reading.py
in a text editor. - Locate the line
key = key_c
and change it to the key you want to practice.- For example,
key = key_a
for the key of A. - Sharp keys are named with an
is
suffix (e.g., key F sharp iskey_fis
). - Flat keys are named with an
es
suffix (e.g., key B flat iskey_bes
).
- For example,
- Open
-
Generate the LilyPond File:
- Run the script and redirect the output to a
.ly
file:python3 sight_reading.py > key_c.ly
- Replace
key_c.ly
with the desired key name.
- Run the script and redirect the output to a
-
Create the Music Score and MIDI File:
- Use LilyPond to generate the PDF and MIDI files:
lilypond key_c.ly
- This command will generate
key_c.pdf
andkey_c.midi
files.
- Use LilyPond to generate the PDF and MIDI files:
-
Convert MIDI to Audio:
- Use TiMidity++ to convert the MIDI file to a WAV audio file:
timidity -Ow key_c.midi
- This command will generate a
key_c.wav
file.
- Use TiMidity++ to convert the MIDI file to a WAV audio file:
-
Compress the Audio File:
- Use LAME to compress the WAV file to MP3 format:
lame key_c.wav
- This command will generate a
key_c.mp3
file.
- Use LAME to compress the WAV file to MP3 format:
After completing these steps, you will have a PDF music score and an MP3 audio file for practicing note recognition and sight-reading skills.
We welcome contributions to expand the range of keys supported by the Music
Score Trainer. If you would like to add data for new keys, please update the
keys.py
file with the necessary information.
For each key, provide data for both the treble clef and bass clef:
-
Treble Clef:
- Notes must be within the range of G3 to C6, inclusive.
- Ensure that all notes in the lists are within this range, considering both actual pitch and spelling.
-
Bass Clef:
- Notes must be within the range of C2 to F4, inclusive.
- Similarly, ensure that all notes are within this range, considering both actual pitch and spelling. For instance, B1-sharp is technically C2, but B1 itself is outside the range, so it should not be included.
Each clef should include the following lists:
- Scale Notes: this list contains all the notes in the scale for the specified key. For each key, the scale notes are: do, re, mi, fa, so, la, ti.
- Altered Notes: This list includes all sharp-spelt and flat-spelt notes
for the key.
- Sharp-spelt notes: di, ri, fi, si, li
- Flat-spelt notes: ra, me, se, le, te
- Create the Data: Follow the provided guidelines to create the
scale notes and altered notes lists for both treble and bass clefs in
keys.py
. - Update the Script: Modify the
key = key_c
line insight_reading.py
to reference the newly added key inkeys.py
. Setshuffle = False
to disable random shuffling of notes, which will make it easier to inspect and verify the generated results. - Generate and Verify Scores: Follow the steps in the "Usage" section to generate the music scores and ensure that they are correct.
- Submit a Pull Request: Once you have confirmed that everything works as
expected, commit only the changes to
keys.py
, create a new branch for your updates, and submit a pull request.
Thank you for contributing to the Music Score Trainer project!
This project is licensed under GNU General Public License, Version 3. See the LICENSE file for details.
This script is inspired by Ada and is created to help her with her piano practicing.