diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index c646009..7d9985f 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -57,6 +57,7 @@ kotlin { implementation(libs.cafe.voyager.koin) implementation(libs.androidx.material.icons.extended) implementation(kotlin("stdlib-jdk8")) + //implementation(libs.ktmidi) } commonTest.dependencies { implementation(libs.kotlin.test) diff --git a/composeApp/src/commonMain/composeResources/files/config.json b/composeApp/src/commonMain/composeResources/files/config.json index d079209..bbc68e0 100644 --- a/composeApp/src/commonMain/composeResources/files/config.json +++ b/composeApp/src/commonMain/composeResources/files/config.json @@ -2,16 +2,7 @@ "themeMode": "DARK", "fontSize": 18.5, "playlist": [ - "assets://ews-24.txt", - "assets://ffpm-79-2.txt", - "assets://ffpm-111.txt", - "assets://ffpm-190.txt", - "assets://ews-13.txt", - "assets://ffpm-137.txt", - "assets://ffpm-653.txt", - "assets://ews-19.txt", - "assets://ffpm-131.txt", - "assets://ffpm-54.txt", + "assets://ffpm-428 .txt", "assets://ffpm-127.txt", "assets://ews-15.txt", "assets://ews-14.txt", diff --git a/composeApp/src/commonMain/composeResources/files/ews-13.txt b/composeApp/src/commonMain/composeResources/files/ews-13.txt index 8e8513c..89321a8 100644 --- a/composeApp/src/commonMain/composeResources/files/ews-13.txt +++ b/composeApp/src/commonMain/composeResources/files/ews-13.txt @@ -4,7 +4,7 @@ N1:dmfslsfmfmdrt,dmfmrdrrmrmfslsF ssssmrdmfmrdrz4dffffm--mrrrmfrs--s(lsf)mr-rd N2:s,s,s,s,----l,s,-s,-s,dt,drl,t,t,d----dt,l,t,dddd--dt,drl,t,z4dl,l,l,l,s,--s,s,t,t,drt,(dt,d)d(d-t,)ddt,-d N3:mdrmfmrdddmfrmssssF sss--fmmrrrmmmsfmss--F ssdrmdd--ddsmd(t,rs-)f-mrmmfssss-fm N4:dddd----m,s,-s,-ddrdt,l,s,s,d----l,rr,s,dddd--drdt,l,s,s,drmdf,--f,dddds,---s,-drddfmrds,-s,d, -O1:v3:The tri_umphs of his grace, _2the tri_umphs of his grace _2the tri_umphs of his grace The tri_umps of _his grace! +O1:v3:The tri_umphs of his grace, _2the tri_umphs of his grace _2the tri_umphs of his grace The tri_umphs of _his grace! O2:v3:The ho_nors of your name./_2the ho_nors of your name./_2the ho_nors of your name the ho_nors of _your name O3:v3:'tis life and health and peace,/_2'tis life and health and peace,/_2'tis life and health and peace 'tis life and health _and peace. O4:v3:The hum_ble poor re_lieve,/_2The hum_ble poor re_lieve,/_2The hum_ble poor re_lieve, The hum_ble poor _re_lieve. diff --git a/composeApp/src/commonMain/composeResources/files/ews-33.txt b/composeApp/src/commonMain/composeResources/files/ews-33.txt new file mode 100644 index 0000000..13295cd --- /dev/null +++ b/composeApp/src/commonMain/composeResources/files/ews-33.txt @@ -0,0 +1,12 @@ +M0:|h:ARIZONA Robert Henry Earnshaw (1856-1929)|c:F|m:3/4|t:EWS 33 Father, whose everlasting love|a:Charles Wesley (1739: 1707-1788)|r:LM +U0:z0:44484(44)4C/444(62)484C/444(44)484C/4448(22)(62)4C +N1:mmmmms-fmddt,drmrdrmmmm-mlsfrsfmd-d-t,d +N2:dddddr-t,dds,s,s,-dl,l,t,ddrd-ddDrt,drdl,-s,-s,s, +N3:ssslmrssslsfmfsfmsssSl-Tlllssss(fm)rmfm +N4:dddl,l,t,-s,dfmrd-df,l,s,ddt,l,ddfmrs,l,t,d(f,)-s,-s,d +E1:Fa_ther, whose e_ver_la_sting love/your on_ly Son for sin_ners gave,/whose grace to all did free_ly move,/and sent him down the world to save: +E2:Help us your mer_cy to ex_tol,/im_mense, un_fa_thomed, un_con_fined;/to praise the Lamb who died for all,/the Sa_viour of all hu_man_kind. +E3:Your un_dis_tin_gui_shing re_gard/was cast on A_dam's fal_len race;/for all you have in Christ pre_pared/suf_fi_cient, so_vereign, sa_ving grace. +E4:The world he suf_fered to re_deem;/for all he has the\ a_tone_ment made;/for those that will not come to him/the ran_som of his life was paid. +E5:Why then, Thou u_ni_ver_sal Love,/Should a_ny of Thy grace des_pair?/To all, to all, Thy bo_wels move,/But strai_tened in our own we are. +E6:A_rise, O God, main_tain your cause!/The full_ness of the na_tions call;/lift up the stan_dard of your cross,/and all shall own you died for all. diff --git a/composeApp/src/commonMain/composeResources/files/ews-351-1.txt b/composeApp/src/commonMain/composeResources/files/ews-351-1.txt index c2890ae..67a4dcd 100644 --- a/composeApp/src/commonMain/composeResources/files/ews-351-1.txt +++ b/composeApp/src/commonMain/composeResources/files/ews-351-1.txt @@ -1,4 +1,4 @@ -M0:|c:C|m:4/4|a:Nils J. Holm (1778-1845); tr (st. 1): Carl Døving|h:Ludvig Mathias Lindeman (1812-1887) +M0:|c:C|m:4/4|a:Nils J. Holm (1778-1845); tr (st. 1): Carl Døving|h:Ludvig Mathias Lindeman (1812-1887)|t:EWS 351 How blessed is the little flock|r:86868886 U0:zC:46244624/44(22)(22)(22)8z4/46244624/4444(22)8z4/44444444/44444444/46244624/444448z4 N1:d'slsfmrmsld'-t-l-s/d'slsfmrmsld'tl-s/sltd'mfslfrmflsfmsld'ttd'm'r'md'lr'td' N2:msfrrdrdt,mm-r-r-r/drrmddt,drmdrr-r/ddrdddddrt,Drmrt,dmfffmmslSmflss diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-154.txt b/composeApp/src/commonMain/composeResources/files/ffpm-154.txt new file mode 100644 index 0000000..7b0b4d4 --- /dev/null +++ b/composeApp/src/commonMain/composeResources/files/ffpm-154.txt @@ -0,0 +1,11 @@ +M0:|c:D|m:6/4 Milantolanto|r:8.7.8.8.5.5.|t:FFPM 154 Izao Jesosy Tompontsika|a:C.Borchgrevink 1841-1919 +U0:z0:84848484/ 848484C/ ${$} 8484848${DS} 4/ 8484O/ 8484O +N1:#r mlsmdlsm/ ffmmrrr/ tsdsr'ffm/ llstd/ llstd +N2:#s, dtd6/ lrrdttt/ rtdmfrrd/ dfmfm/ dddss +N3:#m sfssffmf/ msfs4/ s8/ lddss/ ffmfm +N4:#f, drmdlfdd/ rtdms's's/#s, ffmdttdd/ffs'sd/f,f,ssd +Y1:I\zao Jesosy Tompontsika/Dia nasandratry ny Ray/Ao an-tsezam-panjakany:/${D$:I\zay rehetra ni_alany/}Vo_arainy\ indray/Vo_arainy\ indray +Y2:Tsy hadinony anefa/I\zay nilaozany tatỳ/Fa omeny ny Fanahy/${D$:Mba hitondra sy hitahy/}Ny mpia_nany/Ny mpia_nany +Y3:Ao anilan-dRainy Izy/Manam-boninahitra,/Ka midera Azy any/${D$:I\zay rehetra anjakany/}Eran-danitra/Eran-danitra +Y4:Tompom-pitsarana Izy/Samy mba hatsangany/Na ny ratsy na ny tsara/${D$:Ka homeny i\zay anjara/}Valin'asany/Valin'asany +Y5:He! ho hitantsika Izy/Dia ny tena endriny/Ka ny lova soa homena/${D$:I\zay nandray ny famonjena/}Vo_atendriny/Vo_atendriny diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-155.txt b/composeApp/src/commonMain/composeResources/files/ffpm-155.txt new file mode 100644 index 0000000..546f493 --- /dev/null +++ b/composeApp/src/commonMain/composeResources/files/ffpm-155.txt @@ -0,0 +1,17 @@ +M0:|c:G|m:4/4 Faingana|r:7.6.7.6|u:https://hymnary.org/tune/med_straale_krans_om_tinde_lindeman|t:FFPM 155 An-tsezam-panjakany|a:N.F.S. Grundtvig 1783-1872 nad. M.J. Meeg 1841-1919|h:Ludwig Mathias Lindeman 1812-1887 +Q0:${N:New}U0:zC:44444(44)4/46244C/4444482z2/(22)6244C +U0:zC:44444(44)2z2/46244C/4444482z2/(22)6244C +N1:ddrmds-s/lsmdmr/sfmrdd#s, t/l-smfrd +Q0:${N:New}N2:#m, mslsms-t/drtddt/dtdtlls/fwsslfm +N2:#m, mslsms-s/dddddt/dtdtlls/fwsslfm +Q0:${N:New}N3:#t, sddtdr-f/mrsmss/sssfmfr/ drmddts, +N3:#t, sddtdrfm/fs5/sssfmfr/ drmddts, +Q0:${N:New}N4:#m, dmfslt-r/ dtslms/m'rdslfs/ ltddfsd +N4:#m, dmfsltrd/ f'm'dm'ds/m'rdslfs/ ltddfsd +Y1:An-tsezam-panjakany/Ambony kintana/No lapan'i Jesosy/Ilay nasandratra +Y2:Atỳ an-tany iva/Anilam-pasana/No ipetrahantsika/Zo_im-pahoriana +Y3:Kanefa mety\ ihany/Ny monina atỳ/Hi_omana ho any/An-danitra arỳ +Y4:Isika tsy kamboty/Na dia nilaozany;/Nomeny ny Fanahy/Ho solon-tenany +Y5:Ny fahori_antsika/Dia efa maivana/Ny fa\hafantesantsika/Dia afa-tsindrona +Y6:Ny ain'i Jeso Tompo/I_ainantsika\ atỳ/Tsy ela dia hiseho/Indray ny tenany +Y7:Ka hira no venteso/Ry havany izao/Ny senton'alahelo/Mba atsaharonao! diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-157.txt b/composeApp/src/commonMain/composeResources/files/ffpm-157.txt new file mode 100644 index 0000000..fc50cbd --- /dev/null +++ b/composeApp/src/commonMain/composeResources/files/ffpm-157.txt @@ -0,0 +1,11 @@ +M0:|c:Eb|m:4/4 Marisidrisika|r:7.7.6.7.7.6|t:FFPM 157 Hobio ry tra-bonjy|a:Hans Adolf Brorson 1694-1764 nad. J. Johnson 1864-1916|h:Ludwig Mathias Linderman 1812-1887 +Q0:${N:New}U0:zC:44444(62)2z2/ 4444482z2/ 44444C/ 4444482z2/ 4444482z2/ 44444C +U0:zC:44444(62)2z2/ 4444482z2/ 444448z4/ 4444482z2/ 4444482z2/ 444448z4 +N1:sd'smdlws/ mfsmdmr/ sldtls/ rrmdrms/ lTTld'ss/ td'smrd +N2:#s, mmrdddrm/ drrsddt/ rmmrdt/ tltlssd/ drd5/ rdrsts +N3:#r dssslltd/ slrmmss/ sssFFr/ slSmrd, m/ ffmfffm/ fmrmfm +N4:#m, ddtdlfwd/ ddtdlss/ tdlrrs/ sfmltdT/ lssfldd/ sltdsd +Y1:Hobi_o, ry tra-bonjy/Fa indro ny Mpamonjy/Mi_akatra indray/Tsinjovy Izy any/Mandray ny fanjakany/Ao an-kavanan-dRay +Y2:Ny hiran'ny anjely/Manako sy mi_ely/Arỳ an-danitra;/Injay, ny Ray Tsitoha/Mi_arahaba ko_a/Mandray ny Zanaka +Y3:O, mi_aingà, ry foko/Fa aza mitoloko/Atỳ an-tany\ izao;/Mi_andrandrà, jere_o/I\lay vo_ahombo te_o!/Tsitoha Izy ao +Y4:Naharitra ny mafy/Ni_ady sy nihafy/Ny Tomponao tatỳ/Tahafonao izany,/Fa he! ny fanjakany/Mi_andry\ anao ery/ diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-160.txt b/composeApp/src/commonMain/composeResources/files/ffpm-160.txt new file mode 100644 index 0000000..dc2cca7 --- /dev/null +++ b/composeApp/src/commonMain/composeResources/files/ffpm-160.txt @@ -0,0 +1,10 @@ +M0:|c:D|m:D 4/4 Mientanentana|a:J. Andriantsiferanarivo 1928-1987|h:J. Andriantsiferanarivo 1928-1987|r:PM|t:FFPM 160 Kristy Mpanjaka +U0:z0:(44)4(y) (422)8/ 444(y) 88/ 444484/4 444(22) 88/ 8884/4 4(22)(42)2 Cz4 +N1:#r dtdtlswfm/ mmsfmmr/ mmFFss/ lttr'dtls/ ddll/ fmsdr'-dd +N2:#t, mfmfwmwrd/ dddrwdt/ ddddtt/ mrrsmrdt/ mmff/ rdmsfwmm +N3:#r swsltdwts/ ssmlwss/ ssrrrs/ ssstlsFs/ ssdd/ lssddtss +Q0:${N:New}N4:drmfwss, wd/ dddf, ws, s, / ddl, l, t, m/ dr4wrs, /ddff/ fsmdswdd +N4:drmfwss, wd/ dddf, ws, s, / ddl, l, t, m/ dr4wrs, /ddff/ fsmdssdd +Y1:Kristy Mpanjaka/Mendrika\ hoderaina/Izy no mitàna/Antsika\ ho velona\ aina/Derao, derao/Ilay Mpanjakanao! +Y2:Kristy Mpanjaka/Mendrika\ ho hajaina/Izy no mifona/Ho\ antsika novonjena/Hajao, hajao/Ilay Mpanjakanao! +Y3:Kristy Mpanjaka/Mendrika\ ho hobiana/Izy no hitsena/Ny olo-notahiana/Hobio, hobio/Ilay Mpanjakanao! diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-161.txt b/composeApp/src/commonMain/composeResources/files/ffpm-161.txt new file mode 100644 index 0000000..92d2e3a --- /dev/null +++ b/composeApp/src/commonMain/composeResources/files/ffpm-161.txt @@ -0,0 +1,10 @@ +M0:|c:A|m:3/4 Milamina|t:FFPM 161 Mivelatra eo imasoko|a:Ratovondrahety Rafihavanana 1919-|h:Ratovondrahety Rafihavanana 1919-|r:LMD +U0:z8:48484(44)48/4 8484(44)4$Q8/4 8484848/4 (44)484(44)4$Q8/4 84(44)4848/4 84(44)4848/4 84(44)44(44)8/4 8484(44)4$Q8 +N1:#s, sslsdmwrd/ sldsddtdr/ rrdtsdrm/ mmrdtddtls/ s4ltrdd/ ddddrms'ff/ mrdtwlswdm/ fmrdlsdtd +N2:#r, mmfmsswss/ sffmmFwFs/ tlFs5/ sFwfssFwfs/ s4ws4/ d4wd4/ sllswfmwfs/ lsfmrmsfm +N3:#t, d6mfm/ d6wdt/ r4tdtd/ ddwdrmmrdt/ t4drd3/ m4fsf3/ drrrwrmwdd/ ddtdddmrs, +N4:#d, ddddmswtd'/ mfldllwls/ sFrsfmsd'/ d'lwlsdrwrs/ s3fwfm3/ d'3TwTl3/ sfFsltdtls/fsslfswsd +Y1:Mivelatra\ eo imasoko,/Ny fiandri_anan-dehibe/Itoeran'ny Mpamonjiko,/Dia Jeso 'Lay nandresy re!/Fa niakatr'Izy ka nandao/'Ty tany fandalovana,/Mpanjaka ao an-dapany/Ka feno voninahitra. +Y2:Anjely no manotrona/Arahin'olo-masina:/Ireo dia mandohalika/Am-panajana fatratra./Ny Tompo\ eo afovo_any,/Mamiratra ny tavany,/Ka feno hasambarana/Izay mahazo taratra. +Y3:Kanefa tsy mipetraka/Ho endriky ny lanitra/'Lay Zanak'Andriamanitra/Fa miasa tsy mijanona./Renao va ny fifonany/Ho an'ny Fi_angonany/'Zay novidiny tamin-dRà,/Ka tiany hampakarina? +Y4:Ekeo, ry Fi_angonana\ ô!/'Lay hany Mpanalàlana,/'Zay mandohalika\ amin-dRay,/Ka mitomany ho anao!/Ry Tompo, aza sasatra,/Ifony lalandava e!/'Zahay izay navotanao,/Fa te-hankao an-danitra./ diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-163.txt b/composeApp/src/commonMain/composeResources/files/ffpm-163.txt new file mode 100644 index 0000000..7fdb83d --- /dev/null +++ b/composeApp/src/commonMain/composeResources/files/ffpm-163.txt @@ -0,0 +1,9 @@ +M0:|c:Eb|m:4/4 Faly|t:FFPM 163 He, Jesosy tokintsika|a:P. Nilsen Lund 1842-1914|h:P. Nilsen Lund 1842-1914|r:8787D +U0:z0:${x2} 62yy 88/ 62yy G/ 62yy (44)8/ 62yy G/ ${x0} +N1:ssfslsmd/ ffmrmfr/ mmsfmrfsl/ rrsmfrd/ d'stlsffm/ ffmrmfr/ mmsfmrfsl/ rrsmfrd/ +N2:#l, mmrmfmdl/ rrdtdrt/ dddtdrdmf/ ttmdrtd/ mmsfmrrd/ rrdtdrt/ dddtdrdmf/ ttmdrtd/ +N3:#r s7l/ s7/ s6ldd/ s5fm/ sd3s4/ s7/ s6ldd/ s5fm +N4:#f, d7f/ ttdtdds/ ddmrdtlsf/ s6d/ d5ttd/ ttdtdds/ ddmrdtlsf/ s6d +Y1:He, Jesosy tokintsika/Tompon'ny fi_ainana,/Tonga eto amintsika/Olon-kovangi_ana!/Izy no hitory teny/So_a, mahavelona!/Fa ny ainy no nomeny/Mba ho solovo_ina. +Y2:Andrandraonao ka andraso/Ny Mazava lehibe!/Dia Ilay tsy hita maso,/Mpanazava, Mpanome!/Fa ny ainao dia ho very/Raha tsy arahinao/I\lay Mpanjaka manan-kery,/I\zay nanavotra anao! +Y3:Eto afovo_antsika/I\lay Mazava tokana!/Sambatra izay mahita Azy/Fa ho velona!/Ry Jesosy, iresaho/Izahay mpi_anatrao!/Hafanao sy hatanjaho/Ny fino_anay Anao!/ diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-164.txt b/composeApp/src/commonMain/composeResources/files/ffpm-164.txt new file mode 100644 index 0000000..26e29fc --- /dev/null +++ b/composeApp/src/commonMain/composeResources/files/ffpm-164.txt @@ -0,0 +1,20 @@ +M0:|c:Ab|m:6/4|t:FFPM 164 Jesosy irery ihany|a:Ratovondrahety Rafihavanana 1919-|h:Ratovondrahety Rafihavanana 1919-|r:7676D +U0:z0:44484 C8/4 84(44)4 C444/ 44484 C8/4 84(44)4 C(44)4/ 44484 (84)8/4 (44)4(44)4 C444/ 44484 (84)(84)/ ${Rit...}444(44)4 $Q(4448) z4 +O1:S3:V1:mflswss +N1:#l, d5md/ drrtltdwww/ m5sm/ mffswsmwww/ d5mwd/ drwrtltdwww/ l5dwfw/ ${O:10}mrdrwrdwww +N2:#m, s5ds/ sllswsswww/ d7/ dttrwrdwww/ l6wl/ llwlswsslsf/ m5lwdt/ sldtltdwww +N3:m5sm/ mffrdrmwww/ s7/ s4wsswww/ m6wm/ mrwrrwrdwww/ d5fwfw/ drmfwfmwww +N4:d,5#r, dd/ mfrswsdsmr/ d5m'd/ dr'r'tltdsdt/ l5dtl/ sfmrswfmfmr/ d, d, tlsfmrw/ mflswsdsmd, +O1:v4:Nentin'i +O2:v4:Maizi +O3:v24:Nefa he +O4:v4:Ny\ anara +O5:v4:Ny o +O6:v24:Etỳ a\n +O7:v4:Ary ma\n +O8:v4:Mifo +O9:v24:JESOSY +O10:s3:mflswss +Y1:Jesosy\ irery\ ihany;/Filazantsara soa/${O:1}_3Nentin'ireo mpanompo,/Torina aminao./${O:2}_2Maizina avoko_a/Izao rehetr'izao/${O:3}_3Nefa he ny mazava/Naposaka\ aminao. +Y2:Jesosy\ irery\ ihany/No ivavahana./${O:4}_3Ny\ Anarany irery/no fanavotana./${O:5}_2Ny olona rehetra/no handohalika/${O:6}_3Etỳ an-tany ka hatrany an-danitra. +Y3:Jesosy tsy mi_ova/omaly sy anio./${O:7}_3Ary mandrakizay fa tsy mba mamitaka;/${O:8}_2Mifona ho antsika/Eo an-kavanan-dRay./${O:9}_3JESOSY\ IRERY\ IHANY/Re no isaorana! diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-165.txt b/composeApp/src/commonMain/composeResources/files/ffpm-165.txt new file mode 100644 index 0000000..ad14a25 --- /dev/null +++ b/composeApp/src/commonMain/composeResources/files/ffpm-165.txt @@ -0,0 +1,10 @@ +M0:|c:F|m:4/4|r:7.7.7.8.D|t:FFPM 165 Haleloia! Miderà! Asandrato|a:Dr. Jean P. Lamouroux 1794-1866 (mpandika: tsy fantatra)|h:BENEVENTO Samuel Webbe 1740-1816|u:https://hymnary.org/tune/benevento_webbe +U0:z0:444(22) 4(22)8/ 4(22)44 4(22)8/ 4(22)4(22) 4(22)(22)/22 4(22)44 (422)4z4/ 4444 (22)(22)8/ 4(22)44 4(22)8/ 4(22)4(22) 4(22)(22)/22 4(22)44 (422)4z4 +N1:d4wmwrd/ rrwrrfwmr/ mmwmrwsswsw/ ltd'mwmfrwwd/ sssstwwls/ rrwrrfwmr/ mmwmrwsswsw/ ltd'mwmfrwwd +N2:#s, sslswdtws/ ttwttrdwt/ sdwtltdfwmw/ mmmdwdddtwd/ tdrmrwdwt/ ttwttrdwt/ sdwtltdfwmw/ rfmdwdddtwd +N3:#m mmmswsfwm/ sswssssws/ d,mfslwsltdw/ drdtlsllsfm/sssssmFws/ssws4ws/dmfsl-sltd-/drdtlsllsfm +N4:#r, dtlmfsswd/ #s, s'fmrdtdws/ dlwsfwmrwdt/ #r, lSlsfmrswwd/ sltdr'wr'ws/ #s, s'fmrdtdws/ dlwsfwmrwdt/ #r, lSlsfmrswwd +Y1:Halelo_ia! miderà/Asandrato, re ny feo/Asandrato, re ny feo/Miderà ny Ray Tsitoha/'zay Mpamorona\ anareo/'zay Mpamorona\ anareo/Fa Mpanjaka manan-jo/Halelo_ia, Halelo_ia! +Y2:Halelo_ia! mihirà/Lehibe sy masina/Lehibe sy masina/'Lay Mpahary anare_o./Ao ny ranomasina/Ao ny ranomasina/Sy ny biby marobe/'Ndray mihoby: Halelo_ia! +Y3:Halelo_ia! mifalia/'Lay Mpamonjy be fitia/'Lay Mpamonjy be fitia/Sy Mpanavotra\ anare_o./O, ry olom-bery ô/O, ry olom-bery ô/Manatòna, mihobia/Halelo_ia, Halelo_ia! +Y4:Raiso re, ry Tompo ô,/Ny mpanota toa anay/Ny mpanota toa anay/'Zay miantoraka\ Amina_o./Mba henoy ny vavakay/Mba henoy ny vavakay/Ho fanatitra madio/'Zay atolotray ani_o!//// diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-170.txt b/composeApp/src/commonMain/composeResources/files/ffpm-170.txt new file mode 100644 index 0000000..d778267 --- /dev/null +++ b/composeApp/src/commonMain/composeResources/files/ffpm-170.txt @@ -0,0 +1,10 @@ +M0:|c:Bb|m:6/4|r:8.6.8 6.5.8.5.6|t:FFPM 170 Ry Jeso, ny fitiavanao|a:Rasoahaingo|h:Ira David Sankey 1840-1908|u:https://hymnary.org/tune/our_junior_band_is_marching_on_sankey +U0:zK:4 84(44)4 848/4 8484 (C8) /4 84(44)4 848/4 8484 (CC) / 8(44)4 C8/4 8484 84C/ C(44)4 C$Q8/4 8484 K +N1:#m, sddmfsllr/ dtltlls/ sddmfsllr/ dtsltrd/ #s, mdrmff/ mrDrsdrm/ mdrmfl/ rddmrd +N2:#d, mmmdrmfff/ lf5m/ mmmdrmfff/ lssfffm/ smfsll/ s8/ smfsll/ lsssfm +N3:#s, dssswdddr/ rrdrtdw/ dssswdddr/ rrtdrtd/ ddwddd/dtTttdtd/ ddwddf/ fmmdtd +N4:#d, d4wdffr/ Fs4dw/ d4wdffr/ Fs5d/ #r, ddwdff/ d, s3fmsd/ ddwdff/ fs4d, +Y1:Ry Jeso, ny fitiavanao/No ifali_anay,/Fa vo_avono I_anao/Hisolo voina\ anay!/${R=}Mba raisonao re/Ny saotra\ aterinay izao,/Ho fanajana/Anao Mpamonjy tia! +Y2:Mahery ny fitiavanao/Ka itoki_anay;/Izay mikambana\ Aminao/Dia tsy hanga_ihay +Y3:Ambony ny fitiavanao/Ka tsy mba takatray!/Kanefa no\ho ny herinao/Hi_ezaka\ izahay +Y4:Hi_ezaka\ izahay, Jeso,/Ka mba ho tia Anao,/Ka tsy hatahotra\ eso koa/Noho ny Aminao!/ diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-172-1.txt b/composeApp/src/commonMain/composeResources/files/ffpm-172-1.txt new file mode 100644 index 0000000..920bd35 --- /dev/null +++ b/composeApp/src/commonMain/composeResources/files/ffpm-172-1.txt @@ -0,0 +1,11 @@ +M0:|c:G|m:4/4 Matotra|r:8.7.8.7.D|t:FFPM 172 (1) Hoderaiko lalandava|a:George Henry Peake 1870-1955|h:HYMN TO JOY Ludwig van Beethoven 1770-1827|u:https://hymnary.org/tune/hymn_to_joy_beethoven +U0:z0:44444444/ 4444628/ 44444444/ 44(22)44(22)8/ 44444(22)44/ 4(22)44444/(224) 444 444(22)/ 4(22)444(22)8 +Q0:${N:New}N1:mmfssfmr/ ddrmmrr/ mmfssfmr/ ddrwmrwdd/ rrmdrmfmd/ rmfmrd rs, /mwwmfssfmrw/ ddwrmrwdd +Q0:${N:New}N2:#m, s5lss/ ssfmsss/ s4lltt/ lsfwmswfm/ ttsddtwss/ lswsssFs/ swwsdtllSlt/ lsFsslfwm +N1:mmfssfmr/ ddrmmrr/ mmfssfmr/ ddrwmrwdd/ rrmdrmfmd/ rmfmrd rs, /mwmmfssfmrw/ ddwrmrwdd +N2:#m, s5lss/ ssfmsss/ s4lltt/ lsfwmswfm/ ttsddtwss/ lswsssFs/ swssdtllSlt/ lsFsslfwm +N3:#l, ddtd4t/ ddtddtt/ ddtddrsf/ mdltddtwd/ ttdssrwdd/ dtwdfmrt/ drmd5tmw/ mrwtddtwd +N4:#d, ddrmmfsf/ mmrdsss/ ddrmf4/ ssswssswd/ ssd'msswd'm/ fswd'tlrs/ ltd'tlmfrmFS/ lrwsmfswd' +Y1:Hoderaiko lalandava/Jeso 'Lay Mpanavotro!/No\ho ny fiti_avana\ ahy,/Maty mba ho soloko./${R=}Hoderaiko, hoderaiko/Fa ny rany masina/Nentiny hanavotra\ ahy:/Afaka ny heloko! +Y2:Holazaiko lalandava/Ny tantara mamiko,/Zay nitadi_avana\ ahy/Very no\ho ny heloko! +Y3:Hohiraiko lalandava/'Zao ny voninahiny,/Fa ny fa\hafatesana\ aza/Resy no\ho ny heriny!/ diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-172-2.txt b/composeApp/src/commonMain/composeResources/files/ffpm-172-2.txt new file mode 100644 index 0000000..433185d --- /dev/null +++ b/composeApp/src/commonMain/composeResources/files/ffpm-172-2.txt @@ -0,0 +1,10 @@ +M0:|c:G|m:3/4|t:FFPM 172 (2) Hoderaiko lalandava|a:George Henry Peake 1870-1955|h:HARWELL Lowell Mason 1792-1872|r:8787D|u:https://hymnary.org/tune/harwell_mason +U0:z8:y 6222 44/y 6222 ${DC}8/y y2222 44/22 y2222 (44)/y 4422 44/y 6222 8 +N1:#s, ssdsdmrr/#d sssdmrd/ zzfmrmfsfr/ zzsfmfslsm/ s, s, dddmrr/ sssdmrd +N2:#m, mmsssdtt/ ttdsstd/ #s,zzrdtdrmrt/ zzmrdrmfmd/ s5dtt/ ttdsstd +N3:ddmms4/ rrmmsfm/ ssswws5/ dddwwd4w/ m4s4/ rrmmsfm +N4:#s, d4mdss/ ssdm,ssd/ s3wws5/ d3wdwd3w/ d4mdss/ ssddssd +O1:v34:Hoderai_ko_hoderaiko, Fa ny ra_ny_ masina +Y1:Hoderaiko lalandava/Jeso 'Lay Mpanavotro!/${D:No\ho ny fiti_avana\ ahy,/Maty mba ho soloko./}${R=}${O:1}__Hoderaiko, hoderaiko/__Fa ny rany masina/Nentiny hanavotra\ ahy:/Afaka ny heloko! +Y2:Holazaiko lalandava/Ny tantara mamiko,/${D:Zay nitadi_avana\ ahy/Very no\ho ny heloko!} +Y3:Hohiraiko lalandava/'Zao ny voninahiny,/${D:Fa ny fa\hafatesana\ aza/Resy no\ho ny heriny!/} diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-175.txt b/composeApp/src/commonMain/composeResources/files/ffpm-175.txt new file mode 100644 index 0000000..8e28404 --- /dev/null +++ b/composeApp/src/commonMain/composeResources/files/ffpm-175.txt @@ -0,0 +1,16 @@ +Q0:${N:New}M0:|c:F|m:4/4 Milantolanto|r:6.6.8.6|a:James Montgomery 1771-1854 nad. J.A. Houlder 1844-1932|t:FFPM 175 Avia Fanahy ô, Fanahy Masina ô|h:ZURICH Hans George Nageli 1773-1836|u:https://hymnary.org/tune/zurich_nageli +M0:|c:F|m:3/4|r:6.6.8.6|a:James Montgomery 1771-1854 nad. J.A. Houlder 1844-1932|t:FFPM 175 Avia Fanahy ô, Fanahy Masina ô|h:ZURICH Hans George Nageli 1773-1836|u:https://hymnary.org/tune/zurich_nageli +Q0:${N:New}U0:zC:(22) 6244 (84)/(22) 6244 C/4 6244 624/4 6244 C +U0:z8:(22) y44 (44)/(22) y44 8/4 6222 622/2 y44 8 +N1:drmmfmmr/ mrddrsm/ slsfmsfm/ rdrmrd +Q0:${N:New}N2:#t, dwddrddt/ twdddtd/ ddtd5/ td3td +N2:#t, dwddrddt/ twdddtd/ mfrd5/ td3td +Q0:${N:New}N3:mfs5w/ sfmmsss/ mfrlssls/ fmlsfm +N3:mfs5w/ sfmmsss/ d'd'tlssls/ fmlsfm +N4:#m, dwddtdsw/ swllssd/ dfsldmfs/ slfssd +Y1:Avia, Fanahy ô,/Fanahy Masina\ ô!/Midìna eto aminay/Hitari-dalana. +Y2:Fa diso làlana/Ka ory izahay;/Ny sainay di_a maizina,/Ny fonay ratsy koa. +Y3:Midìna Hi_anao,/Ry Mpanazava\ anay,/Hanaisotra ny aizina/Atỳ anatinay! +Y4:Avia Mpananatra\ ô!/Mombà anay tokoa;/Ampahatsi_arovinao!/Ny teny mahasoa, +Y5:Ry Mpampi_anatra\ ô!/Ampionao izahay/Ka aoka re ho marina/I\zay i_anaranay! +Y6:Mitomo_era\ atỳ/Anatin'ny fonay;/Izany\ indrindra Tompo ô,/No angatahinay! diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-20.txt b/composeApp/src/commonMain/composeResources/files/ffpm-20.txt new file mode 100644 index 0000000..9f65a5b --- /dev/null +++ b/composeApp/src/commonMain/composeResources/files/ffpm-20.txt @@ -0,0 +1,8 @@ +M0:|h:ARIZONA Robert Henry Earnshaw (1856-1929)|c:F|m:3/4|t:FFPM 20 Tsaroanay tooka izao|a:Daniel Owen Jones 1880-1951|r:LM +I0:ews-33.txt:^(E|M|N4) +N4:dddl,l,t,-s,dfmrd-df,l,s,ddt,l,ddfmrs,dt,d(f,)-s,-s,d +Y1:Tsaro_anay tokoa izao/Ny so_a be noraisinay/Tsy tapaka\ avy Taminao,/Ry Andriananaharinay! +Y2:Ny lasa itodihana/Dia mampiseho avokoa/Ny tanam-piti_avana/Mi_ahy sady manasoa! +Y3:He koa ‘tỳ andronay itỳ/Izay di_avinay izao,/Dia voahodidina erỳ/Ny fitahi_ana\ Aminao! +Y4:Dia tokinay tokoa izay/Fa mbola ho arovanao/Anio, ampitso, ra\hatrizay,/Izay mi_ankina\ Aminao! +Y5:Ka di_a mba velomy re/Atỳ anatinay ny fo/Hahay misaotra\ Anao anie,/Ry Rainay be famindram-po! diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-54.txt b/composeApp/src/commonMain/composeResources/files/ffpm-54.txt index 7696b13..1e4c741 100644 --- a/composeApp/src/commonMain/composeResources/files/ffpm-54.txt +++ b/composeApp/src/commonMain/composeResources/files/ffpm-54.txt @@ -1,6 +1,6 @@ M0:|h:J Neander, 1650-1680|c:G|m:3/4|a:L. Stueland 1843-1930|r:14.14.4.7.8|t:FFPM 54 Jeso Mpamonjy, Ilay Tompon'ny aina -U0:z0:4444(22)4444444(444)C/444444444444(444)C/444C/4444(22)4C/444444(444)C -N1:ddsm-rdt,l,s,l,t,dr--dddsmrdt,l,s,l,t,dr--dssslmfss-fmrs,l,t,drmr----d +U0:z0:4444(22)4444444(444)8z4/444444444444(444)8z4/444C/4444(22)4C/444444(444)C +N1:ddsm-rdt,l,s,l,t,dr--dddsmrdt,l,s,l,t,dr--dssslmfss-fmrs,l,t,drmr--d N2:s,l,s,dt,-l,s,f,m,f,f,s,l,s,f,m,#m, mfssfmFFsssslsfm/dtdd/ddsddtdt/sssstddt-s N3:mmrss-mmdddrddt,-d/#t, dddttdrdtdrddt-d/mfsf/sfrmf-ss/tdrmfslsfm N4:dl,t,ds,-l,m,f,d,f,r,m,f,s,-d,/ #d, lfmsSlrrssfmfs-d/#s,drmf/dltdr-ds/#d, ssfmrdfs-d diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-58.txt b/composeApp/src/commonMain/composeResources/files/ffpm-58.txt new file mode 100644 index 0000000..f5eb993 --- /dev/null +++ b/composeApp/src/commonMain/composeResources/files/ffpm-58.txt @@ -0,0 +1,10 @@ +M0:|c:Bb|m:6/4 Mangingina|t:FFPM 58 Alina masina|a:Joseph Mohr 1792-1848 nad. L. Dahle 1843-1925|h:STILLE NACHT Franz Xaver Gruber 1787-1863|r:678966 +Q0:${N:New}U0:z0:(62)4C (62)4C/ 8484 84C/ 84624(62)4C/ 84624 624C/ 84624 (CC) (62)4624 O +U0:z0:(62)4C (62)4C/ 8484 84C/ 84624(62)4C/ 84624 624C/ 84624 (CC) (62)4624 Kz4 +N1:#m slsmslsm/rrttdds/lldtlslsm/lldtlslsm/rrf'rtdm'/dsmsfr,d, +N2:#t, mfmdmfmd/ffffmmm/fflsfr-rm/fflsfrrrm/s6m/m-dtttd +N3:#m d-dsd-ds/ttrrssd/d5r-sd/d5rrsd/t4rds/s-sr,sfm +N4:#s, d-ddd-dd/s4ddd/f5t-td/f5tttd/s'4fmd/s-s4d +Y1:Alina masina,/Tonga ny Mpanavotra;/Indro teraka\ ao Bethlehe\ma/Ny Mpanjakan’i Jerosale\ma,/I\zay Mpamonjy anao I\zay Mpamonjy anao +Y2:Alina masina,/Ny anjely midina/Ka mi_ara-mihoby hoe:/Indro ny fi_ada_nam-be,/Jeso teraka\ izao Jeso teraka\ izao +Y3:Alina masina,/Nisehoan’ny Zanaka;/Ny mazava niposaka,/Ka ny tahotra a_faka;/Mifali_a izao Mifali_a izao diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-71.txt b/composeApp/src/commonMain/composeResources/files/ffpm-71.txt new file mode 100644 index 0000000..8d7c656 --- /dev/null +++ b/composeApp/src/commonMain/composeResources/files/ffpm-71.txt @@ -0,0 +1,11 @@ +M0:|c:Bb|m:6/4 Miadana be|t:FFPM 71 Mihainoa, mihainoa|a:Joseph Mohr 1792-1848 Anglikana|h:STILLE NACHT Franz Xaver Gruber 1787-1863|r:678855 +U0:z0:(62)4C (62)48/ 48484 848/ 484(62)4(62)48/ 484(62)4 (62)4C/ 84(44)4 (CC) /(62)484 O +N1:#m, slsmslsm/mrrttdds/slldtlslsm/mlldtlslsm/rrf'rtdm'/dsmsfm +Q0:${N:New}N2:#t,, mfmdmfmd/mffffmmm/mfflsfmfmd/dfflsfmfmd/fff-fm-/m-dttd +N2:#t,, mfmdmfmm/mffffmmm/mfflsfmfmd/dfflsfmfmd/fff-fm-/m-dttd +N3:#m, d-ddd-dd/dttrrddd/d4-dd-dd/d4-dd-dd/t3-rds/d-drrd +N4:#d, d-ddd-dd/ds4ddd/dfff-fd-dd/dfff-fd-dd/s3-sd-/d-dssd +Y1:Mihainoa, mihainoa/Ny feon’anjely sambatra/Milaza fa vao teraka/Ny Zanak’Andriamanitra!/Mihainoa izao!/Mihainoa izao! +Y2:Mifalia, mifalia/Ry zanak’olombelona/Fa tonga\ Ilay Mpanavotra/Antsika\ izay nifatotra!/Mifalia izao!/Mifalia izao! +Y3:Mba omeo, mba omeo/Ny fonao fa\ angatahiny!/Ny tenany natolony/Anao izay malalany!/Mba omeo izao!/Mba omeo izao! +Y4:Matokia, matokia/Ka manaraha Azy\ izao,/Ilay Mpamonjy be fitia/Nanetry tena ho anao!/Matokia izao!/Matokia izao! diff --git a/composeApp/src/commonMain/composeResources/files/ffpm-760.txt b/composeApp/src/commonMain/composeResources/files/ffpm-760.txt index 0fa3a8f..a7dff4d 100644 --- a/composeApp/src/commonMain/composeResources/files/ffpm-760.txt +++ b/composeApp/src/commonMain/composeResources/files/ffpm-760.txt @@ -1,6 +1,6 @@ M0:|c:A|m:6/4|t:FFPM 760 Aza Mba Manadino|a:J. Richardson 1844-1922|h:(Old. St. Co., p. 71)|r:P.M. U0:z0:444(44)4 C84 8484 K/4 84(44)4 C84 8484 K/4 8484 C84 8484 Kz4/ 444(44)4 C84 8484 Kz4/ ${p}4448z4 ${f}4448z4 /${ff}44484 8484 8484 O -N1:#s,m4-rdldsdmdr/rmmm-rdldtdmrd/drrrmfrrsmdmr/m4-rdldtdmrd/r4m4/fffmml's'frtdmrd +N1:#s,m4-rdldsdmdr/rmmm-rdldtdmrd/drrrmfrrs'mdmr/m4-rdldtdmrd/r4m4/fffmml's'frtdmrd N2:#f,sssd-tlfls5/sssd-tlfls5/dtttdrttd4t/sssd-tlfls5/s8/d8ls5 N3:#t,d4-d8t/tddd-d3frmsfm/ms12/d4-d3frmsfm/t4d4/d5fslfrmsfm N4:#d,d4rmfffmmdms/sdddrmfffs4d'/d's7mmmds/d4rmfffs4d/s4d4/l3ssfmffs4d diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/FileRepository.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/FileRepository.kt index a7af635..d04e5c8 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/FileRepository.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/FileRepository.kt @@ -5,6 +5,8 @@ import feufaro.composeapp.generated.resources.Res import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import java.io.File +import java.io.OutputStream +import java.io.FileOutputStream // Définissez une expect interface. Elle spécifie le contrat de votre repository. // Utilisez 'expect interface' car l'implémentation (actual) variera selon la plateforme. @@ -14,11 +16,16 @@ interface FileRepository { // Lecture de fichier entier en tant que String suspend fun readFileContent(filePath: String): String + suspend fun getOutputStream(filePath: String): OutputStream } // This is just a regular class that implements the common 'FileRepository' interface. // It is NOT an 'actual' declaration of 'FileRepository'. class CommonFileRepository : FileRepository { // IMPORTS AND IMPLEMENTS THE commonMain 'FileRepository' interface + override suspend fun getOutputStream(filePath: String): OutputStream { + val outputFile = File(filePath) + return FileOutputStream(outputFile) + } override suspend fun readFileLines(filePath: String): List = withContext(Dispatchers.IO) { try { when { diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/midi/MidiPitch.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/midi/MidiPitch.kt new file mode 100644 index 0000000..346f89d --- /dev/null +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/midi/MidiPitch.kt @@ -0,0 +1,54 @@ +package mg.dot.feufaro.midi + +import mg.dot.feufaro.solfa.Transpose + + +data class MidiPitch ( + var voiceNumber: Int = 0, + var octave: Int = 0, + var pitch: String = "", + var alter: String = "", + var duration: Int = 0, + var markers: List = listOf(), + var tick : Int = 0 +) { + var velocity: Int = 96 + companion object { + var key: String = "C" + var curVoiceNumber: Int = 0 + var nextTick : MutableList = mutableListOf() + } + fun setNote(note: String, theDuration: Int) { + val midiPitch = Transpose.transposeToMidi(note, key, "C") + if (midiPitch < 0) { + velocity = 0 + } else { + velocity = 99 + } + pitch = midiPitch.toString() + duration = theDuration + tick = nextTick[voiceNumber] + nextTick[voiceNumber] = theDuration + tick + voiceNumber = curVoiceNumber + } + fun setMarker(theMarkers : MutableList) { + if (theMarkers.isNotEmpty()) { + markers = theMarkers.toList() + } else { + markers = listOf() + } + } + fun currentVoiceNumber(value: Int) { + curVoiceNumber = value + while (nextTick.size <= value) { + nextTick.add(0) + } + } + fun initKey(theKey: String) { + key = theKey + } + fun reset() { + tick = 0 + nextTick.clear() + } +} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/midi/MidiWriterKotlin.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/midi/MidiWriterKotlin.kt new file mode 100644 index 0000000..2d166cf --- /dev/null +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/midi/MidiWriterKotlin.kt @@ -0,0 +1,56 @@ +package mg.dot.feufaro.midi + +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import mg.dot.feufaro.FileRepository +import javax.sound.midi.* + +class MidiWriterKotlin (private val fileRepository: FileRepository) { + private val sequence = Sequence(Sequence.PPQ, 60) + private val track = sequence.createTrack() + private var tick: Long = 0 + private var nextTick: MutableList = mutableListOf() + private val noteOn = ShortMessage() + private val noteOff = ShortMessage() + private val lastPitch : MutableList = mutableListOf() + fun addNote( voiceNumber: Int, note: Int, velocity: Int, tick: Long) { + var note = note + if (voiceNumber == 3 || voiceNumber == 4) { + note -= 12 + } + if (lastPitch.size > voiceNumber && lastPitch[voiceNumber] > 0) { + noteOff.setMessage(ShortMessage.NOTE_OFF, voiceNumber - 1, lastPitch[voiceNumber], 0) + val n2 = noteOff.clone() as MidiMessage + track.add(MidiEvent(n2, tick)) + } + var velocity = velocity + if (note <= 0) { + note = 40 + velocity = 0 + } + noteOn.setMessage(ShortMessage.NOTE_ON, voiceNumber - 1, note, velocity) + val n1: MidiMessage = noteOn.clone() as MidiMessage + track.add(MidiEvent(n1, tick)) + while(lastPitch.size <= voiceNumber) { + lastPitch.add(0) + } + lastPitch[voiceNumber] = note + } + fun save(filePath: String) { + val parseScope = CoroutineScope(Dispatchers.Default) + parseScope.launch { + val out = fileRepository.getOutputStream(filePath) + MidiSystem.write(sequence, 1, out) + out.close() + } + } + fun process(pitches: List) { + val lastTick = 0 + nextTick.clear() + tick = 0 + pitches.forEach { + addNote(it.voiceNumber, it.pitch.toInt(), 100, it.tick.toLong()) + } + } +} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/musicXML/MXPitch.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/musicXML/MXPitch.kt index a0eaf5e..4754cf8 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/musicXML/MXPitch.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/musicXML/MXPitch.kt @@ -44,6 +44,6 @@ var unpitched: String? = null, } fun toKey(key: String, numPart: Int): String { if (unpitched != null) return "z" - return Transpose.transpose(toCNote(numPart), "C", key, alter ?: 0, true) + return Transpose.transpose(toCNote(numPart), "C", key, alter ?: 0) } } diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/musicXML/MusicXML.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/musicXML/MusicXML.kt index d6cfc0c..752d9cf 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/musicXML/MusicXML.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/musicXML/MusicXML.kt @@ -7,8 +7,6 @@ import kotlinx.serialization.decodeFromString import kotlinx.serialization.modules.SerializersModule import mg.dot.feufaro.FileRepository import nl.adaptivity.xmlutil.serialization.XML -import nl.adaptivity.xmlutil.serialization.XmlParsingException -import java.util.Locale import java.util.Locale.getDefault import kotlin.math.max @@ -82,7 +80,7 @@ class MusicXML(private val fileRepository: FileRepository) { } } suspend fun load() { - val xmlContent = fileRepository.readFileContent("assets://24.xml") + val xmlContent = fileRepository.readFileContent("assets://31.xml") val xslContent = fileRepository.readFileContent("assets://timepart.xsl") xmlString = performXsltTransformation(xmlContent, xslContent) val solfaXML = SolfaXML() diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Note.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Note.kt index 7502065..713a7f0 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Note.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Note.kt @@ -2,7 +2,6 @@ package mg.dot.feufaro.solfa class Note (val note: String, private var separator: String= "") { - private var duration: Int = 0 var marker: MutableList = mutableListOf() var markerBefore: String = "" fun addMarker(newMarker: String) { @@ -12,6 +11,9 @@ class Note (val note: String, private var separator: String= "") { fun setMarkers(newMarkers: MutableList) { marker = newMarkers } + fun hasMarker(symbol: String): Boolean { + return marker.contains(symbol) + } fun markBefore(newMarker: String) { markerBefore += newMarker } diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt index 2e105a4..ac36829 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt @@ -6,8 +6,12 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import mg.dot.feufaro.FileRepository +import mg.dot.feufaro.midi.MidiPitch +import mg.dot.feufaro.midi.MidiWriterKotlin //todo: split voices (ffpm19/ews22) ${S:mfs} in N4: +//@todo: ffpm-172-2 ${O:1} non fonctionnel +//@todo: ffpm-164.txt O10:s3:mflswss // alternative notes for stanza 3 only class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository: FileRepository) { private val T: MutableList = mutableListOf() @@ -17,6 +21,7 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository private val unparsedNote = mutableListOf() private var refrainBeginsAt = -1 private var smartLyricsType = "L" + private val pitches = mutableListOf() companion object { var currentFile = "" val REGEX_SHIFT_PAREN_UPWARD = Regex("([^a-yA-Y\\(\\[]+)([\\)\\]])") @@ -28,7 +33,7 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository val REGEX_TEMPLATE_COMMENT = Regex("(\\$[A-Z]|\\$\\{[^\\}]*\\})") val REGEX_REPETITION = Regex("([zwdrmfslt-](?>[',]*))([1-9][0-9]*)", RegexOption.IGNORE_CASE) val REGEX_PARSE_META = Regex("\\|(?=[a-z]:)") - val REGEX_LYRICS_COMMENT = Regex("\\$\\{([^\\}]:([^\\}]*))\\}|\\$\\{R!\\}") + val REGEX_LYRICS_COMMENT = Regex("\\$\\{([^\\}][^:]*:([^\\}]*))\\}|\\$\\{R!\\}") val REGEX_LYRICS_REPETITION = Regex("_(\\d)") val REGEX_VOWELS_STAGE1 = Regex("[aeiouyòàéìỳ](?![,;\\.\\-:!\\?\\}»_\"]*([ aeiouyòàéìỳ/]|_[1-9]))", RegexOption.IGNORE_CASE) val REGEX_VOWELS_STAGE2 = Regex("(?<=[aeiouyòàéìỳ])_([,;\\.\\-:!\\?\\}»_\"]+)", RegexOption.IGNORE_CASE) @@ -37,7 +42,7 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository val REGEX_MALAGASY_MN_STAGE2 = Regex("_([mn])-") val REGEX_PAREN_RECURSIVE = Regex("(\\([^\\(\\)]*)\\(([^\\)]*)\\)") val REGEX_COMMENT = Regex("\\$\\{[^\\}]*\\}") - val REGEX_STRIP_DC = Regex("\\$\\{D:[^\\}]*\\}") + val REGEX_STRIP_DC = Regex("\\$\\{D[^:]*:[^\\}]*\\}") } var nextTIndex: Int = -1 var nextNIndex: Int = -1 @@ -131,6 +136,10 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository T.clear() N.clear() L.clear() + if (pitches.isNotEmpty()) { + pitches[0].reset() + } + pitches.clear() refrainBeginsAt = -1 unparsedNote.clear() templateString = "" @@ -156,6 +165,11 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository } catch (e: Exception) { println("Erreur parseScope Solfa:150 : ${e.message} iter: ${TimeUnitObject.nbBlock}") } + val pitches = pitches.sortedWith( compareBy({it.tick}, {it.voiceNumber})) + val k = MidiWriterKotlin(fileRepository) + k.process(pitches) + k.save("whawyd3.mid") + } } private fun rearrangeNote(noteString: String, infiniteIter: Int = 0): String { @@ -179,7 +193,12 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository } private fun preloadN(noteLine: String) { val voiceNumber = noteLine.substring(0, 1).toInt() - val templateStripped = REGEX_TEMPLATE_COMMENT.replace(templateString, "") + val templateComments = mutableListOf() + val templateStripped = REGEX_TEMPLATE_COMMENT.replace(templateString) { + matchResult -> + templateComments.add(matchResult.value) + "&" + } val templateCharArray = templateStripped.toCharArray() val noteLine = noteLine.replace(REGEX_TEMPLATE_COMMENT, "") .replace(" ", "") @@ -230,7 +249,7 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository .replace(",'", "") .replace("',", "") - val noteCharIterator = noteChar2.toCharArray().iterator() + val noteCharIterator = noteChar2.replace("/", "").toCharArray().iterator() var result = "" var firstInLoop = true var replacement : Char = 'x' @@ -255,14 +274,15 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository } } } - '/', '-', 'z', 'Z', 'w' -> {} + 'w', '-' -> result += "~" + 'z', 'Z' -> result += "@" ',' -> result += ";" else -> result += it } } result = result.replace("w", "-") result = rearrangeNote(result) - loadN(voiceNumber, result) + loadN(voiceNumber, result, templateComments) } private suspend fun parseOneLine(line: String) { val index: Int @@ -342,17 +362,70 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository sharedScreenModel.setSongComposer(meta["h"] ?: "") sharedScreenModel.setSongRhythm(meta["r"] ?: "") } - private fun loadN(voiceNumber: Int, line: String) { + private fun loadN(voiceNumber: Int, line: String, templateComments: MutableList) { + val midiPitch = MidiPitch(voiceNumber) + midiPitch.currentVoiceNumber(voiceNumber) + midiPitch.initKey(meta["C"] ?: "C") + var midiDuration = 0 + var nextDuration = 0 + var lastNoteString = "" + var lastIt = ' ' val newN = POneVoiceNote() val lineRepeated = REGEX_REPETITION.replace(line) { matchResult -> val (charIterated, iteration) = matchResult.destructured val nTimes = iteration.toInt() charIterated.repeat(nTimes) } + var commentNumber = -1 + var nextComment: MutableList = mutableListOf() + fun pushMidi() { + if (midiDuration > 0) { + midiPitch.setNote(lastNoteString, midiDuration) + pitches.add(midiPitch.copy()) + midiPitch.setMarker(nextComment) + } + lastNoteString = "" + midiDuration = 0 + nextComment = mutableListOf() + } val lineChar = lineRepeated.toCharArray() lineChar.forEach { when (it) { - '\'', ',' -> newN.appendLastNote(it) + '|', ':', '!', '/' -> { + if (lastIt == '|' || lastIt == ':' || lastIt == '!' || lastIt == '/') {} else { + midiDuration += nextDuration + nextDuration = 60 + } + } + '.' -> { + if (lastIt == ';') { + pushMidi() + lastNoteString = "z" + midiDuration = 15 + nextDuration = 30 + } + midiDuration += nextDuration - 30 + nextDuration = 30 + } + ';' -> { + if (lastIt == '.') { + pushMidi() + lastNoteString = "z" + midiDuration = 15 + nextDuration = 15 + } + if (nextDuration >= 45) { + midiDuration += nextDuration - 45 + nextDuration = 45 + } else { + midiDuration += nextDuration - 15 + nextDuration = 15 + } + } + '\'', ',' -> { + newN.appendLastNote(it) + lastNoteString += it + } '(', '[' -> newN.addNextMarker(it) ')', ']' -> newN.appendLastMarker(it) 'd', 'r', 'm', 'f', 's', 'l', 't', @@ -367,13 +440,52 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository noteString += "a" } newN.addItem(noteString) + when (noteString) { + "-" -> { + midiDuration += nextDuration + nextDuration = 0 + } + "z", "@" -> { + if (lastNoteString == "z") { + midiDuration += nextDuration + nextDuration = 0 + } else { + pushMidi() + //noteString = + } + lastNoteString = "z" + } + "'", "(", ")", "[", "]", "," -> {} + else -> { + pushMidi() + lastNoteString = noteString + } + } + } + '@' -> { + if (lastNoteString == "z") { + midiDuration += nextDuration + } else { + pushMidi() + } + lastNoteString = "z" + } + 'i', 'a' -> + lastNoteString += it + '&' -> { + commentNumber ++ + nextComment.add(templateComments[commentNumber]) } } + lastIt = it } + pushMidi() /*if (voiceNumber == 1) { N.add(0, POneVoiceNote()) }*/ N.addWithPadding(voiceNumber, newN) + midiPitch.setNote("z", 0) + pitches.add(midiPitch.copy()) } private fun loadT(line: String) { templateString = line @@ -537,10 +649,14 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository val lyricsIterator = lyricsComment.iterator() while (lyricsIterator.hasNext()) { var item = lyricsIterator.next() + var positionDS = 0 // @todo: if item == ${O:...} // ${D:xxx} lyrics of DC and DSs - if (item.substring(0, 4) == $$"${D:") { + val isDS = Regex("^\\$\\{D([^:]*):").find(item) + if (isDS != null) { item = item.replace(REGEX_LYRICS_COMMENT, "$2") + val signDS = isDS.groupValues[1] + //todo: calculate positionDS val item = when (smartLyricsType) { "E" -> smartELyrics(item) "Y" -> smartYLyrics(item) @@ -550,7 +666,7 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository .addHyphens() .split(Regex("[_/]")) .forEachIndexed { i, xval -> - appendLyricsItem(stanzaNumber, i, xval) + appendLyricsItem(stanzaNumber, i + positionDS, xval) } lyricsIterator.remove() } diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/TUNote.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/TUNote.kt index b449bbf..8aa1e30 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/TUNote.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/TUNote.kt @@ -66,7 +66,7 @@ class TUNote (private val detailNote: MutableList = mutableListOf()){ .replace(".", "\u2022") .replace("z", "") if ((fromKey != "") && (toKey != "")) { - result = ">" + Transpose.transpose(result, fromKey, toKey) + ">" + result + result = ">" + Transpose.transposeToSolfa(result, fromKey, toKey) + ">" + result } return result } diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/TimeUnitObject.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/TimeUnitObject.kt index da9f90d..ef5a1f0 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/TimeUnitObject.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/TimeUnitObject.kt @@ -54,7 +54,6 @@ class TimeUnitObject (val pTemplate: PTemplate, val prevTUO: TimeUnitObject?, co private var annotated : Boolean var transposeNewKey: String = "" var transposeOldKey: String = "" - companion object { var nbBlock: Int = 0 var sep1: String = "" @@ -85,9 +84,6 @@ class TimeUnitObject (val pTemplate: PTemplate, val prevTUO: TimeUnitObject?, co init { nbBlock++ numBlock = nbBlock - if (sep1 == "") { - println("Première fois : $numBlock") - } sep0 = sep1 sep1 = pTemplate.separatorAfter nbStanzas = 0 diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Transpose.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Transpose.kt index a5ca321..8314867 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Transpose.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Transpose.kt @@ -20,7 +20,7 @@ import androidx.compose.ui.unit.dp class Transpose { companion object { - val REGEX_ONE_NOTE = Regex("^([drmfslt][ia]?)([₄₃₂₁¹²³⁴]?)(.*)") + val REGEX_ONE_NOTE = Regex("^([drmfslt][ia]?)([₄₃₂₁¹²³⁴',]*)(.*)") val octaveSigns = listOf("₄", "₃", "₂", "₁", "", "¹", "²", "³", "⁴") val noteToNumber = listOf("d", "di", "r", "ri", "m", "f", "fi", "s", "si", "l", "ta", "t") val keyToNumber = listOf("C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab", "A", "Bb", "B" ) @@ -46,6 +46,55 @@ class Transpose { } } } + fun transposeMidi(note: String, fromKey: String) : Pair { + return Pair(note, 4) + } + fun simplifyNoteMidi(note: String): Pair { + var octaveFin = 4 + val indexOctave = octaveSigns.mapIndexed { index, sign -> sign to index}.toMap() + val outputBuilder = StringBuilder() + for (char in note) { + when (char) { + ',' -> octaveFin-- + '\'' -> octaveFin++ + else -> { + val octaveNum = indexOctave[char.toString()] + if (octaveNum != null) { + octaveFin += octaveNum - 4 + } else { + outputBuilder.append(char) + } + } + } + } + return Pair(outputBuilder.toString(), octaveFin) + } + fun simplifyNote(note: String): String { + val simplifiedMidi = simplifyNoteMidi(note) + return simplifiedMidi.first + octaveSigns[simplifiedMidi.second] + } + fun transposeToSolfa(note: String, fromKey: String, toKey: String, alter: Int = 0): String { + val transposed = transpose(note, fromKey, toKey, alter) + return transposed + .replace("di", "D") + .replace("ri", "R") + .replace("fi", "F") + .replace("si", "S") + .replace("ta", "T") + } + fun transposeToMidi(note: String, fromKey: String, toKey: String, alter:Int = 0): Int { + val transposed = transpose(note, fromKey, toKey, alter) + val noteNaked = REGEX_ONE_NOTE.find(transposed) + val noteNum = noteToNumber.indexOf(noteNaked?.groupValues[1]) + val octave = octaveSigns.indexOf(noteNaked?.groupValues[2]) + //val returnValue = midiKeys.getOrNull(noteNum) + octave.toString() + val returnValue = 12*octave + noteNum + 12 + return returnValue + } + fun transposeToFeufaroo(note: String, fromKey: String, toKey: String, alter: Int = 0): Pair { + val transposed = transpose(note, fromKey, toKey, alter) + return simplifyNoteMidi(transposed) + } fun transpose(note: String, fromKey: String, toKey: String, alter: Int = 0, toSolfaCode: Boolean = false): String { val regexFound = REGEX_ONE_NOTE.find(note) if (regexFound == null) { @@ -67,32 +116,7 @@ class Transpose { suffix = "'" } val newNote = noteToNumber[newNoteNum] + regexFound.groupValues[2] + suffix - val transposed = newNote.replace("¹,", "") - .replace("¹'", "²") - .replace("¹,", "") - .replace("₁'", "") - .replace("₁,", "₂") - .replace("²,", "¹") - .replace("²'", "³") - .replace("₂'", "₁") - .replace("₂,", "₃") - .replace("³,", "²") - .replace("³'", "⁴") - .replace("₃'", "₂") - .replace("₃,", "₄") - .replace("₄'", "₃") - .replace("⁴,", "³") - .replace(",", "₁") - .replace("'", "¹") + regexFound.groupValues[3] - if (!toSolfaCode) { - return transposed - } - return transposed - .replace("di", "D") - .replace("ri", "R") - .replace("fi", "F") - .replace("si", "S") - .replace("ta", "T") + return simplifyNote(newNote) + regexFound.groupValues[3] } @OptIn(ExperimentalMaterial3Api::class) // Ajoutez cette annotation pour utiliser ExposedDropdownMenuBox @Composable diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 03175eb..8361737 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -22,6 +22,7 @@ kmpObservableviewmodelCore = "1.0.0-BETA-3" kotlinxSerializationJson = "1.8.1" material3 = "1.3.2" voyager = "1.1.0-beta03" +#ktmidi = "0.11.1" [libraries] androidx-material-icons-extended = { module = "androidx.compose.material:material-icons-extended" } @@ -56,6 +57,7 @@ androidx-material3 = { module = "androidx.compose.material3:material3", version. voyager-navigator = { module = "cafe.adriel.voyager:voyager-navigator", version.ref = "voyager" } voyager-screenmodel = { module = "cafe.adriel.voyager:voyager-screenmodel", version.ref = "voyager" } voyager-koin = { module = "cafe.adriel.voyager:voyager-koin", version.ref = "voyager" } +#ktmidi = { group = "dev.atsushieno", name = "ktmidi", version.ref = "ktmidi" } [plugins] androidApplication = { id = "com.android.application", version.ref = "agp" }