# -*- coding: ISO-8859-1 -*- """ capellaScript -- Copyright (c) 2003,2004,2005,2006 Peter Becker >>> Vorzeichenschieber Korrigiert sich überlappende Vorzeichen in 2-stimmigen Zeilen|| Passt die Position der Unterstimme bei Sekund- und Primabstand an|| Verschiebt Noten bei Stimmenkreuzung|| Bei Terzabstände wird die Brevisnote zentriert|| Unterdrückt bei gleicher Tonhöhe die untere Punktierung ||| Bei Problemen bitte eine Mail an peter_becker@freenet.de <<< Shifting Accidentals and Notes

- Corrects overlapping notes and accidentals in staves for 2 voices. - Adjusts the position of the lower voice with 2nd or prime distance. - Shifts notes at voice crossing. - Suppresses with similar pitch the note dotting in the lower voice, if there is no shifting of notes. - Suppresses with similar pitch and similar accidentals the accidental in the lower voice, if a shifting of notes takes place.

In case of problems please mail to peter_becker@freenet.de

Vorzeichenschieber

- Korrigiert sich überlappende Vorzeichen in 2-stimmigen Zeilen. - Passt die Position der Unterstimme bei Sekund- und Primabstand an. - Verschiebt Noten bei Stimmenkreuzung. - Unterdrückt bei gleicher Tonhöhe die untere Punktierung, falls Notenverschiebung unterbleibt. - Unterdrückt bei gleicher Tonhöhe und gleichen Vorzeichen das Vorzeichen in der Unterstimme, falls Notenverschiebung statt findet.

Bei Problemen bitte eine Mail an peter_becker@freenet.de

Voortekens en noten verschuiven

- Corrigeert overlappende voortekens in 2-stemmige notenbalken. - Past de positie aan van de onderstem bij secunde- en prime-afstand. - Verschuift noten bij stemmenkruising. - Onderdrukt bij gelijke toonhoogte de onderste punctering, wanneer verschuiving van noten achterwege blijft. - Onderdrukt bij gelijke toonhoogte en dezelfde voortekens het voorteken in de onderstem, wanneer verschuiving van noten plaats vindt.

Bij problemen graag een mail naar peter_becker@freenet.de

