# -*- coding: ISO-8859-1 -*- """ capellaScript -- Copyright (c) 2005 Peter Becker >>> ClubOrgel_C : Tabulaturschrift für Club-Handorgel Umsetzen von Noten in die Tabulaturschrift für die Club Orgel. -> Schritt 3 von 3|| Korrektur der Druck - Balken|| Zusammengehörige Druck-Balken werden verbunden|| Begleitstimme einfügen|| ||Achtung : Font Ziach.ttf muss installiert sein|| Bei Problemen bitte eine e-mail an peter_becker@freenet.de <<< 01.07.05 Erste Version 06.07.05 Prüfung ob mit ClubOrgel_B vorbereitet wurde 07.07.05 Abend verhindern wenn nur kurze Notenzeilen 31.03-06 h-TAB 22.02.06 Support für "ohne Begleitzeile" 28.04.06 Support für Übersetzen ohne Transposition 24.05.06 Bug in valChord beseitigt Unterstützung von R und Z bei Transpositionen 05.12.09 Unterstützung alternativer Bassschreibweise 06.12.09 Bass B mit H gleichgesetzt ( internationale Schreibweise ) 06.12.09 Absturz verhindert, wenn 1.Note ohne Akkord. Default is jetzt Druck 08.12.09 Voltenklammern aus Begleitstimme löschen 06.12.10 Absturz verhindert wenn ohne Bässe 07.05.12 V5.1.6 Fehler beim 6/8 Takt Begleitung AaaBaa """ import xml.dom, tempfile from caplib.capDOM import ScoreChange checkCapVersion(5,1,6) activeScore().registerUndo("ClubOrgel_C") valChord = ['C','D','E','F','G','A','B','H','C#','D#','E#','F#','G#','A#','B#','H#','Cis','Dis','Eis','Fis', 'Gis','Ais','Bis','His','Cb','Db','Eb','Fb','Gb','Ab','Bb','Ces','Des','Es','Fes','Ges','As', 'Cm','Dm','Em','Fm','Gm','Am','Bm','Hm','C#m','D#m','E#m','F#m','G#m','A#m','B#m','H#m','Cism', 'Dism','Eism','Fism','Gism','Aism','Bism','Hism','Cbm','Dbm','Ebm','Fbm','Gbm','Abm','Bbm', 'Cesm','Desm','Esm','Fesm','Gesm','Asm','C7','D7','E7','F7','G7','A7','B7','H7','C#7','D#7', 'E#7','F#7','G#7','A#7','B#7','H#7','Cis7','Dis7','Eis7','Fis7','Gis7','Ais7','Bis7','His7', 'Cb7','Db7','Eb7','Fb7','Gb7','Ab7','Bb7','Ces7','Des7','Es7','Fes7','Ges7','As7','R','Z' ] for vsys in activeScore().systems(): # prüfen ob bereits mit "ClubOrgel_B" vorbereitet vorb = vsys.nStaves() if vorb <= 1: messageBox('ClubOrgel_C','Partitur wurde nicht mit "ClubOrgel_B" vorbereitet.') exit() baesse = 'YES' #messageBox('STEP1','STEP1') for sysix in range(activeScore().nSystems()): # normales Zeilenende feststellen nStaves = activeScore().system(sysix).nStaves() tabix = nStaves -2 # Index zur Griffschrift Zeile TabVoice = activeScore().system(sysix).staff(tabix).voice(0) # Griffschrift Stimme for i in range(TabVoice.nNoteObjs()): # prüfen ob Begleitstimme erzeugt werden soll note = TabVoice.noteObj(i) for k in range(note.nDrawObjs()): d = note.drawObj(k) if d.has_key('tag')and d['tag'] == '2086-51': baesse = 'NO' break just = activeScore().system(sysix).get('justified') if just == 1: anz = TabVoice.nNoteObjs()-1 zeilenEndeJust = TabVoice.noteObj(anz).posX() break else : zeilenEndeJust = 999 # Absturz verhindert falls nur Kurzzeilen #messageBox('STEP2','STEP2') for sysix in range(activeScore().nSystems()): # Zeile falls erforderlich justieren nStaves = activeScore().system(sysix).nStaves() tabix = nStaves -2 # Index zur Griffschrift Zeile TabVoice = activeScore().system(sysix).staff(tabix).voice(0) # Griffschrift Stimme just = activeScore().system(sysix).get('justified') if just == 0: anz = TabVoice.nNoteObjs()-1 zeilenEnde = TabVoice.noteObj(anz).posX() if zeilenEnde > zeilenEndeJust: activeScore().system(sysix).set('justified',1) #messageBox('STEP3','STEP3') options = ScriptOptions() opt = options.get() placeholder1 = Label(' ',width=1) placeholder2 = Label(' ',width=1) placeholder3 = Label(' ',width=1) placeholder4 = Label(' ',width=1) if baesse == 'YES': radFormatTyp = Radio(['nur Bass','3er Takt = Aaa / 4er = Takt Aaaa / 6er Takt = Aaaaaa','3er Takt = Aaa / 4er = Takt AaAa / 6er Takt = AaaAaa'],text='Formatierungsoption auswählen',value=int(opt.get('FormatTyp','0'))) radDarstlTyp = Radio(['Akkorde','Zahlen','Buchstaben '],text='Bass Darstellung auswählen',value=int(opt.get('DarstlTyp','0'))) subboxFormat = HBox([radFormatTyp,radDarstlTyp,placeholder2],padding=4) mainboxFormat = VBox([subboxFormat],text='Begleitschema') radTabTyp = Radio(['kein Tabulatur Zeichen','TAB klein','TAB groß','TAB h'],text='Tabulaturzeichen',value=int(opt.get('TabTyp','1'))) subboxTab = HBox([radTabTyp,placeholder2],padding=4) mainboxTab = VBox([subboxTab],text='Tabulatur Zeichen auswählen') radLinTyp = Radio(['stehen lassen','komplett löschen','unter System löschen'],text='Verbindungslinie',value=int(opt.get('LinTyp','1'))) subboxLin = HBox([radLinTyp,placeholder2],padding=4) mainboxLin = VBox([subboxLin],text='Verbindungslinie auswählen') if baesse == 'YES': box = VBox([mainboxFormat,placeholder1,mainboxTab,placeholder1,mainboxLin,placeholder1],padding=1) else : box = VBox([mainboxTab,placeholder1,mainboxLin,placeholder1],padding=1) dlg = Dialog('ClubOrgel_C', box) if dlg.run(): if baesse == 'YES': formatTyp = radFormatTyp.value() darstlTyp = radDarstlTyp.value() else: formatTyp = 0 darstlTyp = 0 TabTyp = radTabTyp.value() LinTyp = radLinTyp.value() opt = dict( FormatTyp = str(formatTyp), DarstlTyp = str(darstlTyp), TabTyp = str(TabTyp), LinTyp = str(LinTyp) ) options.set(opt) else: exit(0) druck = 'no' x1n = 0 x2n = 0 y1n = 0 y2n = 0 posN = 0 #messageBox('STEP4','STEP4') for sysix in range(activeScore().nSystems()): nStaves = activeScore().system(sysix).nStaves() tabix = nStaves -2 # Index zur Griffschrift Zeile bglix = nStaves -1 # Index zur Begleitzeile TabVoice = activeScore().system(sysix).staff(tabix).voice(0) # Griffschrift Stimme BglVoice = activeScore().system(sysix).staff(bglix).voice(0) # Begleitstimme position = 0 meter = 1 # default Taktlänge = 4/4 exBar = 0 # expl.Barline #messageBox('Trap','neues System') #messageBox('STEP4a','STEP4a') for i in range(TabVoice.nNoteObjs()): #messageBox('noteobjects',str(range(TabVoice.nNoteObjs())) + '\n' + str(i)) note = TabVoice.noteObj(i) #messageBox('SUBTYPE',str(note.subType())) if note.subType() == NoteObj.METER: # Taktangabe als Textobjekt vorbereiten meter = note.meter() d = dict(type = 'text', content = '!T' + str(meter)) for ii in range(TabVoice.nNoteObjs()-i): # nächste Note oder Pause finden nextNote = TabVoice.noteObj(i+ii) if nextNote.isChord() or nextNote.isRest(): break nextNote.addDrawObj(d) # Takt an nächste Note oder Pause als Text hängen #messageBox('STEP4b','STEP4b') for k in range(note.nDrawObjs()): # falls eine Taktangabe an der Note hängt d = note.drawObj(k) taktTag = 0 if d['type'] == 'text': xx = d['content'][0:2] if xx == '!T': taktTag = 1 # freigeben zum kopieren in die Begleitzeile #messageBox('STEP4c','STEP4c') if d.has_key('tag') or taktTag == 1: # falls Begleitakkord oder Taktangabe Bposition = 0 Bnote = [] ix = 0 notePos = note.posX(False) #messageBox('STEP4d','STEP4d') for i in range(BglVoice.nNoteObjs()): Bnote = BglVoice.noteObj(i) BnotePos = Bnote.posX(False) if Bnote.isChord() or Bnote.isRest(): while BnotePos < notePos: # korrekte Begleitnote finden #messageBox('STEP4e','STEP4e') #messageBox('STEP4e',str(BnotePos) + '\n' + str(notePos) + '\n' +str(ix) + '\n' + str(BglVoice.nNoteObjs())) if str(ix) == str(BglVoice.nNoteObjs()-2): #messageBox('Abbruch','Abbruch') break ix = ix + 1 Bnote = BglVoice.noteObj(i+ix) BnotePos = Bnote.posX(False) #messageBox('STEP4f','STEP4f') d['y'] = 2 Bnote.addDrawObj(d) # und dranhängen if taktTag == 1: # falls Takangabe dann Original löschen note.deleteDrawObj(k) break if d.has_key('tag') and d['tag'] == '2086-41': # Tags mit ZUG ausschließen druck = 'no' elif d.has_key('tag') and d['tag'] == '2086-42': druck = 'no' elif d.has_key('tag') and d['tag'] == '2086-43': druck = 'no' barpos = 0 if note.implBarline() != 0: # falls impl.Barline Position merken barpos = note.implBarline().posX() if d['type'] == 'line'and d['lineWidth'] == 0.5: # Druckbalken optimieren Basisoptimierung posA = posN posN = note.posX(True) if druck == 'yes': if barpos != 0: dPos = barpos - posN d['x2'] = dPos note.replaceDrawObj(k,d) if posN > posA: dPos = (posN - posA)*-1 d['x1'] = dPos note.replaceDrawObj(k,d) else: druck = 'yes' #messageBox('Trap','Druckbalken optimieren - expl. Barline') np = 0 for i in range(TabVoice.nNoteObjs()): # Druckalken optimieren for expl.Barline note = TabVoice.noteObj(i) if note.subType() == NoteObj.REST or note.subType() == NoteObj.CHORD: np = 1 if note.subType() == NoteObj.EXPL_BARLINE and np == 1: # falls expl.Barline und bereits Noten oder barpos = note.posX(True) # Pausen in der Zeile, Position merken ix = 1 nnote = TabVoice.noteObj(i-ix) if i > 1: # falls expl.Barline nicht am Anfang der Zeile steht while nnote.isChord() == 0 and ix < i: # Pausen überspringen ix = ix+1 nnote = TabVoice.noteObj(i-ix) for k in range(nnote.nDrawObjs()): # Falls ein Druckbalken dranhängt d = nnote.drawObj(k) if d['type'] == 'line'and d['lineWidth'] == 0.5: # Druckbalken optimieren posA = nnote.posX(True) posN = barpos dPos = (posN - posA) d['x2'] = dPos nnote.replaceDrawObj(k,d) #messageBox('Trap','Begleitakkorde löschen') #messageBox('STEP5','STEP5') for sysix in range(activeScore().nSystems()): # Begleitakkorde aus Griffschrift löschen nStaves = activeScore().system(sysix).nStaves() tabix = nStaves -2 # Index zur Griffschrift Zeile TabVoice = activeScore().system(sysix).staff(tabix).voice(0) # Griffschrift Stimme for i in range(TabVoice.nNoteObjs()): note = TabVoice.noteObj(i) for k in range(note.nDrawObjs()): # und löschen d = note.drawObj(k) if d <> 0: if baesse == 'NO': if d['type'] == 'text': xx = d['content'][0:2] if xx == '!T': note.deleteDrawObj(k) # und Taktmerker löschen if d.has_key('tag') and d.has_key('content') and d['content'] in valChord: note.deleteDrawObj(k) #messageBox('STEP6','STEP6') for sysix in range(activeScore().nSystems()): # Begleitakkorde aus Griffschrift löschen nStaves = activeScore().system(sysix).nStaves() bglix = nStaves -1 # Index zur Begleit-Zeile TabVoice = activeScore().system(sysix).staff(bglix).voice(0) # Begleit-Stimme for i in range(TabVoice.nNoteObjs()): note = TabVoice.noteObj(i) for k in range(note.nDrawObjs()): # und löschen d = note.drawObj(k) if d <> 0: if d['type'] == 'line': note.deleteDrawObj(k) elif d['type'] == 'slur': note.deleteDrawObj(k) elif d['type'] == 'text': yy = d['content'] if yy == '!T': note.deleteDrawObj(k) elif yy not in valChord: note.deleteDrawObj(k) #messageBox('STEP7','STEP7') for sysix in range(activeScore().nSystems()): # Begleitakkorde aus Griffschrift löschen nStaves = activeScore().system(sysix).nStaves() # 2. Durchlauf bglix = nStaves -1 # Index zur Begleit-Zeile TabVoice = activeScore().system(sysix).staff(bglix).voice(0) # Begleit-Stimme for i in range(TabVoice.nNoteObjs()): note = TabVoice.noteObj(i) for k in range(note.nDrawObjs()): # und löschen d = note.drawObj(k) if d <> 0: if d['type'] == 'line': note.deleteDrawObj(k) elif d['type'] == 'text': yy = d['content'] if yy == '!T': note.deleteDrawObj(k) elif yy not in valChord: note.deleteDrawObj(k) meter = 1 # Default Takt = 4/4 ba = ' ' yy = 'R' ct = 1 Begleitung_Druck = dict( A = dict(wert='a',BuchBs='D',BuchBg='d',ZahlBs='7',ZahlBg='8'), C = dict(wert='c',BuchBs='A',BuchBg='a',ZahlBs='1',ZahlBg='2'), F = dict(wert='f',BuchBs='B',BuchBg='b',ZahlBs='3',ZahlBg='4'), Eb = dict(wert='eb',BuchBs='C',BuchBg='c',ZahlBs='5',ZahlBg='6'), F7 = dict(wert="f7",BuchBs="B",BuchBg="b'",ZahlBs="3",ZahlBg="4'"), C7 = dict(wert="c7",BuchBs="A",BuchBg="a'",ZahlBs="1",ZahlBg="2'"), Db = dict(wert="db",BuchBs="B'",BuchBg="--",ZahlBs="3'",ZahlBg="--"), Gb = dict(wert="gb",BuchBs="A'",BuchBg="--",ZahlBs="1'",ZahlBg='--'), Z = dict(wert='--',BuchBs='--',BuchBg='--',ZahlBs='--',ZahlBg='--'), R = dict(wert='--',BuchBs='--',BuchBg='--',ZahlBs='--',ZahlBg='--') ) Begleitung_Zug = dict( B = dict(wert='--',BuchBs='A',BuchBg='--',ZahlBs='1',ZahlBg='--'), C = dict(wert='c',BuchBs='B',BuchBg='b',ZahlBs='3',ZahlBg='4'), D = dict(wert='--',BuchBs='D',BuchBg='--',ZahlBs='7',ZahlBg='--'), E = dict(wert="--",BuchBs="E'",BuchBg='--',ZahlBs="3'",ZahlBg='--'), G = dict(wert='g',BuchBs='A',BuchBg='a',ZahlBs='1',ZahlBg='2'), H = dict(wert="--",BuchBs="A'",BuchBg="--",ZahlBs="1'",ZahlBg="--"), Bb = dict(wert='bb',BuchBs='C',BuchBg='c',ZahlBs='5',ZahlBg='6'), G7 = dict(wert="g7",BuchBs="A",BuchBg="a'",ZahlBs="1",ZahlBg="2'"), C7 = dict(wert="c7",BuchBs="B",BuchBg="b'",ZahlBs="3",ZahlBg="4'"), Dm = dict(wert='dm',BuchBs='D',BuchBg='d',ZahlBs='7',ZahlBg='8'), Z = dict(wert='--',BuchBs='--',BuchBg='--',ZahlBs='--',ZahlBg='--'), R = dict(wert='--',BuchBs='--',BuchBg='--',ZahlBs='--',ZahlBg='--') ) #messageBox('STEP8','STEP8') if baesse == 'YES': #messageBox('Trap','Begleitung ergänzen') for sysix in range(activeScore().nSystems()): # Begleitung in Begleitzeile ergänzen nStaves = activeScore().system(sysix).nStaves() tabix = nStaves -1 # Index zur Griffschrift Zeile BglVoice = activeScore().system(sysix).staff(tabix).voice(0) # Griffschrift Stimme for i in range(BglVoice.nNoteObjs()): am = 'no' note = BglVoice.noteObj(i) type = note.subType() if type == 4: #messageBox('TYPE',str(type) + '\n' + str(note.meter())) meter = str(note.meter()) if note.isChord() or note.isRest(): #messageBox('NOTE',str(note)) for ii in range(note.nDrawObjs()): d = note.drawObj(ii) if d <> 0: if d['type'] == 'text': xx = d['content'][0:2] if xx == '!T': meter = d['content'][2:] # Takt extrahieren #note.deleteDrawObj(ii) ### # und Taktmerker löschen break if d <> 0: if d.has_key('tag') and d.has_key('content') and d['content'] in valChord: # Akkordwechsel gefunden am = 'gefunden' yy = d['content'] if d['tag'] == '2086-41' or d['tag'] == '2086-42' or d['tag'] == '2086-43': # Tags mit ZUG ausschließen druck = 'no' else: druck = "yes" #messageBox('DT',str(darstlTyp) + '\n' + str(druck)) if druck == "no": # Begleitung Zug if darstlTyp == 0: # Akkorde bs = yy # Begleitbass merken ba = Begleitung_Zug[str(yy)]['wert'] # Begleitakkord merken elif darstlTyp == 1: # Zahlen bs = Begleitung_Zug[str(yy)]['ZahlBs'] # Begleitbass merken ba = Begleitung_Zug[str(yy)]['ZahlBg'] # Begleitakkord merken else: # Buchstaben bs = Begleitung_Zug[str(yy)]['BuchBs'] # Begleitbass merken ba = Begleitung_Zug[str(yy)]['BuchBg'] # Begleitakkord merken else: # Begleitung Druck if darstlTyp == 0: # Akkorde bs = yy # Begleitbass merken ba = Begleitung_Druck[str(yy)]['wert'] # Begleitakkord merken elif darstlTyp == 1: # Zahlen bs = Begleitung_Druck[str(yy)]['ZahlBs'] # Begleitbass merken ba = Begleitung_Druck[str(yy)]['ZahlBg'] # Begleitakkord merken else: # Buchstaben bs = Begleitung_Druck[str(yy)]['BuchBs'] # Begleitbass merken ba = Begleitung_Druck[str(yy)]['BuchBg'] # Begleitakkord merken #ba = Begleitung[str(yy)]['wert'] # Begleitakkord merken ct = 1 # Bass if ba == '--': # Dummy Akkord durch -- ersetzen d = dict(type = 'text',y = 2,content = '--', font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) note.replaceDrawObj(ii,d) # um anzuzeigen, dass hier kein Bass vorgesehen ist continue d = dict(type = 'text',y = 2,content = str(bs), font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) note.replaceDrawObj(ii,d) if am == 'no': if druck == "no": # Begleitung Zug if darstlTyp == 0: # Akkorde bs = yy # Begleitbass merken ba = Begleitung_Zug[str(yy)]['wert'] # Begleitakkord merken elif darstlTyp == 1: # Zahlen bs = Begleitung_Zug[str(yy)]['ZahlBs'] # Begleitbass merken ba = Begleitung_Zug[str(yy)]['ZahlBg'] # Begleitakkord merken else: # Buchstaben bs = Begleitung_Zug[str(yy)]['BuchBs'] # Begleitbass merken ba = Begleitung_Zug[str(yy)]['BuchBg'] # Begleitakkord merken else: # Begleitung Druck if darstlTyp == 0: # Akkorde bs = yy # Begleitbass merken ba = Begleitung_Druck[str(yy)]['wert'] # Begleitakkord merken elif darstlTyp == 1: # Zahlen bs = Begleitung_Druck[str(yy)]['ZahlBs'] # Begleitbass merken ba = Begleitung_Druck[str(yy)]['ZahlBg'] # Begleitakkord merken else: # Buchstaben bs = Begleitung_Druck[str(yy)]['BuchBs'] # Begleitbass merken ba = Begleitung_Druck[str(yy)]['BuchBg'] # Begleitakkord merken duration = str(note.duration()) d = dict(type = 'text',y = 2,content = str(ba), font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) #messageBox('Formattyp',str(formatTyp)) if formatTyp == 1: # Format Typ 1 = Aaa , Aaaa, Aaaaaa etc if duration == str('1/8'): # 8tel Begleitung #messageBox('am=n0 ,str(meter) + ' Cnt=' + str(ct) + '\nyy=' + str(yy) + ' ba=' + str(ba)) ct = ct + 1 if meter == str('1') and ct <= 8: # 4/4 tel Takt d = dict(type = 'text',y = 2,content = str(ba), font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) elif meter == str('2/4') or meter == str('1/2'): # 2/4 tel Takt if ct == 1: # 2/4 tel Takt erste Hälfte d = dict(type = 'text',y = 2,content = str(bs), font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) elif ct == 4: # 2/4 tel Takt zweite Hälfte ct = 0 elif meter == str('3/4'): # 3/4 tel Takt if ct == 1: # 3/4 tel Takt erste Hälfte d = dict(type = 'text',y = 2,content = str(bs), font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) elif ct == 6: # 3/4 tel Takt zweite Hälfte ct = 0 note.addDrawObj(d) elif duration == str('1/4'): # 4tel Begleitung ct = ct + 1 if meter == str('1') and ct <= 4: # 4/4 tel Takt d = dict(type = 'text',y = 2,content = str(ba), font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) elif meter == str('2/4') or meter == str('1/2'): # 2/4 tel Takt if ct == 1: # 2/4 tel Takt erste Hälfte d = dict(type = 'text',y = 2,content = str(bs), font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) elif ct == 2: # 3/4 tel Takt zweite Hälfte ct = 0 elif meter == str('3/4'): # 3/4 oder 6/8 tel Takt if ct == 1: # 3/4 tel Takt erste Hälfte d = dict(type = 'text',y = 2,content = str(bs), font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) elif ct == 3: # 3/4 tel Takt zweite Hälfte ct = 0 note.addDrawObj(d) elif formatTyp == 2: # Format Typ 2 = Aaa , AaAa, AaaAaa etc if duration == str('1/8'): # 8tel Begleitung #messageBox('Begleitstimme' ,str(meter) + ' Cnt=' + str(ct) + '\nyy=' + str(yy) + ' ba=' + str(ba)) ct = ct + 1 if meter == str('1') and ct <= 4: # 4/4 tel Takt erste Hälfte x = 1 # Dummy Operation elif meter == str('1') and ct == 5: # 4/4 tel Takt zweite Hälft d = dict(type = 'text',y = 2,content = str(bs), font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) note.addDrawObj(d) d = dict(type = 'text',y = 2,content = str(ba), font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) ct = 1 elif meter == str('2/4') or meter == str('1/2'): # 2/4 tel Takt if ct == 1: # 2/4 tel Takt erste Hälfte d = dict(type = 'text',y = 2,content = str(bs), font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) note.addDrawObj(d) elif ct == 2: # 2/4 tel Takt zweite Hälfte ct = 0 elif meter == str('3/4') and ct <= 3: # 6/8 tel Takt erste Hälfte #messageBox('6/8 1.Hälfte',str(d)) note.addDrawObj(d) elif meter == str('3/4') and ct == 4: # 6/8 tel Takt zweite Hälfte d = dict(type = 'text', y = 2, content = str(bs), font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) note.addDrawObj(d) d = dict(type = 'text', content = str(ba), font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) ct = 1 if ct <> 1: note.addDrawObj(d) elif duration == str('1/4'): # 4tel Begleitung #messageBox('Begleitstimme' ,'meter = ' + str(meter) + '\nCnt=' + str(ct) + '\nyy=' + str(yy) + ' ba=' + str(ba)) ct = ct + 1 if meter == str('1') and ct <= 2: # 4/4 tel Takt erste Hälfte x = 1 # Dummy operation elif meter == str('1') and ct == 3: # 4/4 tel Takt zweite Hälfte d = dict(type = 'text',y = 2,content = str(bs), font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) note.addDrawObj(d) d = dict(type = 'text',y = 2,content = str(ba), font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) ct = 1 elif meter == str('2/4') or meter == str('1/2'): # 2/4 tel Takt if ct == 1: # 2/4 tel Takt erste Hälfte d = dict(type = 'text',y = 2,content = str(bs), font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) note.addDrawObj(d) elif ct == 2: # 2/4 tel Takt zweite Hälfte ct = 0 elif meter == str('3/4'): # 3/4 tel Takt if ct == 1: # 3/4 tel Takt erste Hälfte d = dict(type = 'text',y = 2,content = str(bs), font = dict(height = 10, pitchAndFamily = 0, face = 'Times New Roman', weight = 0)) note.addDrawObj(d) elif ct == 3: # 3/4 tel Takt zweite Hälfte ct = 0 #messageBox('CNT',str(ct)) if ct <> 1: note.addDrawObj(d) for sysix in range(activeScore().nSystems()): # Begleitstimme aufräumen nStaves = activeScore().system(sysix).nStaves() tabix = nStaves -1 # Index zur Griffschrift Zeile BglVoice = activeScore().system(sysix).staff(tabix).voice(0) # Griffschrift Stimme for i in range(BglVoice.nNoteObjs()): note = BglVoice.noteObj(i) if note.isChord() or note.isRest(): #messageBox('NOTE',str(note)) for ii in range(note.nDrawObjs()): d = note.drawObj(ii) if d <> 0: #messageBox('TYPE',str(d)) if d['type'] == 'volta': note.deleteDrawObj(ii) # Voltenklammern aus Begleitstimme löschen #messageBox('Trap','TAB einfügen') #messageBox('STEP9','STEP9') for sysix in range(activeScore().nSystems()): # Tabulatur Zeichen einfügen und # Verbindungslinie unterdrücken nStaves = activeScore().system(sysix).nStaves() tabix = nStaves -2 # Index zur Griffschrift Zeile TabVoice = activeScore().system(sysix).staff(tabix).voice(0) # Griffschrift Stimme aa = activeScore().system(sysix).getAttributes() for i in range(TabVoice.nNoteObjs()): note = TabVoice.noteObj(i) if note.isChord() or note.isRest(): pos = note.posX(1) l1 = dict(type = 'line',x1 = pos*-1,x2 = pos*-1,y1=-2.2,y2=12.5,lineWidth = 0.6, color=Color.white) l2 = dict(type = 'line',x1 = pos*-1,x2 = pos*-1,y1=2,y2=12.5,lineWidth = 0.6, color=Color.white) if LinTyp == 1: note.addDrawObj(l1) # Linie weg if LinTyp == 2: note.addDrawObj(l2) t1 = dict(type = 'text',y = 0.5,x = pos*-1+0.8,content = 'A', font = dict(height = 18, pitchAndFamily = 2, charSet = 2, face = 'Ziach', weight = 10)) t2 = dict(type = 'text',y = 1.5,x = pos*-1+0.8,content = 'B', font = dict(height = 18, pitchAndFamily = 2, charSet = 2, face = 'Ziach', weight = 10)) t3 = dict(type = 'text',y = 0.5,x = pos*-1+0.8,content = 'E', font = dict(height = 18, pitchAndFamily = 2, charSet = 2, face = 'Ziach', weight = 10)) if TabTyp == 1: # kleines TAB note.addDrawObj(t2) elif TabTyp == 2: # großes TAB note.addDrawObj(t1) elif TabTyp == 3: # h TAB note.addDrawObj(t3) break