- Introduction
- Assumptions
- Supported Symbols
- Pipeline
- Tools Used
- How to Run
- Useful Resources
- Contributers
- License
This project aims to convert music sheets into a machine-readable version. We take a simplified version as we support only main symbols where we convert an image of a music sheet to a textual representation that can be further processed to produce midi files or audio files like wav or mp3.
- input image should be a scanned music sheet.
- maximum ledgers supported are
two
above the stafflines andtwo
below the stafflines. - each stave should start with a G clef.
- stem height is greater than or equal
3 * staffSpacing
(vertical area between two lines). - note head height equals
staffSpacing
.
Music sheets have a very vast variety of symbols making it hard to handle so for simplicity we handle only the symbols listed below.
we support whole notes
, half notes
, quarter notes
, eigth notes
, sixteenth notes
, thiry-second notes
stemsUp or stemsDown.
we support different kinds of beams combining notes up to thirty-second
stemsUp or stemsDown.
we support all kinds of chords.
- Time signatures: we support only
4/2
and4/4
- Accidentals: we support all kinds like
double sharp
,sharp
,flat
,double flat
,natural
. - Augmentation dots
- clefs: we support only G clef.
-
The input image goes through a series of steps we first apply filters to remove noise like
Hyprid Median Filter
andGaussian Filter
-
We apply
Rotation
thenAdaptive Thresholding
is used to segment the image into symbols and background. -
We remove Stafflines to find the symbols in the image easier.
-
We clip the image to remove the brace connecting the staves if exists.
-
We partition the image into the composing staves and apply find contours on each stave and feed each symbol to the classifiers.
-
symbols are first fed into template matching using SIFT features to identify the following:
Double Sharp
,Sharp
,Flat
,Double Flat
,Natural
,Whole Note
,Time Signatures
. -
if non of the previous symbols was identified we begin classification with our algorithmic approach after removing the stems using the following decision tree.
- install conda
conda env create -f requirements.yml
conda activate OMReader
python3 main.py <input directory path> <output directory path>
Note: you can run it on windows but you should ignore creating environment with the command previously mentioned but you need anaconda and opencv installed.
- Licensed under the MIT License.