craigsapp / humlib

Humdrum data parsing library in C++
http://humlib.humdrum.org
BSD 2-Clause "Simplified" License
31 stars 8 forks source link

autostem: no support for octave clefs #11

Closed jacekiwaszko1 closed 6 years ago

jacekiwaszko1 commented 6 years ago

autostem tool doesn't work when spine is written in octave clef:

input:

**kern  **kern  **kern
*clefF4^    *clefG2v    *clefG2^
4C  4C  4cc
4D  4D  4dd
4E  4E  4ee
4F  4F  4ff
4G  4G  4gg
4A  4A  4aa
4B  4B  4bb
4c  4c  4ccc
4d  4d  4ddd
4e  4e  4eee
4f  4f  4fff
4g  4g  4ggg
4a  4a  4aaa
*-  *-  *-

output:

**kern  **kern  **kern
*clefF4^    *clefG2v    *clefG2^
4C/ 4C/ 4cc\
4D/ 4D/ 4dd\
4E/ 4E/ 4ee\
4F/ 4F/ 4ff\
4G/ 4G/ 4gg\
4A/ 4A/ 4aa\
4B/ 4B/ 4bb\
4c/ 4c/ 4ccc\
4d/ 4d/ 4ddd\
4e/ 4e/ 4eee\
4f/ 4f/ 4fff\
4g/ 4g/ 4ggg\
4a/ 4a/ 4aaa\
*-  *-  *-
craigsapp commented 6 years ago

The correct format for octave displacement is such as *clefGv2 where the octave modifier goes between the clef name and the staff line. So one solution is to either make autostem recognize non-standard format, or to disallow the non-standard format in the conversion from Humdrum to MEI.

Here is a comparison between standard and non-standard clefs. The red notes are in the correctly described staff:

screen shot 2018-05-21 at 6 13 25 am

Notice that the red-note stems are behaving properly.

**kern  **kern  **kern  **kern  **kern  **kern
*clefF4^    *clefF^4    *clefG2v    *clefGv2    *clefG2^    *clefG^2
4C  4C@ 4C  4C@ 4cc 4cc@
4D  4D@ 4D  4D@ 4dd 4dd@
4E  4E@ 4E  4E@ 4ee 4ee@
4F  4F@ 4F  4F@ 4ff 4ff@
4G  4G@ 4G  4G@ 4gg 4gg@
4A  4A@ 4A  4A@ 4aa 4aa@
4B  4B@ 4B  4B@ 4bb 4bb@
4c  4c@ 4c  4c@ 4ccc    4ccc@
4d  4d@ 4d  4d@ 4ddd    4ddd@
4e  4e@ 4e  4e@ 4eee    4eee@
4f  4f@ 4f  4f@ 4fff    4fff@
4g  4g@ 4g  4g@ 4ggg    4ggg@
4a  4a@ 4a  4a@ 4aaa    4aaa@
*-  *-  *-  *-  *-  *-
!!!filter: autostem
!!!RDF**kern: @ = marked note, color=red
jacekiwaszko1 commented 6 years ago

My mistake, sorry for bothering! BTW it is nice to know, that autostem works also in VHV.

craigsapp commented 6 years ago

The official list of humlib tools that can be run in VHV is:

https://github.com/craigsapp/humlib/blob/master/src/tool-filter.cpp#L110-L144

    for (int i=0; i<(int)commands.size(); i++) {
        if (commands[i].first == "autobeam") {
            RUNTOOL(autobeam, infile, commands[i].second, status);
        } else if (commands[i].first == "autostem") {
            RUNTOOL(autostem, infile, commands[i].second, status);
        } else if (commands[i].first == "chord") {
            RUNTOOL(chord, infile, commands[i].second, status);
        } else if (commands[i].first == "cint") {
            RUNTOOL(cint, infile, commands[i].second, status);
        } else if (commands[i].first == "dissonant") {
            RUNTOOL(dissonant, infile, commands[i].second, status);
        } else if (commands[i].first == "hproof") {
            RUNTOOL(hproof, infile, commands[i].second, status);
        } else if (commands[i].first == "imitation") {
            RUNTOOL(imitation, infile, commands[i].second, status);
        } else if (commands[i].first == "extract") {
            RUNTOOL(extract, infile, commands[i].second, status);
        } else if (commands[i].first == "metlev") {
            RUNTOOL(metlev, infile, commands[i].second, status);
        } else if (commands[i].first == "msearch") {
            RUNTOOL(msearch, infile, commands[i].second, status);
        } else if (commands[i].first == "satb2gs") {
            RUNTOOL(satb2gs, infile, commands[i].second, status);
        } else if (commands[i].first == "kern2mens") {
            RUNTOOL(kern2mens, infile, commands[i].second, status);
        } else if (commands[i].first == "recip") {
            RUNTOOL(recip, infile, commands[i].second, status);
        } else if (commands[i].first == "transpose") {
            RUNTOOL(transpose, infile, commands[i].second, status);
        } else if (commands[i].first == "binroll") {
            RUNTOOL(binroll, infile, commands[i].second, status);
        } else if (commands[i].first == "myank") {
            RUNTOOL(myank, infile, commands[i].second, status);
        }
    }

In other words, most of the tools in humlib can be run as a filter command in VHV, and any new ones would be added to this list in the future.

And most of these are updates on tools in Humdrum Extras, such as the old autostem which was converted into the new autostem . The update allows for use of the tool in javascript/verovio and modernizes the C++ code.

Eventually the older programs will be retired and replaced with the new lines in Humdrum Extras. There are not much differences between them, but I will probably add new features mostly to the newer versions, so they might drift over time until I merge humlib into Humdrum Extras.


Note that I created the example by adding this filter:

!!!filter: extract -s 1,1,2,2,3,3

Then I typed alt-c to "compile" the filter and put the contents into the text editor (usually the filter is compiled and then sent to the humdrum-to-mei convert inside of verovio without placing the results in the text editor).

On the command-line this is the command to do with Humdrum Extras:

extractx -s 1,1,2,2,3,3

"extract" is an original Humdrum toolkit command, so I added x for the similar functioning program in Humdrum Extras (the original extract program could not extract spine duplications as being done in this case). Since the original Humdrum toolkit cannot be used in javascript (as it needs an AWK interpreter and the bash shell to handle command-line options), I recycle the "extract" name for use with the humlib version. (I should also have an alias to extractx in the filtering system).