David's public blog

This week I released a new Python package in pip that allows you to display music sheets in Streamlit applications.

Pypi: https://pypi.org/project/streamlit-music-score/ Github: https://github.com/davidissamattos/streamlit-music-score

Installation

Just run:

pip install streamlit-music-score

It has dependencies on music21 and streamlit

Intro

This pacakge basically allows you to display music scores coming from a lot of different formats, including MusicXML, abc, lilypond and any other of the list. Conversion between these and MusicXML is handled by music21

These formats are converted to MusicXML which can be rendered.

The package renders MusicXML scores inside Streamlit using the OpenSheetMusicDisplay (OSMD) library.

You have three methods:

OSMD play functionality is only available for sponsors at the moment. As soon as it is released to the public this demo will be updated also to include play controls.

Usage

from streamlit_music_score import music_score, music_score_file, music_score_stream

xml = "<score-partwise>...</score-partwise>"  # MusicXML string from music21
music_score(xml, height=540)

API

We also have a demo page that shows some usages including using Python to modify scores and them display

#Streamlit #Musicxml #Music21 #Python #Osmd