ice6 / opensheetmusicdisplay

Combine `osmd_transpose` and `osmd` together to show transposing function.
https://ice6.github.io/opensheetmusicdisplay/build
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Fun with Stems #6

Closed AlbertHart closed 4 years ago

AlbertHart commented 4 years ago

The first image below a fun score - showing 7 different clef symbols - each of which have different notes on the lines and spaces. Basically there are 15 to 30 different Clef signs.

After transposing a score, we want to use a down stem on any notes above the middle line and an up stem for any notes below the middle line. Basically, our code needs to know what note and octave are on the middle line of any clef and position the stems based on whether the note will appear above or below the line.

In the first staff, a normal treble clef, the B in octave 4 is on the middle line. But on the second staff with the clef symbol moved down, the note on the middle line is a D and not a B. Many of these clef signs are not used much today, but many are as well. But if it is relatively easy, we need to support all possible clefs we might run into,

The second image show clefs that in use today. But we might as well make our stem logic with with all 15 to 45 clefs that Finale, MuseScore, Sibelius and MusicXML supports. i will be able to do this - but these strange clefs were a surprise to me (an my music teacher whom i had a less on with today)

image

image

ice6 commented 4 years ago

After transposing a score, we want to use a down stem on any notes above the middle line and an up stem for any notes below the middle line. Basically, our code needs to know what note and octave are on the middle line of any clef and position the stems based on whether the note will appear above or below the line.

πŸ‘ cool. so many domain knowledge for music notation.

AlbertHart commented 4 years ago

I committed some stem changes to GITHUB - there are some more I still want to make.

In addition, i used 'let' almost everywhere instead of 'var'.

It does seem to be working - but there are some beam stems and chord stems I want to improve.

I am processing in two passes now - the first pass is used to determine it there are multiple voices in a measure. If there are multiple voices in a measure, then we point stems up and down based on voice.

ice6 commented 4 years ago

πŸ‘

AlbertHart commented 4 years ago

Good news for beam groups.

I have stems for beams working for at least one test case.

The direction of the stems is determined by whether most of the notes in the beam group are above or below the center line.

I read the entire beam in pass 1, so I can specify the proper stem direction in pass 2.

image

Musescore doesn't seem to change stems in beams when transposing. They do switch quarter notes

image

AlbertHart commented 4 years ago

Now I need to do chords properly.

If the note furthest from the middle line is above the middle line, the stem of the chord points downwards.

If the note furthest from the middle line is below the middle line, the stem of the chord points upwards.

ice6 commented 4 years ago

πŸ‘