History: 06.05.04 - Erste Ausgabe 07.05.04 - vertikaler Notenabstand berücksichtigt 07.05.04 - Absturz wenn nur eine Stimme pro Zeile 08.05.04 - berücksichtigen von erzwungenen Vorzeichen Bei Sekundabständen zwischen Unter und Oberstimme wird die Unterstimme verschoben und eventuelle Vorzeichen angepasst 09.05.04 - Datenmodellfehler ( Stepup4 ) Auflösung in Tonart und Shift nicht berücksichtigt 15.05.04 - Unterdrückung der Punktierung bei gleicher Tonhöhe 18.05.04 - verschieben der Note bei Stimmenkreuzung und Sekund Abstand Stimmenkreuzung 19.05.04 - gleiche Tonhöhe unterschiedlicher Wert oder ganze Note dann Note verschieben 25.05.04 - Notenverschiebung bei Prim optimiert 26.05.04 - Vorzeichen bei Prim optimiert 03.06.04 - Absturz in CompVoice beseitigt 19.06.04 - Auflösung von Extra Vorzeichen im Takt erkennen Auflösung nach erzwungenem Vorzeichen für den ganzen Takt erkennen 27.07.05 - Position bei ganzer Note in Oberstimme korrigiert 18.02.06 - erster Ansatz um Stimmenkreuzungen besser zu formatieren 20.02.06 - Verbesserung bei Stimmenkreuzung, Capella Bug head/alter/xShift nur ganzzahlig 02.03.06 - Überarbeitung wegen Capella 5.2. Datenmodellfix für Alter/xShift 20.03.06 - Erweiterte Primverschiebung auswählbar 30.03.06 - Formatierungsverbesserung bei Punktierungen 05.05.06 - Absturz wenn gleicher Ton und Vorzeichen der Tonart aufgelöst 31.08.06 - Vorzeichenerkennung verbessert ( hasAlter ), Korrektur in der Vorzeichenposition 21.10.07 - Vorzeichenerkennung verbessert ( hasAlter ), bei forcierter Auflösung 20.09.08 - stemDir Prüfung testweise ausgeschaltet 08.11.14 - Anpassungen an eigene Wünsche von Wilfred van de Wal 13.11.14 - PB unter bestimmten Umständen wurde beim Terzabstand von 2 Noten mit Vorzeichen nur ein Vorzeichen entdeckt. 08.01.15 - Wahlmögichkeiten Primenbehandlung ausgebreitet 17.05.15 - PB 2.2.3 falsches Auflösungszeichen bei tie=end behoben 29.08.16 - WW 2.2.3u Unterdrückte Vorzeichen werden jetzt negiert. Terzabstand ohne Stimmenkreuzung wie Quart- bis Septimeabstand behandelt. Einige Fehler beseitigt: Auflösungszeichen werden jetzt behandelt 18.09.17 - WW Internationalisiert (en-de-nl) 10.10.17 - WW Ausbreitung Primen-Optionen und kleine Korrekturen: 2.2.4 07.09.18 - WW Deutlicher Dialog, kleine Text Korrekturen, 'Hilfe' mit Info-Text 27.02.19 - WW 2.2.5 - Bei Sekundabstand und 2 Vorzeichen muss das untere immer links neben dem oberen Vorzeichen stehen - Vorzeichen-Unterdrückung nur bei verschoben Primen mit gleichen Vorzeichen (auch Doppel-B und -Kreuz) - Kleine Korrekturen und Überflussigkeiten entfernt - Anpassung der Info- und Hilfe-Texten 28.05.20 - WW 2.2.6 Eingabespeicherung wieder hergestellt """ english = { 'allSimilarHeads' :' 1. a. XXXXXXXX : S i m i l a r h e a d s --> n o s h i f t i n g', 'allShRight' :' b. XXXXXXXX : I d e m ( shifting only to the right )', 'inclHalfNotes' :' c. <= ½ notes : I d e m', 'inclHalfNotesStandard' :' c. <= ½ notes : I d e m ( STANDARD )', 'inclHalfNotesShRight' :' d. <= ½ notes : I d e m ( shifting only to the right )', 'allSimilarHeadsDots' :' 2. a. XXXXXXXX : S i m i l a r h e a d s a n d d o t t i n g --> n o s h i f t i n g', 'allSmilarDurationDots' :' 3. a. XXXXXXXX : S i m i l a r d u r a t i o n a n d , i f n o t d o t t e d , s i m i l a r h e a d s --> n o s h i f t i n g', 'allSimilarDuration' :' 4. a. XXXXXXXX : S i m i l a r d u r a t i o n --> n o s h i f t i n g', 'always' :' 5. a. XXXXXXXX : A l w a y s s h i f t i n g o f p r i m e s', 'options' :'Options Treatment of Primes ( XXXXXXXX = All note values ; <= ½ notes = Note values up to and including half notes )', 'header' :'Shifting Accidentals and Notes Version : ', 'help' :'This script corrects overlapping notes and accidentals in staves for 2 voices.\n\ \nIt adjusts the position of the lower voice at 2nd and prime distance.\n\ \nIt shifts notes at voice crossing.\n\ \nIt suppresses with similar pitch and duration the note dotting in the \ lower voice, if there is no shifting of notes.\n\ \nIt suppresses with similar pitch and similar accidentals the accidental in \ the lower voice, if a shifting of notes takes place.\n\ \nIn the dialogue one can choose between various options for the \ treatment of primes. A frequently used option is indicated as standard: \ 3.c. ( = No shifting with Similar duration and, if not dotted, similar \ heads of notes with maximum value of half notes. )' } german = { 'allSimilarHeads' :' 1. a. XXXXXXXX : G l e i c h e K ö p f e --> k e i n e V e r s c h i e b u n g', 'allShRight' :' b. XXXXXXXX : I d e m ( Verschiebung nur nach Rechts )', 'inclHalfNotes' :' c. <= ½ Noten : I d e m', 'inclHalfNotesStandard' :' c. <= ½ Noten : I d e m ( STANDARD )', 'inclHalfNotesShRight' :' d. <= ½ Noten : I d e m ( Verschiebung nur nach Rechts )', 'allSimilarHeadsDots' :' 2. a. XXXXXXXX : G l e i c h e K ö p f e u n d P u n k t i e r u n g --> k e i n e V e r s c h i e b u n g', 'allSmilarDurationDots' :' 3. a. XXXXXXXX : G l e i c h e r N o t e n w e r t u n d , w e n n n i c h t p u n k t i e r t , g l e i c h e K ö p f e --> k e i n e V e r s c h i e b u n g', 'allSimilarDuration' :' 4. a. XXXXXXXX : G l e i c h e r N o t e n w e r t --> k e i n e V e r s c h i e b u n g', 'always' :' 5. a. XXXXXXXX : I m m e r P r i m v e r s c h i e b u n g', 'options' :'Optionen Behandlung von Primen ( XXXXXXXX = Alle Notenwerten ; <= ½ Noten = Notenwerten bis einschließlich halbe Noten)', 'header' :'Vorzeichenschieber Version : ', 'help' :'Dieses Skript korrigiert sich überlappende Vorzeichen in 2-stimmigen Zeilen.\n\ \nEs passt die Position der Unterstimme bei Sekund- und Primabstand an.\n\ \nEs verschiebt Noten bei Stimmenkreuzung.\n\ \nEs unterdrückt bei gleicher Tonhöhe und Notenwert die untere \ Punktierung, falls Notenverschiebung unterbleibt.\n\ \nEs unterdrückt bei gleicher Tonhöhe und gleichen Vorzeichen das \ Vorzeichen in der Unterstimme, falls Notenverschiebung statt findet.\n\ \nIm Dialog kann man zwischen verschiedenen Optionen für die Behandlung \ von Primen wählen. Eine häufig verwendete Option ist als Standard bezeichnet: \ 3.c. ( = Keine Verschiebung bei gleicher Notenwert und, wenn nicht punktiert, \ gleiche Köpfe von Noten mit maximal halben Notenwert. )' } dutch = { 'allSimilarHeads' :' 1. a. XXXXXXXX : G e l i j k e k o p p e n --> g e e n v e r s c h u i v i n g', 'allShRight' :' b. XXXXXXXX : I d e m ( verschuiving slechts naar rechts )', 'inclHalfNotes' :' c. <= ½ noten : I d e m', 'inclHalfNotesStandard' :' c. <= ½ noten : I d e m ( STANDAARD )', 'inclHalfNotesShRight' :' d. <= ½ noten : I d e m ( verschuiving slechts naar rechts )', 'allSimilarHeadsDots' :' 2. a. XXXXXXXX : G e l i j k e k o p p e n e n p u n c t e r i n g --> g e e n v e r s c h u i v i n g', 'allSmilarDurationDots' :' 3. a. XXXXXXXX : G e l i j k e n o t e n w a a r d e e n , i n d i e n n i e t g e p u n c t e e r d , g e l i j k e k o p p e n --> g e e n v e r s c h u i v i n g', 'allSimilarDuration' :' 4. a. XXXXXXXX : G e l i j k e n o t e n w a a r d e --> g e e n v e r s c h u i v i n g', 'always' :' 5. a. XXXXXXXX : A l t i j d v e r s c h u i v i n g v a n p r i m e n', 'options' :'Opties behandeling van primen ( XXXXXXXX = Alle notenwaarden ; <= ½ noten = Notenwaarden t/m halve noten )', 'header' :'Voortekens en noten verschuiven Versie : ', 'help' : 'Dit script corrigeert overlappende voortekens in 2-stemmige notenbalken.\n\ \nHet past de positie aan van de onderstem bij secunde- en prime-afstand.\n\ \nHet verschuift noten bij stemmenkruising.\n\ \nHet onderdrukt bij gelijke toonhoogte en notenwaarde de onderste \ punctering, wanneer verschuiving van noten achterwege blijft.\n\ \nHet onderdrukt bij gelijke toonhoogte en dezelfde voortekens het \ voorteken in de onderstem, wanneer verschuiving van noten plaats \ vindt.\n\ \nIn het dialoogvenster kan men kiezen tussen diverse opties voor de \ behandeling van primen. Een vaak gebruikte optie is als standaard \ aangeduid: 3.c. ( = Geen verschuiving bij gelijke notenwaarde en, \ indien niet gepuncteerd, gelijke koppen van noten met maximaal de \ waarde van een halve noot. )' } try: setStringTable( ("en", english), ("de", german), ("nl", dutch)) except: def tr(s): return german[s] import xml.dom, tempfile from caplib.capDOM import ScoreChange from xml.dom.minidom import NodeList, Node, Element doc = [] # parentNode von score version = '2.2.6' def addElementNode(el,tagName): # Neue Node zu "el" hinzufügen wenn Node "tagName" nicht existiert # ansonsten existierende Node zurückmelden global doc childs = el.childNodes for n in range(childs.length): if childs[n].nodeType ==childs[n].ELEMENT_NODE and childs[n].tagName == tagName: return childs[n] newChild = doc.createElement(tagName) el.appendChild(newChild) return newChild def getElementObjects(objList): # gibt eine Liste zurück newList = NodeList() for n in range(objList.length): if objList[n].nodeType == objList[n].ELEMENT_NODE: newList.append(objList[n]) return newList def getLastOccurence(tk, pi): # letztes Auftreten der Note im Takt suchen last = tk.pop() # eigene Note entfernen lastOc = '00000' while len(tk) > 0: last = tk.pop() if last[0:2] == pi[0:2]: lastOc = last break return lastOc def hasAlter(pi,al,hd,note,obj,merker): # Hat die Note ein Vorzeichen ? tk = merker[:] # Liste clonen lo = getLastOccurence(tk, pi) # letztes Auftreten der Note suchen takt1 = [] list0 = [ ] list1 = ['F'] list2 = ['F','C'] list3 = ['F','C','G'] list4 = ['F','C','G','D'] list5 = ['F','C','G','D','A'] list6 = ['F','C','G','D','A','E'] list7 = ['F','C','G','D','A','E','B'] listM1 = ['B'] listM2 = ['B','E'] listM3 = ['B','E','A'] listM4 = ['B','E','A','D'] listM5 = ['B','E','A','D','G'] listM6 = ['B','E','A','D','G','C'] listM7 = ['B','E','A','D','G','C','F'] key = obj.curKey() if key == 0: liste = list0 elif key == 1: liste = list1 elif key == 2: liste = list2 elif key == 3: liste = list3 elif key == 4: liste = list4 elif key == 5: liste = list5 elif key == 6: liste = list6 elif key == 7: liste = list7 elif key == -1: liste = listM1 elif key == -2: liste = listM2 elif key == -3: liste = listM3 elif key == -4: liste = listM4 elif key == -5: liste = listM5 elif key == -6: liste = listM6 elif key == -7: liste = listM7 if pi[0] in liste: # Ton hat in der Tonart normalerweise ein Vorzeichen #messageBox('HasAlter','norm VZ') vz = 0 if al: #messageBox('HasAlter','al') if al[0].hasAttribute('step'): # Vorzeichen ist nicht aufgelöst #messageBox('HasAlter','al step') if lo[0:2] == pi[0:2] and lo[2:4] == '00': # letztes Auftreten war aufgelöst if al[0].hasAttribute('display'): df = al[0].getAttribute('display') if df == 'suppress': vz = 0 else: vz = 1 # dann wird Vorzeichen angezeigt else: if al[0].hasAttribute('display'): df = al[0].getAttribute('display') # ansonsten wird else: df = 'none' # Vorzeichen nur angezeigt if df == 'force': vz = 1 # wenn FORCE gesetzt ist else: vz = 0 else: # Vorzeichen ist aufgelöst ! #messageBox('HasAlter','al aufgelöst') tie = hd[0].getElementsByTagName('tie') # 2.2.3 ungültige Verschiebung bei tie=end beseitigt if tie: end = tie[0].getAttribute('end') if end == 'true': vz = 0 else: # erstes Auftreten daher wegen Fehler im Datenmodell alter = addElementNode(hd[0],'alter') # auf force setzen (Auflösung in Tonart ) alter.setAttribute('display','force') # ALTER Tag durch Datenmodell Fehler erforderlich ! vz = 1 else: if lo[0:2] == pi[0:2] and lo[2:4] == '00': # letztes Auftreten war aufgelöst vz = 0 # dann kein Vorzeichen else: # erstes Auftreten daher wegen Fehler im Datenmodell alter = addElementNode(hd[0],'alter') # auf force setzen (Auflösung in Tonart ) alter.setAttribute('display','force') # ALTER Tag durch Datenmodell Fehler erforderlich ! vz = 1 else: # Ton hat in der Tonart normalerweise kein Vorzeichen vz = 0 #messageBox('HasAlter','norm kein VZ') if al: if al[0].hasAttribute('step'): # Vorzeichen da if lo[0:2] == pi[0:2] and lo[2:4] == '00': # letztes Auftreten war aufgelöst vz = 1 # dann wird Vorzeichen angezeigt elif lo[0:2] == '00' and lo[2:4] == '00': # kein vorheriges Vorzeichen im Takt vz = 1 # dann anzeigen st = str(al[0].getAttribute('step')) # if st == '1': st = '+1' if st <> lo[2:4]: # fall Kreuz, aber vorher im Takt b, oder umgekehrt vz = 1 if al[0].hasAttribute('display'): df = al[0].getAttribute('display') # ansonsten wird else: df = 'none' # Vorzeichen angezeigt if df == 'force': vz = 1 # wenn FORCE gesetzt ist elif df == 'suppress': vz = 0 # wenn UNTERDRÜCKEN gesetzt ist wird Vorzeichn nicht angezeigt #messageBox('Step',str(vz) + '\nlo=' + str(lo)+ '\npi=' + str(pi) + '\ntk=' + str(tk) + '\nst=' + str(st) + '\nl1=' + str(lo[2:4]) + '\ndf=' + str(df)) else: if al[0].hasAttribute('display'): df = al[0].getAttribute('display') # ansonsten wird else: df = 'none' # Vorzeichen nur angezeigt if df == 'force': vz = 1 # wenn FORCE gesetzt ist else: vz = 0 #messageBox('kein Step',str(vz) + '\nlo=' + str(lo)+ '\npi=' + str(pi) + '\ntk=' + str(tk)) else: # kein Vorzeichen if lo[0:2] == pi[0:2] and lo[2:4] <> '00': # letztes Auftreten war mit Vorzeichen vz = 1 # dann mit Auflösungszeichen alter = addElementNode(hd[0],'alter') # erstes Auftreten daher wegen Fehler im Datenmodell alter.setAttribute('display','force') # auf force setzen (Auflösung in Tonart ) ALTER Tag durch Datenmodell Fehler erforderlich ! else: vz = 0 #messageBox('kein Alter',str(vz) + '\nlo=' + str(lo)+ '\npi=' + str(pi) + '\ntk=' + str(tk)) #messageBox("vzret",str(vz)) tie = hd[0].getElementsByTagName('tie') # 2.2.3 ungültige Verschiebung bei tie=end beseitigt if tie: end = tie[0].getAttribute('end') if end == 'true': vz = 0 return vz def compVoice(sy,st,dVo1,dVo2): global merker1, merker2, resetMerker1, resetMerker2, formatTyp system = activeScore().system(sy) staff = system.staff(st) voice1 = staff.voice(0) voice2 = staff.voice(1) anz1 = voice1.nNoteObjs() anz2 = voice2.nNoteObjs() n1 = 0 n2 = 0 noten1 = getElementObjects(dVo1.getElementsByTagName('noteObjects')[0].childNodes) noten2 = getElementObjects(dVo2.getElementsByTagName('noteObjects')[0].childNodes) list0 = [ ] list1 = ['F'] list2 = ['F','C'] list3 = ['F','C','G'] list4 = ['F','C','G','D'] list5 = ['F','C','G','D','A'] list6 = ['F','C','G','D','A','E'] list7 = ['F','C','G','D','A','E','B'] listM1 = ['B'] listM2 = ['B','E'] listM3 = ['B','E','A'] listM4 = ['B','E','A','D'] listM5 = ['B','E','A','D','G'] listM6 = ['B','E','A','D','G','C'] listM7 = ['B','E','A','D','G','C','F'] while n1 < anz1: obj1 = voice1.noteObj(n1) if resetMerker1 == 1: # falls Taktstrich da war Listen löschen merker1 = [] merker2 = [] resetMerker1 = 0 if obj1.subType() == NoteObj.CHORD: # Liste mit den Noten des Taktes der Oberstimme erzeugen note1 = noten1[n1] hd1 = note1.getElementsByTagName('head') du1 = note1.getElementsByTagName('duration') al1 = note1.getElementsByTagName('alter') pi1 = hd1[0].getAttribute('pitch') if al1: fo1 = al1[0].getAttribute('display') # Format des Listenelements : else: fo1 = '0' if al1: st1 = al1[0].getAttribute('step') # NoStF else: st1 = '00' # No = Note z.B. A5 if st1 == '1': st1 = '+1' # St = Step ( 00 = kein, +1 = halber Ton höher, -1 = halber Ton tiefer, elif st1 == '2': st1 = '+2' ## +2 = 2 halbe Töne höher, -2 = 2 halbe Töne tiefer ) (Diese Zeile zugefügt (WW) elif st1 == '-1': st1 = '-1' # F = erzwungenes Vorzeichen ( 0 = kein, F = erzwungenes Vorzeichen ) elif st1 == '-2': st1 = '-2' ## (Diese Zeile zugefügt) (WW) elif st1 <> '1' or st1 <> '-1' or st1 <> '2' or st1 <> '-2': st1 = '00' ##(WW) zugefügt: or st1 <> '2' or st1 <> '-2' if fo1 == 'force': fo1 = 'F' else: fo1 = '0' no1 = pi1 + st1 + fo1 merker1.append(no1) else: merker1 = [] # falls keine Note oder Pause neuen Takt beginnen merker2 = [] n1 = n1 + 1 continue if obj1.implBarline(): # impliziten Taktstrich merken resetMerker1 = 1 if obj1.subType() == NoteObj.CHORD: # Position der Note in der Oberstimme merken opo1 = obj1.posX() while n2 < anz2: obj2 = voice2.noteObj(n2) if resetMerker2 == 1: # falls Taktstrich da war Listen löschen merker2 = [] resetMerker2 = 0 if obj2.implBarline(): resetMerker2 = 1 # impliziten Taktstrich merken if obj2.subType() == NoteObj.CHORD: opo2 = obj2.posX() note2 = noten2[n2] hd2 = note2.getElementsByTagName('head') du2 = note2.getElementsByTagName('duration') al2 = note2.getElementsByTagName('alter') pi2 = hd2[0].getAttribute('pitch') if al2: fo2 = al2[0].getAttribute('display') # Format des Listenelements : else: fo2 = '0' if al2: st2 = al2[0].getAttribute('step') # NoStF else: st2 = '00' # No = Note z.B. A5 if st2 == '1': st2 = '+1' # St = Step ( 00 = kein, +1 = halber Ton höher, -1 = halber Ton tiefer, elif st2 == '2': st2 = '+2' ## +2 = 2 halbe Töne höher, -2 = 2 halbe Töne tiefer ) (Diese Zeile zugefügt (WW) elif st2 == '-1': st2 = '-1' # F = erzwungenes Vorzeichen ( 0 = kein, F = erzwungenes Vorzeichen ) elif st2 == '-2': st2 = '-2' ## (Diese Zeile zugefügt) (WW) elif st2 <> '1' or st2 <> '-1' or st2 <> '2' or st2 <> '-2': st2 = '00' ##(WW) zugefügt: or st1 <> '2' or st1 <> '-2' if fo2 == 'force': fo2 = 'F' else: fo2 = '0' no2 = pi2 + st2 + fo2 merker2.append(no2) dpi1 = obj1.diatonicPitch(0)[0] #nur die Tonhöhe entnehmen dpi2 = obj2.diatonicPitch(0)[0] Ddpi = dpi1 - dpi2 if opo1 == opo2: #wenn die horizontale Position gleich ist ba2 = du2[0].getAttribute('base') if du2[0].hasAttribute('dots'): dt2 = du2[0].getAttribute('dots') else: dt2 = 'none' ba1 = du1[0].getAttribute('base') if du1[0].hasAttribute('dots'): dt1 = du1[0].getAttribute('dots') else: dt1 = 'none' offset = '0' # Noten positionieren (ausser Primeabstand) if Ddpi == 1: if ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '2/1': offset = '1' # Ohne Stimmenkreuzung: Sekundeabstand elif ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': offset = '1.50' elif ba1 == '1/1' and ba2 <> '2/1': offset = '1.50' elif ba1 == '1/1' and ba2 == '2/1': offset = '1.75' elif ba1 == '2/1': offset = '2.25' elif Ddpi == -1: if ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': offset = '-1' # Mit Stimmenkreuzung: Sekundeabstand elif ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': offset = '-1.5' elif ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': offset = '1.5' elif ba1 == '1/1' and ba2 == '1/1': offset = '1.5' elif ba1 == '1/1' and ba2 == '2/1': offset = '1.75' elif ba1 == '2/1': offset = '2.25' elif Ddpi == -2: # Mit Stimmenkreuzung: Terzabstand if ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': offset = '-0.5' elif ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': offset = '-1' elif ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': offset = '1.5' elif ba1 == '1/1' and ba2 == '1/1': offset = '1.5' elif ba1 == '1/1' and ba2 == '2/1': offset = '1.75' elif ba1 == '2/1': offset = '2.25' elif Ddpi < -2: # Mit Stimmenkreuzung: ab Quarteabstand if ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': offset = '-0.5' elif ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': offset = '-1' elif ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': offset = '-1.25' elif ba1 == '1/1' and ba2 == '1/1': offset = '1.5' elif ba1 == '1/1' and ba2 == '2/1': offset = '1.75' elif ba1 == '2/1' and ba2 <> '1/1' and ba2 <> '2/1': offset = '-0.5' elif ba1 == '2/1' and ba2 == '1/1': offset = '2' elif ba1 == '2/1' and ba2 == '2/1': offset = '2.25' if offset <> '0': display = addElementNode(note2,'display') display.setAttribute('xShift',str(offset)) vz1 = hasAlter(pi1,al1,hd1,note1,obj1,merker1) # hat die Oberstimme ein Vorzeichen ? vz2 = hasAlter(pi2,al2,hd2,note2,obj2,merker2) # hat die Unterstimme ein Vorzeichen ? ##(ww) Zeile 470 u.f. nach Zeile 1617 (da reagiert sie auf "offset == '0' ", hier nicht!) if Ddpi < -6: # Mit Stimmenkreuzung: ab Oktaveabstand if ba2 <> '1/1' and ba2 <> '2/1' and vz1 == 1: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-0.5') if -7 < Ddpi < -4: # Mit Stimmenkreuzung: Sexte- und Septimeabstand if vz1 == 1 and vz2 == 0 and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': # eine Note hat ein Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-0.5') if vz1 == 1 and vz2 == 0 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','0') if vz1 == 1 and vz2 == 0 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','0') if vz1 == 1 and vz2 == 0 and ba1 == '2/1' and ba2 <> '1/1' and ba2 <> '2/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-0.5') if vz1 == 1 and vz2 == 1 and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.75') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','0') if vz1 == 1 and vz2 == 1 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','0') if vz1 == 1 and vz2 == 1 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.5') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','0') if vz1 == 1 and vz2 == 1 and ba1 == '2/1' and ba2 <> '1/1' and ba2 <> '2/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.75') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','0') if Ddpi == -4: # Mit Stimmenkreuzung: Quinteabstand if vz1 == 1 and vz2 == 0 and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': # eine Note hat ein Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-0.5') if vz1 == 1 and vz2 == 0 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1') if vz1 == 1 and vz2 == 0 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') if vz1 == 0 and vz2 == 1 and ba1 == '1/1' and ba2 == '1/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1') if vz1 == 0 and vz2 == 1 and ba1 == '1/1' and ba2 == '2/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.25') if vz1 == 1 and vz2 == 0 and ba1 == '2/1' and ba2 <> '1/1' and ba2 <> '2/1': # eine Note hat ein Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-0.75') if vz1 == 0 and vz2 == 1 and ba1 == '2/1' and ba2 == '1/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2') if vz1 == 0 and vz2 == 1 and ba1 == '2/1' and ba2 == '2/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2.25') if vz1 == 1 and vz2 == 1 and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.75') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','0') if vz1 == 1 and vz2 == 1 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','0') if vz1 == 1 and vz2 == 1 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.5') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','0') if vz1 == 1 and vz2 == 1 and ba1 == '1/1' and ba2 == '1/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-0.75') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1') if vz1 == 1 and vz2 == 1 and ba1 == '1/1' and ba2 == '2/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-0.75') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.25') if vz1 == 1 and vz2 == 1 and ba1 == '2/1' and ba2 <> '1/1' and ba2 <> '2/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.75') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','0') if vz1 == 1 and vz2 == 1 and ba1 == '2/1' and ba2 == '1/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2') if vz1 == 1 and vz2 == 1 and ba1 == '2/1' and ba2 == '2/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2.25') if Ddpi == -3: # Mit Stimmenkreuzung: Quartabstand if vz1 == 1 and vz2 == 0 and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': # eine Note hat ein Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-0.5') if vz1 == 1 and vz2 == 0 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1') if vz1 == 1 and vz2 == 0 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') if vz1 == 0 and vz2 == 1 and ba1 == '1/1' and ba2 == '1/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.5') if vz1 == 0 and vz2 == 1 and ba1 == '1/1' and ba2 == '2/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.75') if vz1 == 1 and vz2 == 0 and ba1 == '2/1' and ba2 <> '1/1' and ba2 <> '2/1': # eine Note hat ein Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-0.75') if vz1 == 0 and vz2 == 1 and ba1 == '2/1' and ba2 == '1/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2') if vz1 == 0 and vz2 == 1 and ba1 == '2/1' and ba2 == '2/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2.25') if vz1 == 1 and vz2 == 1 and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.75') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','0') if vz1 == 1 and vz2 == 1 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','0') if vz1 == 1 and vz2 == 1 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.5') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','0') if vz1 == 1 and vz2 == 1 and ba1 == '1/1' and ba2 == '1/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.5') if vz1 == 1 and vz2 == 1 and ba1 == '1/1' and ba2 == '2/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.75') if vz1 == 1 and vz2 == 1 and ba1 == '2/1' and ba2 <> '1/1' and ba2 <> '2/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.75') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','0') if vz1 == 1 and vz2 == 1 and ba1 == '2/1' and ba2 == '1/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2') if vz1 == 1 and vz2 == 1 and ba1 == '2/1' and ba2 == '2/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2.25') if Ddpi == -2: # Mit Stimmenkreuzung: Terzabstand if vz1 == 1 and vz2 == 0 and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': # eine Note mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-0.5') if vz1 == 1 and vz2 == 0 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1') if vz1 == 0 and vz2 == 1 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.5') if vz1 == 0 and vz2 == 1 and ba1 == '1/1' and ba2 == '1/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.5') if vz1 == 0 and vz2 == 1 and ba1 == '1/1' and ba2 == '2/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.75') if vz1 == 0 and vz2 == 1 and ba1 == '2/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2.25') if vz1 == 1 and vz2 == 1 and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.75') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','0') if vz1 == 1 and vz2 == 1 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','0') if vz1 == 1 and vz2 == 1 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.5') if vz1 == 1 and vz2 == 1 and ba1 == '1/1' and ba2 == '1/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.5') if vz1 == 1 and vz2 == 1 and ba1 == '1/1' and ba2 == '2/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.75') if vz1 == 1 and vz2 == 1 and ba1 == '2/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2.25') if Ddpi == -1: # Mit Stimmenkreuzung: Sekundeabstand if vz1 == 1 and vz2 == 0 and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': # nur eine Note mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1') if vz1 == 1 and vz2 == 0 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.5') if vz1 == 0 and vz2 == 1 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.5') elif vz1 == 0 and vz2 == 1 and ba1 == '1/1' and ba2 == '1/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.5') elif vz1 == 0 and vz2 == 1 and ba1 == '1/1' and ba2 == '2/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2') elif vz1 == 0 and vz2 == 1 and ba1 == '2/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2.25') if vz1 == 1 and vz2 == 1 and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': # und beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.25') #(WW) bis 2019: -1 al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','0') #(WW) bis 2019: -1.25 if vz1 == 1 and vz2 == 1 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.75') #(WW) bis 2019: -1,5 al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','0') #(WW) bis 2019: -1.25 if vz1 == 1 and vz2 == 1 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.5') if vz1 == 1 and vz2 == 1 and ba1 == '1/1' and ba2 == '1/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.5') if vz1 == 1 and vz2 == 1 and ba1 == '1/1' and ba2 == '2/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.75') if vz1 == 1 and vz2 == 1 and ba1 == '2/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2.25') if 1 < Ddpi < 7 : # Ohne Stimmenkreuzung: von Terz- bis einschl.Septimabstand if vz1 == 1 and vz2 == 1: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','0') al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.25') if Ddpi == 1: # bei Sekundabstand ohne Stimmenkreuzung if vz2 == 1: # 1. Auflösung und Sekundabstand alter = addElementNode(hd2[0],'alter') # der Abstand der Noten zu klein ist und keine Prim alter.setAttribute('display','force') # Manchmal ist kein Alter Tag da, deshalb forcen if vz2 == 1 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '2/1': # und nur untere Note mit Vorzeichen; al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1') if vz2 == 1 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': # und nur untere Note mit Vorzeichen; al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.5') if vz2 == 1 and ba1 == '1/1' and ba2 <> '2/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-1.5') if vz2 == 1 and ba1 == '1/1' and ba2 == '2/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2') if vz2 == 1 and ba1 == '2/1': al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2.25') if vz1 == 1 and vz2 ==1 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '2/1': # Beide Noten mit Vorzeichen al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','0') #(WW) bis 2019: -1,25 al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2.25') #(WW) bis 2019: -1 if vz1 == 1 and vz2 == 1 and ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','0') #(WW) bis 2019: -1,25 al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2.75') #(WW) bis 2019: -1,5 if vz1 == 1 and vz2 == 1 and ba1 == '1/1' and ba2 <> '2/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','0') #(WW) bis 2019: -1,25 al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-2.75') #(WW) bis 2019: -1,5 if vz1 == 1 and vz2 == 1 and ba1 == '1/1' and ba2 == '2/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','0') #(WW) bis 2019: -1,25 al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-3') #(WW) bis 2019: -1,75 if vz1 == 1 and vz2 == 1 and ba1 == '2/1': al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','0') #(WW) bis 2019: -1,25 al2 = note2.getElementsByTagName('alter') al2[0].setAttribute('xShift','-3.5') #(WW) bis 2019: -2,25 d1 = 0 # Punktierung merken d2 = 0 if du1[0].hasAttribute('dots'): d1 = 1 if du2[0].hasAttribute('dots'): d2 = 1 if Ddpi == 0: if formatTyp == 0: # 'Alle Werte: Gleiche Köpfe --> keine Verschiebung' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/2' and ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/2' and ba2 <> '1/1' and ba2 <> '2/1': offset = '0' elif ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 1 and d2 == 0: offset = '-1.25' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') elif d1 == 1 and d2 == 1: offset = '2.5' elif ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': if d1 == 1 and d2 == 0: offset = '-1.75' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.75') elif d1 == 1 and d2 == 1: offset = '2.5' elif ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1 and d2 == 0: offset = '-2.25' else: offset = '1.5' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.25') elif d1 == 1 and d2 == 1: offset = '2.5' elif ba1 == '1/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0: offset = '1.75' elif d1 == 1 and d2 == 0: offset = '-1.25' elif d1 == 1 and d2 == 1: offset = '2.75' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') elif ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' elif ba1 == '2/1': if d1 == 0: offset = '2.25' if d1 == 1: offset = '3' if ba1 == ba2: # Wert gleich offset = '0' if formatTyp == 1: # Alle Werte: Gleiche Köpfe --> keine Verschiebung: Verschiebung nur nach Rechts' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/2' and ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/2' and ba2 <> '1/1' and ba2 <> '2/1': offset = '0' elif ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '2/1': if d1 == 1: offset = '2.5' else: offset = '1.25' elif ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1: offset = '2.5' else: offset = '1.5' elif ba1 == '1/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0: offset = '1.75' elif d1 == 1: offset = '2.75' elif ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' elif ba1 == '2/1': if d1 == 0: offset = '2.25' if d1 == 1: offset = '3' if ba1 == ba2: # normale Primverschiebung, Wert gleich offset = '0' if formatTyp == 2: # <= ½ Noten: Gleiche Köpfe --> keine Verschiebung' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/2' and ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/2' and ba2 <> '1/1' and ba2 <> '2/1': offset = '0' elif ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 1 and d2 == 0: offset = '-1.25' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') elif d1 == 1 and d2 == 1: offset = '2.5' elif ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': if d1 == 1 and d2 == 0: offset = '-1.75' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.75') elif d1 == 1 and d2 == 1: offset = '2.5' elif ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1 and d2 == 0: offset = '-2.25' else: offset = '1.5' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.25') elif d1 == 1 and d2 == 1: offset = '2.5' elif ba1 == '1/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0: offset = '1.75' elif d1 == 1 and d2 == 0: offset = '-1.25' elif d1 == 1 and d2 == 1: offset = '2.75' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') elif ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' elif ba1 == '2/1': if d1 == 0: offset = '2.25' if d1 == 1: offset = '3' if ba1 == ba2: # Wert gleich if ba1 <> '1/2' and ba1 <> '1/1' and ba1 <> '2/1': offset = '0' elif ba1 == '1/2': offset = '0' elif ba1 == '1/1': if d1 == 1: offset = '2.75' else: offset = '1.75' elif ba1 == '2/1': if d1 == 1: offset = '3.25' else: offset = '2.25' if formatTyp == 3: # <= ½ Noten: Gleiche Köpfe --> keine Verschiebung, Verschiebung nur nach Rechts' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/2' and ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/2' and ba2 <> '1/1' and ba2 <> '2/1': offset = '0' elif ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '2/1': if d1 == 1: offset = '2.5' else: offset = '1.25' elif ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1: offset = '2.5' else: offset = '1.5' elif ba1 == '1/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0: offset = '1.75' elif d1 == 1: offset = '2.75' elif ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' elif ba1 == '2/1': if d1 == 0: offset = '2.25' if d1 == 1: offset = '3' if ba1 == ba2: # normale Primverschiebung, Wert gleich if ba1 <> '1/2' and ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/2' and ba2 <> '1/1' and ba2 <> '2/1': offset = '0' #if (d1 == 0 or d1 == 1) and (d2 == 0 or d2 == 1): elif ba1 == '1/2': offset = '0' elif ba1 <> '1/1' and ba1 <> '2/1': if d1 == 0 and d2 == 1: offset = '1.25' elif d1 == 1 and d2 == 0: offset = '2.5' else: offset = '0' elif ba1 == '1/1': if d1 == 1: offset = '2.75' else: offset = '1.75' elif ba1 == '2/1': if d1 == 1: offset = '3.25' else: offset = '2.25' if formatTyp == 4: # 'Alle Werte: Gleiche Köpfe + Punktierung : --> keine Verschiebung' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 1 and d2 == 0: offset = '-1.25' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': if d1 == 1 and d2 == 0: offset = '-1.75' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.75') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1 and d2 == 0: offset = '-2.25' else: offset = '1.5' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.25') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 == '1/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0: offset = '1.75' elif d1 == 1 and d2 == 0: offset = '-1.25' elif d1 == 1 and d2 == 1: offset = '2.75' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') if ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' if ba1 == '2/1': if d1 == 0: offset = '2.25' if d1 == 1: offset = '3' elif ba1 <> '1/2' and ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/2' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0 and d2 == 0: offset = '0' if d1 == 1 and d2 == 1: offset = '0' # zugef. ww if ba1 == ba2: # Wert gleich if ba1 <> '1/1' and ba1 <> '2/1': if d1 == 0 and d2 == 1: offset = '1.25' elif d1 == 1 and d2 == 0: offset = '-1.25' else: offset = '0' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') elif ba1 == '1/1': if d1 == 1 and d2 == 0 : offset = '2.75' elif d1 == 0 and d2 == 1: offset = '1.75' else: offset = '0' elif ba1 == '2/1': if d1 == 1 and d2 == 0 : offset = '3.25' elif d1 == 0 and d2 == 1 : offset = '2.25' else: offset = '0' if formatTyp == 5: #Alle Werte: Gleiche Köpfe + Punktierung : --> keine Verschiebung, Verschiebung nur nach Rechts' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '2/1': if d1 == 1: offset = '2.5' else: offset = '1.25' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1: offset = '2.5' else: offset = '1.5' if ba1 == '1/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0: offset = '1.75' elif d1 == 1: offset = '2.75' if ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' if ba1 == '2/1': if d1 == 0: offset = '2.25' if d1 == 1: offset = '3' elif ba1 <> '1/2' and ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/2' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0 and d2 == 0: offset = '0' if d1 == 1 and d2 == 1: offset = '0' # zugef. ww if ba1 == ba2: # Wert gleich if ba1 <> '1/1' and ba1 <> '2/1': if d1 == 0 and d2 == 1: offset = '1.25' elif d1 == 1 and d2 == 0: offset = '2.5' else: offset = '0' elif ba1 == '1/1': if d1 == 1 and d2 == 0 : offset = '2.75' elif d1 == 0 and d2 == 1 : offset = '1.75' else: offset = '0' elif ba1 == '2/1': if d1 == 1 and d2 == 0: offset = '3.25' elif d1 == 0 and d2 == 1 : offset = '2.25' else: offset = '0' if formatTyp == 6: # ' <= ½ Noten: Gleiche Köpfe + Punktierung --> keine Verschiebung' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 1 and d2 == 0: offset = '-1.25' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': if d1 == 1 and d2 == 0: offset = '-1.75' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.75') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1 and d2 == 0: offset = '-2.25' else: offset = '1.5' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.25') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 == '1/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0: offset = '1.75' elif d1 == 1 and d2 == 0: offset = '-1.25' elif d1 == 1 and d2 == 1: offset = '2.75' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') if ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' if ba1 == '2/1': if d1 == 0: offset = '2.25' if d1 == 1: offset = '3' elif ba1 <> '1/2' and ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/2' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0 and d2 == 0: offset = '0' if d1 == 1 and d2 == 1: offset = '0' # zugef. ww if ba1 == ba2: # Wert gleich if ba1 <> '1/1' and ba1 <> '2/1': if d1 == 0 and d2 == 1: offset = '1.25' elif d1 == 1 and d2 == 0: offset = '-1.25' else: offset = '0' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') elif ba1 == '1/1': if d1 == 1: offset = '2.75' else: offset = '1.75' elif ba1 == '2/1': if d1 == 1: offset = '3.25' else: offset = '2.25' if formatTyp == 7: #' <= ½ Noten: Gleiche Köpfe + Punktierung --> keine Verschiebung, Verschiebung nur nach Rechts' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '2/1': if d1 == 1: offset = '2.5' else: offset = '1.25' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1: offset = '2.5' else: offset = '1.5' if ba1 == '1/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0: offset = '1.75' elif d1 == 1: offset = '2.75' if ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' if ba1 == '2/1': if d1 == 0: offset = '2.25' if d1 == 1: offset = '3' elif ba1 <> '1/2' and ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/2' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0 and d2 == 0: offset = '0' if d1 == 1 and d2 == 1: offset = '0' # zugef. ww if ba1 == ba2: # Wert gleich if ba1 <> '1/1' and ba1 <> '2/1': if d1 == 0 and d2 == 1: offset = '1.25' elif d1 == 1 and d2 == 0: offset = '2.5' else: offset = '0' elif ba1 == '1/1': if d1 == 1: offset = '2.75' else: offset = '1.75' elif ba1 == '2/1': if d1 == 1: offset = '3.25' else: offset = '2.25' if formatTyp == 8: # 'Alle Werte: Exakt gleicher Notenwert und, wenn nicht punktiert, gleiche Köpfe : --> keine Verschiebung' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 1 and d2 == 0: offset = '-1.25' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': if d1 == 1 and d2 == 0: offset = '-1.75' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.75') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1 and d2 == 0: offset = '-2.25' else: offset = '1.5' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.25') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 == '1/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0: offset = '1.75' elif d1 == 1 and d2 == 0: offset = '-1.25' elif d1 == 1 and d2 == 1: offset = '2.75' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') if ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' if ba1 == '2/1': if d1 == 0: offset = '2.25' if d1 == 1: offset = '3' elif ba1 <> '1/2' and ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/2' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0 and d2 == 0: offset = '0' if ba1 == ba2: # Wert gleich if ba1 <> '1/1' and ba1 <> '2/1': if d1 == 0 and d2 == 1: offset = '1.25' elif d1 == 1 and d2 == 0: offset = '-1.25' else: offset = '0' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') elif ba1 == '1/1': if d1 == 1 and d2 == 0 : offset = '2.75' elif d1 == 0 and d2 == 1 : offset = '1.75' else: offset = '0' elif ba1 == '2/1': if d1 == 1 and d2 == 0 : offset = '3.25' elif d1 == 0 and d2 == 1 : offset = '2.25' else: offset = '0' if formatTyp == 9: #'Alle Werte: Idem, Verschiebung nur nach Rechts' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '2/1': if d1 == 1: offset = '2.5' else: offset = '1.25' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1: offset = '2.5' else: offset = '1.5' if ba1 == '1/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0: offset = '1.75' elif d1 == 1: offset = '2.75' if ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' if ba1 == '2/1': if d1 == 0: offset = '2.25' elif d1 == 1: offset = '3' elif ba1 <> '1/2' and ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/2' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0 and d2 == 0: offset = '0' if ba1 == ba2: # Wert gleich if ba1 <> '1/1' and ba1 <> '2/1': if d1 == 0 and d2 == 1: offset = '1.25' elif d1 == 1 and d2 == 0: offset = '2.5' else: offset = '0' elif ba1 == '1/1': if d1 == 1 and d2 ==0 : offset = '2.75' elif d1 == 0 and d2 == 1: offset = '1.75' else: offset = '0' elif ba1 == '2/1': if d1 == 1 and d2 == 0 : offset = '3.25' elif d1 == 0 and d2 == 1 : offset = '2.25' else: offset = '0' if formatTyp == 10: # '<= ½ Noten: Exakt gleicher Notenwert und, wenn nicht punktiert, gleiche Köpfe --> keine Verschiebung' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 1 and d2 == 0: offset = '-1.25' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': if d1 == 1 and d2 == 0: offset = '-1.75' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.75') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1 and d2 == 0: offset = '-2.25' else: offset = '1.5' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.25') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 == '1/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0: offset = '1.75' elif d1 == 1 and d2 == 0: offset = '-1.25' elif d1 == 1 and d2 == 1: offset = '2.75' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') if ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' if ba1 == '2/1': if d1 == 0: offset = '2.25' elif d1 == 1: offset = '3' elif ba1 <> '1/2' and ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/2' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0 and d2 == 0: offset = '0' if ba1 == ba2: # Wert gleich if ba1 <> '1/1' and ba1 <> '2/1': if d1 == 0 and d2 == 1: offset = '1.25' elif d1 == 1 and d2 == 0: offset = '-1.25' else: offset = '0' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') elif ba1 == '1/1': if d1 == 1: offset = '2.75' else: offset = '1.75' elif ba1 == '2/1': if d1 == 1: offset = '3.25' else: offset = '2.25' if formatTyp == 11: #'<= ½ Noten: Idem, Verschiebung nur nach Rechts' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '2/1': if d1 == 1: offset = '2.5' else: offset = '1.25' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1: offset = '2.5' else: offset = '1.5' if ba1 == '1/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0: offset = '1.75' elif d1 == 1: offset = '2.75' if ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' if ba1 == '2/1': if d1 == 0: offset = '2.25' elif d1 == 1: offset = '3' elif ba1 <> '1/2' and ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/2' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0 and d2 == 0: offset = '0' if ba1 == ba2: # Wert gleich if ba1 <> '1/1' and ba1 <> '2/1': if d1 == 0 and d2 == 1: offset = '1.25' elif d1 == 1 and d2 == 0: offset = '2.5' else: offset = '0' elif ba1 == '1/1': if d1 == 1: offset = '2.75' else: offset = '1.75' elif ba1 == '2/1': if d1 == 1: offset = '3.25' else: offset = '2.25' if formatTyp == 12: #'Alle Werte: Exakt gleicher Notenwert : --> keine Verschiebung' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 1 and d2 == 0: offset = '-1.25' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': if d1 == 1 and d2 == 0: offset = '-1.75' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.75') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1 and d2 == 0: offset = '-2.25' else: offset = '1.5' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.25') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 == '1/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0: offset = '1.75' elif d1 == 1 and d2 == 0: offset = '-1.25' elif d1 == 1 and d2 == 1: offset = '2.75' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') if ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' if ba1 == '2/1': if d1 == 0: offset = '2.25' elif d1 == 1: offset = '3' if ba1 == ba2: # Wert gleich if ba1 == '1/2': offset = '0' if ba1 <> '1/1' and ba1 <> '2/1': if d1 == 0 and d2 == 1: offset = '1.25' elif d1 == 1 and d2 == 0: offset = '-1.25' else: offset = '0' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') if ba1 == '1/1': if d1 == 1 and d2 == 0 : offset = '2.75' elif d1 == 0 and d2 == 1: offset = '1.75' else: offset = '0' if ba1 == '2/1': if d1 == 1 and d2 == 0 : offset = '3.25' elif d1 == 0 and d2 == 1 : offset = '2.25' else: offset = '0' if formatTyp == 13: #'Alle Werte: Idem, Verschiebung nur nach Rechts' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '2/1': if d1 == 1: offset = '2.5' else: offset = '1.25' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1: offset = '2.5' else: offset = '1.5' if ba1 == '1/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 1: offset = '2.75' else: offset = '1.75' if ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' if ba1 == '2/1': if d1 == 0: offset = '2.25' elif d1 == 1: offset = '3' if ba1 == ba2: # Wert gleich if ba1 <> '1/1' and ba1 <> '2/1': if d1 == 0 and d2 == 1: offset = '1.25' elif d1 == 1 and d2 == 0: offset = '2.5' else: offset = '0' if ba1 == '1/1': if d1 == 1 and d2 == 0 : offset = '2.75' elif d1 == 0 and d2 == 1 : offset = '1.75' else: offset = '0' if ba1 == '2/1': if d1 == 1 and d2 == 0 : offset = '3.25' elif d1 == 0 and d2 == 1: offset = '2.25' else: offset = '0' if formatTyp == 14: #'<= ½ Noten: Exakt gleicher Notenwert --> keine Verschiebung' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 1 and d2 == 0: offset = '-1.25' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': if d1 == 1 and d2 == 0: offset = '-1.75' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.75') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1 and d2 == 0: offset = '-2.25' else: offset = '1.5' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.25') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 == '1/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0: offset = '1.75' elif d1 == 1 and d2 == 0: offset = '-1.25' elif d1 == 1 and d2 == 1: offset = '2.75' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') if ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' if ba1 == '2/1': if d1 == 0: offset = '2.25' if d1 == 1: offset = '3' if ba1 == ba2: # Wert gleich if ba1 == '1/2': offset = '0' if ba1 <> '1/1' and ba1 <> '2/1': if d1 == 0 and d2 == 1: offset = '1.25' elif d1 == 1 and d2 == 0: offset = '-1.25' else: offset = '0' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') if ba1 == '1/1': if d1 == 1: offset = '2.75' else: offset = '1.75' if ba1 == '2/1': if d1 == 1: offset = '3.25' else: offset = '2.25' if formatTyp == 15: #'<= ½ Noten: Idem, Verschiebung nur nach Rechts' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '2/1': if d1 == 1: offset = '2.5' else: offset = '1.25' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1: offset = '2.5' else: offset = '1.5' if ba1 == '1/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 1: offset = '2.75' else: offset = '1.75' if ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' if ba1 == '2/1': if d1 == 0: offset = '2.25' if d1 == 1: offset = '3' if ba1 == ba2: # Wert gleich if ba1 <> '1/1' and ba1 <> '2/1': if d1 == 0 and d2 == 1: offset = '1.25' elif d1 == 1 and d2 == 0: offset = '2.5' else: offset = '0' if ba1 == '1/1': if d1 == 1: offset = '2.75' else: offset = '1.75' if ba1 == '2/1': if d1 == 1: offset = '3.25' else: offset = '2.25' if formatTyp == 16: #'Alle Werte: Immer Primverschiebung' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 1 and d2 == 0: offset = '-1.25' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '1/1': if d1 == 1 and d2 == 0: offset = '-1.75' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.75') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1 and d2 == 0: offset = '-2.25' else: offset = '1.5' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-2.25') elif d1 == 1 and d2 == 1: offset = '2.5' if ba1 == '1/1' and ba2 <> '1/1' and ba2 <> '2/1': if d1 == 0: offset = '1.75' elif d1 == 1 and d2 == 0: offset = '-1.25' elif d1 == 1 and d2 == 1: offset = '2.75' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') if ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' if ba1 == '2/1': if d1 == 0: offset = '2.25' if d1 == 1: offset = '3' elif ba1 == ba2: # Wert gleich if ba1 <> '1/1' and ba1 <> '2/1': if d1 == 0 and d2 == 1: offset = '1.25' elif d1 == 1 and d2 == 0: offset = '-1.25' else: offset = '1.25' if vz1 == 1 and d1 == 1 and d2 == 0: al1 = note1.getElementsByTagName('alter') al1[0].setAttribute('xShift','-1.25') elif d1 == 1 and d2 == 1: offset = '2.5' elif ba1 == '1/1': if d1 == 1: offset = '2.75' else: offset = '1.75' elif ba1 == '2/1': if d1 == 1: offset = '3.25' else: offset = '2.25' if formatTyp == 17: #'Alle Werte: Idem, Verschiebung nur nach Rechts' if ba1 <> ba2: # Wert ungleich if ba1 <> '1/1' and ba1 <> '2/1' and ba2 <> '2/1': if d1 == 1: offset = '2.5' else: offset = '1.25' if ba1 <> '1/1' and ba1 <> '2/1' and ba2 == '2/1': if d1 == 1: offset = '2.5' else: offset = '1.5' if ba1 == '1/1' and ba2 <> '2/1': if d1 == 0: offset = '1.75' elif d1 == 1: offset = '2.75' if ba1 == '1/1' and ba2 == '2/1': if d1 == 0: offset = '2' elif d1 == 1: offset = '2.75' if ba1 == '2/1': if d1 == 0: offset = '2.25' if d1 == 1: offset = '3' elif ba1 == ba2: #Wert gleich if ba1 <> '1/1' and ba1 <> '2/1': if d1 == 1: offset = '2.5' else: offset = '1.25' elif ba1 == '1/1': if d1 == 1: offset = '2.75' else: offset = '1.75' elif ba1 == '2/1': if d1 == 1: offset = '3.25' else: offset = '2.25' if offset <> '0': # (WW) '0' war 0 display = addElementNode(note2,'display') display.setAttribute('xShift',str(offset)) if vz1 == 1 and vz2 == 1 and st1 == st2: # Noten m. gleiches Vorzeichen((WW)zugef.: st1 == st2)) if al2: al2[0].setAttribute('display','suppress') # dann eines unterdrücken else: alter = addElementNode(hd2[0],'alter') alter.setAttribute('display','suppress') if pi1 == pi2 and dt1 == dt2 and d2 == 1 and ba1 == ba2 and offset == '0': # falls gleicher Ton,Wert,punktiert,keine Noten-Schiebung dis = addElementNode(note2,'display') # Punkt unten dis.setAttribute('dotsInvisible','true') # unsichtbar n2 = n2 + 1 n1 = n1 + 1 n2 = 0 merker2 = [] def changeDoc(score): global doc, merker1, merker2, resetMerker1, resetMerker2 merker1 = [] #leere Liste merker2 = [] resetMerker1 = 0 resetMerker2 = 0 doc = score.parentNode systems = score.getElementsByTagName('system') for sy in range(systems.length): staves = systems[sy].getElementsByTagName('staff') #erzeugt Liste mit DOM Elementen for st in range(staves.length): voices = staves[st].getElementsByTagName('voice') #erzeugt Liste mit DOM Elementen vl = voices.length if vl > 1: #nur wenn mindestens 2 Stimmen voice1 = voices[0] #DOM Element extrahieren voice2 = voices[1] #DOM Element extrahieren #if voice1.hasAttribute('stemDir') and voice1.getAttribute('stemDir') == 'up': # if voice2.hasAttribute('stemDir') and voice2.getAttribute('stemDir') == 'down': result = compVoice(sy,st,voice1,voice2) def vzDialog(): global formatTyp options = ScriptOptions() opt = options.get() placeholder1 = Label(' ',width=1) placeholder2 = Label(' ',width=1) placeholder3 = Label(' ',width=1) placeholder4 = Label(' ',width=1) radFormatTyp = Radio([tr('allSimilarHeads'),tr('allShRight'), tr('inclHalfNotes'),tr('inclHalfNotesShRight'), tr('allSimilarHeadsDots'),tr('allShRight'), tr('inclHalfNotes'),tr('inclHalfNotesShRight'), tr('allSmilarDurationDots'),tr('allShRight'), tr('inclHalfNotesStandard'),tr('inclHalfNotesShRight'), tr('allSimilarDuration'),tr('allShRight'), tr('inclHalfNotes'),tr('inclHalfNotesShRight'), tr('always'),tr('allShRight')], text=tr('options'),value=int(opt.get('formatTyp',10))) box = VBox([radFormatTyp,placeholder1],padding=1) dlg = Dialog(tr('header') + version, box, help=tr('help')) if dlg.run(): formatTyp = radFormatTyp.value() opt.update(dict(formatTyp=formatTyp)) options.set(opt) return True else: return False # Hauptprogramm: from caplib.capDOM import ScoreChange import tempfile class ScoreChange(ScoreChange): def changeScore(self, score): changeDoc(score) if activeScore(): if vzDialog(): activeScore().registerUndo("Vorzeichen_Schieber") tempInput = tempfile.mktemp('.capx') tempOutput = tempfile.mktemp('.capx') activeScore().write(tempInput) ScoreChange(tempInput, tempOutput) activeScore().read(tempOutput) os.remove(tempInput) os.remove(tempOutput)