Troubleshooting
This section details some of the common issues you may encounter while building this project and steps you can use to resolve them.
Notes are missed
The most common cause of missed notes is the delay between the note on event and note off event in the MIDI file. If the MIDI file is too short, it will not give the servo arm time to extend and retract. This can be rectified using the midi_note_expand.py
script included in the code for this chapter.
This script can be run using the following command; here, MIDI_FILE
is the filename of the MIDI file, DELAY
is the desired minimum delay in milliseconds between note on and note off events, and TEMPO
is the tempo you intend to play the file at (the delay time will vary depending on the tempo at which the file is played):
python midi_note_expand.py -f MIDI_FILE.mid -d DELAY -t TEMPO
This script will produce an output similar to that shown in the following screenshot. By default, it saves the modified file as MIDI_FILE_modified.mid
. By...