6

I was looking at Python In Music but I'm not sure whether any of listed libraries actually supports

  • rendering of music notes
  • export the result as a PNG

Background: I want to train children reading notes. To do so, I want to provide a Raspberry Pi 2B including a 400x320 display. The Raspberry is connected to a keyboard via MIDI. The children see the notes and have to play the correct tones. It's about reading notes, not about playing fluently, so the small display is sufficient.

Example 320x240 screen of the final result:

Example screen

I'm looking for a library that can generate the treble clef, lines, rhythm indicator and the notes.

1
  • Maybe the bC note was not an ideal example in this quick mockup. Commented Jul 21, 2016 at 23:01

1 Answer 1

7

LilyPond is the go to for musical notation engraving - there are several python libraries that interface with it such as Abjad.

  • Gratis - Yes
  • python - can be interfaced with
  • raspberry-pi - Yes
  • output to pdf, ps or png

generate the: - treble clef, - lines, - rhythm indicator - and the notes. All of the above, using a text notation, and more such as cords, multiple parts, other notations, ect.

An example that I knocked up - not musically sound I am sure:

\language "english"
\relative c'' {
  \time 4/4
  cs2 es4 f4 ds4( g2) cs4 e4 bf( c4 fb2 g4) {af bs} e~
}
\addlyrics {
  Croak like a frog in a Lily-Pond! 
}

enter image description here

Some exampled from the website:

Fret board: enter image description here

Gregorian enter image description here

Complex Notation: enter image description here

2
  • I think that is what I'm looking for. Unfortunately it does not install. Lilypond installed fine with sudo apt-get install lilypond, PIP installed also fine with sudo apt-get install python-pip but Abjed (pip install abjad) returns an error "Error:root:Error parsing". I'll try to fix it with Google magic Commented Jul 24, 2016 at 19:12
  • @ThomasWeller to globally install anything on Linux using pip you need sudo pip install xxxx - personally I usually use sudo pip install -U xxxx to ensure that dependent packages are updated as well. Alternatively use python viritualenv see pypi.python.org/pypi/virtualenv Commented Jul 25, 2016 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.