ssb22 / jianpu-ly

Jianpu in Lilypond
http://ssb22.user.srcf.net/mwrhome/jianpu-ly.html
Apache License 2.0
77 stars 19 forks source link

New chords implementation supporting mid-chord octaves & accidentals #60

Closed unbored closed 1 month ago

unbored commented 1 month ago

Fix slur around octave dots. Fix grace note flag to generate correct octave dot offsets. Add a more complex chord implement, which displays octave dots correctly. However, the previous input behaves differently in the new implement. Known issue: Dashes output wrong western notes.

ssb22 commented 1 month ago

Thanks for doing this :) I wonder if we can make it allow accidentals in the chords as well (the logic is very nearly there, they're just not appearing yet in the jianpu and there might be some complexities with auto-repeating them later in the bar). But we could leave in the code that disallows accidentals in chords for now

ssb22 commented 1 month ago

by he way, the readme file is auto generated from the doc section at the top of the code, so if you make changes in the readme it can be overwritten....

unbored commented 1 month ago

Thanks for doing this :) I wonder if we can make it allow accidentals in the chords as well (the logic is very nearly there, they're just not appearing yet in the jianpu and there might be some complexities with auto-repeating them later in the bar). But we could leave in the code that disallows accidentals in chords for now

Main problem is that if we put the accidental symbols along with the numbers as a whole, articulations such as octave dots and harmonic circles will be placed at the center of the whole instead of the numbers. I'll try some other workarounds

ssb22 commented 1 month ago

说得对, might need to add \halign #RIGHT before any note in the column without an accidental and also change the \tweak #'X-offset of dots outside the chord.

Unless we can figure out how to make Lilypond itself stack notes vertically instead of defining one big notehead for all of them, which would also have the advantage of correctly lining up with the accidentals on any 5-line staves in the same score. But that's going to be more complicated: I don't know if a RhythmicStaff can do it, and other staff types are going to be harder to override how we want. So we might have to settle for the halign and X-offset hacks as a least-bad option (I'm hoping that chords with accidentals are a rare use-case, but CUCOS did want one for a computer-game track they're playing at the student fair and they ended up using Ziipoo)

unbored commented 1 month ago

Unless we can figure out how to make Lilypond itself stack notes vertically instead of defining one big notehead for all of them, which would also have the advantage of correctly lining up with the accidentals on any 5-line staves in the same score.

Much more problems would be solved if it does, including slurs between grace and main notes.

说得对, might need to add \halign #RIGHT before any note in the column without an accidental and also change the \tweak #'X-offset of dots outside the chord.

The put-adjacent function can put the accidental symbols before numbers without changing the original alignment. However, special tweak for X-offset is still necessary.

Or we have another solution by making another markup hanging the accidentals before the chord with fine vertical adjustment. Both solutions are far from perfection.

unbored commented 1 month ago

By the way, It seems that \tweak affects only the operation right after it in my test case at least. Would it be possible that the missing of the octaves is because lilypond won't allow the same articulation applied multiple times on the same note by default? Thus the case ,,1'2 works well while ,1'2 fails. I'm looking for a workaround to apply the same articulation above and below.

unbored commented 1 month ago

A Y-offset in a chord puts one note over another, which helps dealing with accidentals and octave dots naturally. However, the main problem is that \applyOutput works on all notes inside a chord, which makes generating different numbers impossible. Would there be a general function that turns noteheads to numbers according to their pitches automatically just like what jianpu10a does? Or a function that gets positions of the notes inside a chord and writes corresponding markups?

ssb22 commented 1 month ago

Working accidentals in chords looks really nice. Unfortunately, this branch does break accidentals in Indonesian not-angka mode. I'm not sure what to do about that: it would be a bit messy if we had to bring back the old code as well and use that when in not-angka mode (which didn't support accidentals in chords).

unbored commented 1 month ago

I have no idea what a not-angka mode should look like, do you have any typical samples including accidentals, chords and graces?

ssb22 commented 1 month ago

I think we got not-angka back to what it was before now. I'm not sure about chords & grace notes in it, so we might have to support simple tunes only

unbored commented 1 month ago

I've already tried a new grace implement using the similar idea, thus the original grace mechanism works generally. Unfortunately not-angka mode still not tested. We can work on it later after this merge.

ssb22 commented 1 month ago

Thanks so much for working on this. Unfortunately my automatic script overwrote the Readme change when I ran it to upload to PyPI. But we can undo that with another commit. Normally we need to make sure all readme changes are in the docstring at the start of jianpu-ly.py, because the function write_docs() in jianpu-ly.py is used to automatically update the Readme and the HTML on the website