Skip to content

Five songs for testing transposition logic#1

Open
erangell wants to merge 5 commits into
hsweet:masterfrom
erangell:master
Open

Five songs for testing transposition logic#1
erangell wants to merge 5 commits into
hsweet:masterfrom
erangell:master

Conversation

@erangell
Copy link
Copy Markdown

@erangell erangell commented Oct 4, 2025

Hi Harry, here are 5 songs to add to your library and test the transposition logic.
For Lerner's Freylach I added the rehearsal letters. If you look in klezmer.app not all parts currently have them.
The C part for the Kroilid song was generated from a Bb part by transposing it in Lilypond because it came from a Bb book.
Some of the other songs transpose up an octave because the note data was recorded too low.
Let me know any feedback about how you want these files created going forward.
Thanks, Eric

@hsweet
Copy link
Copy Markdown
Owner

hsweet commented Oct 4, 2025

Hi Eric..

There are a few issues to work thru. Or questions.

  • If the Bb chart is in G, the C chart is in F. Is that the correct target key for these tunes?
  • Kroilid's transposition. I would want that (and all the other charts)in Bb Are all your charts Bb? If there are C charts, I can process them with no changes to the script.
  • There is a ly command that can transpose. ly "transpose c d" .ly -o '-transposed.ly' will do a folder full. My script uses a regex for that but maybe it would be cleaner to use ly? I could use that to start with a set of C charts and not have to fiddle with my script.
  • We have different versions of lilypond \version "2.18.0" vs 2.24.0.
  • We have the \transpose directive in different places. My script puts in in \score. That seems to work except in Shades of Folk. No idea why.
  • I've been labeling the instruments instrument = "Violin" on the C charts which becomes Bf, Ef or Bass in the transposed.

Nothing looks to be a deal-breaker. Also, I just did some upgrades to the transpose script, now renamed lytranspose.

@erangell
Copy link
Copy Markdown
Author

erangell commented Oct 4, 2025

Hi Harry, this is what I did this afternoon:

If the Bb chart is in G, the C chart is in F. Is that the correct target key for these tunes?
Kroilid's transposition. I would want that (and all the other charts)in Bb Are all your charts Bb? If there are C charts, I can process them with no changes to the script.

I rewrote the Bb chart as a C chart, so all charts being transposed by the script are C charts.

There is a ly command that can transpose. ly "transpose c d" .ly -o '-transposed.ly' will do a folder full. My script uses a regex for that but maybe it would be cleaner to use ly? I could use that to start with a set of C charts and not have to fiddle with my script.

I couldn't find this command so I manually converted the Bb chart to C.

We have different versions of lilypond \version "2.18.0" vs 2.24.0.

The Mac where I can run the GUI of Lilypond uses 2.19. When I tested 2.24, the rehearsal letter boxes got an error.

We have the \transpose directive in different places. My script puts in in \score. That seems to work except in Shades of Folk. No idea why.

It worked for me when I ran the Perl script. Note that in order to convert the absolute pitches into proper ranges for Eb and Bass I added the following statements. Maybe there is a way of detecting that the file does not use relative pitches and adding these transpositions in that case.

             	if ($target eq "a") {

			$line =~ s/\\score \{/\\score \{\\transpose c c,/;
		}
		} elsif ($target eq "bass") {

			$line =~ s/\\score \{/\\score \{\\transpose c c,,/;

I've been labeling the instruments instrument = "Violin" on the C charts which becomes Bf, Ef or Bass in the transposed.

I added this to each chart.

Nothing looks to be a deal-breaker. Also, I just did some upgrades to the transpose script, now renamed lytranspose.

Thanks - this is a great learning experience for me!

@hsweet
Copy link
Copy Markdown
Owner

hsweet commented Oct 4, 2025

My preference would be to convert everything to \relative which is not hard to do.

Frescobaldi and the ly command can convert absolute to relative or the ly script can batch process so if you have a lot of those it would be a lot faster.

There is a help page for how to use the lilypond helper scripts on mac. Or I can run it here.

Or we can try your regex with an if (m/\relative/).{... .} Relative melodies have a \relative directive so it would be easy to distinguish from an absolute.

For that matter, the script should be able to call the ly script if it detects an absolute chart, which would make it more universal.

I have been shifting things down an octave for horn. Seems to more or less work.
``
$line =~ s/\score {/\score {\transpose c $target/;
# for Eb Horn. This ensures the music remains in a playable
# range after transposition, as Eb instruments sound a
# minor third higher than written.
if ($target eq "a") {
$line =~ s/relative c(?=\s)/relative c,/g;
$line =~ s/relative c'(?=\s)/relative c/g;
$line =~ s/relative c''(?=\s)/relative c'/g;`

@hsweet hsweet closed this Oct 4, 2025
@hsweet hsweet reopened this Oct 4, 2025
@hsweet
Copy link
Copy Markdown
Owner

hsweet commented Oct 6, 2025

Turns out I can work with absolute notation, but in my one test (Your Shuster tune) relative gave a better result, at least on the Eb. You can see that on klezmer.app. There are 2 versions, Shuster.... and Shuster.... -relative.

I added a block of code to detect absolute charts. Right now it does nothing but if it works I should be able to automatically convert to relative.

I hadn't figured out yet how to always have the transpositions always land on a good part of the staff.

Also if you are working with the app (are you)?, I had a lot of bugs to clean up. The fixed up version is up here now.

@hsweet
Copy link
Copy Markdown
Owner

hsweet commented Oct 6, 2025

That works (see Klezapp) pretty well. I had to fix position on clef for the bass part. (Relative makes that much easier... sopmusicA = \relative c,, { Just add , or ' and the whole section changes. In absolute every note needs fixing.

With one \music section melody = \relative c'' { there is a single spot to change the octave. In yours I'm not sure if I should do the same to all the sections, or maybe the bass chart looks ok but has funny jumps.

If I can figure out a way to keep the transcriptions in the right place on the staff it won't matter. Open to ideas.

@hsweet
Copy link
Copy Markdown
Owner

hsweet commented Oct 11, 2025

I've made some progress on the Goldilocks octave problem.

Lily has \displayMusic \myMusic and \displayLilyMusic \myMusic directives which output the notes in either a list with octave and note data or just a list of absolute notes. It works the same for absolute or relative notation.

ly2midi.pl converts the \displaymusic list to midi and tries to determine if the transposition should go up down, or stay put. That part needs more work, but it's a start.

Eventually I should be able to figure out a workable system without too many extra steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants