Triolet support for midi generation

This commit is contained in:
dotmg 2026-05-10 17:30:53 +02:00
parent cd41ea0b6a
commit 38b6e17008
3 changed files with 28 additions and 1 deletions

View file

@ -2,8 +2,8 @@
"themeMode": "DARK", "themeMode": "DARK",
"fontSize": 18.5, "fontSize": 18.5,
"playlist": [ "playlist": [
"assets://ffpm-617.txt",
"assets://a.txt", "assets://a.txt",
"assets://ffpm-617.txt",
"assets://ews-127.txt", "assets://ews-127.txt",
"assets://ffpm-521.txt", "assets://ffpm-521.txt",
"assets://ews-126.txt", "assets://ews-126.txt",

View file

@ -0,0 +1,9 @@
M0:|T:What a day of victory|t:EWS 376 When at last we see the King|r:P.M|c:G|m:4/4|a:James Rowe 1865-1933|h:Charles Hutchinson Gabriel 1856-1932|u:https://hymnary.org/hymn/D1916/page/48
U0:zC:y yy4y yy4y 44ty C/ yyy4 yyy4 y44t yC/ y62tt 624y 62ty (822) yyy4y yy4 y44tyC
N1:drmmmfmmrdddrddl,s,dmRmssrdrmmmfmmrdddrddl,s,ssmdmrdmssssmdsmdlssmfsssmdmmr--drmmmfmmrdddrddl,s,ssmdmrd
N2:s,t,ddddds,s,l,l,l,l,l,l,f,m,s,s,F,F,s,s,s,s,t,ddddds,s,l,l,l,l,l,m,f,s,t,dddl,t,s,s,dt,drddt,dddt,dddrdt,t,dddt,--l,l,dddl,s,S,t,t,l,l,l,l,m,f,s,t,dddt,t,d
N3:mfssllsdrmmffmmddddddrmt,mfssllsdrmmffmdrmfsslsfmmsfmsmffmsffsslsmrsssss--mfsrdddmmmmffmdrmfsFFffm
N4:mrdt,l,f,ddt,l,s,f,r,l,l,f,d,m,s,l,dt,ds,mrdt,l,f,ddt,l,s,f,r,l,l,t,drmmfss,d,dmrdt,dfrmmfrmdl,t,ds,s,m,d,d,s,l,f,dt,l,f,d,m,m,l,s,f,r,l,l,t,drml,l,s,s,d,
E1:When at last we see the King /and His praise in glo_ry sing,/What a day of vic_to_ry that will be!/When we reach the oth_er side /where the faith_ful shall ab_ide,/What a day of vic_to_ry that will be!/${R=}What a day of vic_to_ry, vic_to_ry, vic_to_ry!/What a day of vic_to_ry that will be!/When ho_san_nas glad we sing /in the pa_lace of the King,/What a day of vic_to_ry that will be!
E2:When we walk the streets of gold /with the hap_py saints of old,/What a day of vic_to_ry that will be!/When we join the an_gel-_throng /in the ev_er_last_ing song,/What a day of vic_to_ry that will be!
E3:When with tri_als tru_ly past /we re_ceive the crown at last,/What a day of vic_to_ry that will be!/When be_fore the King we stand /in that ev_er_last_ing land,/What a day of vic_to_ry that will be!/

View file

@ -1182,6 +1182,8 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
var lastNoteString = "" var lastNoteString = ""
val midiPitch = MidiPitch(voiceNumber) val midiPitch = MidiPitch(voiceNumber)
var nextComment: MutableList<String> = mutableListOf() var nextComment: MutableList<String> = mutableListOf()
var trioletCount = -1
var nextTrioletDuration = 0
fun pushMidi(typeBlock: String = "note") { fun pushMidi(typeBlock: String = "note") {
if (typeBlock == "measure") { if (typeBlock == "measure") {
val z = midiPitch.copy() val z = midiPitch.copy()
@ -1279,6 +1281,18 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
'D', 'R', 'F', 'S', 'T', 'D', 'R', 'F', 'S', 'T',
'-', 'Z', 'z' '-', 'Z', 'z'
-> { -> {
if (trioletCount == 2) {
trioletCount = 1
midiDuration = nextTrioletDuration / 2
nextTrioletDuration = nextTrioletDuration - midiDuration
pushMidi()
nextDuration = nextTrioletDuration
} else if (trioletCount == 1) {
midiDuration = nextDuration
pushMidi()
trioletCount = 0
nextTrioletDuration = 0
}
var noteString = it.toString().lowercase() var noteString = it.toString().lowercase()
if (it == 'D' || it == 'R' || it == 'F' || it == 'S') { if (it == 'D' || it == 'R' || it == 'F' || it == 'S') {
noteString += "i" noteString += "i"
@ -1328,6 +1342,10 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
'&' -> { '&' -> {
commentNumber++ commentNumber++
nextComment.add(templateComments[commentNumber]) nextComment.add(templateComments[commentNumber])
if (templateComments[commentNumber] == "\$T") {
nextTrioletDuration = 2 * nextDuration / 3
trioletCount = 2
nextDuration = nextDuration - nextTrioletDuration }
} }
} }
lastIt = it lastIt = it