Tab Generation
ci / checks (push) Successful in 1h19m14s

This commit is contained in:
khodowany
2026-09-20 16:20:43 -05:00
parent 68ded4d8c8
commit cf7c0c010c
423 changed files with 1422 additions and 1332 deletions
+4 -8
View File
@@ -141,6 +141,8 @@ class Importer:
self.attrs(item, {'number', 'additional', 'size', 'after-barline', 'print-object'})
self.children(item, {'sign', 'line', 'clef-octave-change'})
sign = item.findtext('sign')
if sign == 'TAB':
self.fail('authored TAB is unsupported; guitar tablature is generated from pitches')
if sign not in ('G', 'F', 'C', 'percussion', 'TAB', 'none'):
self.fail(f'unsupported clef {sign!r}')
line = self.number(item.findtext('line', {'G': '2', 'F': '4'}.get(sign, '3')), integer=True)
@@ -434,10 +436,7 @@ class Importer:
self.children(notations, {'tied', 'tuplet', 'ornaments', 'technical'})
for item in notations:
if item.tag == 'technical':
self.children(item, {'string', 'fret'})
if note['kind'] != 'note' or item.find('string') is None or item.find('fret') is None:
self.fail('tablature requires a string and fret on a note')
note['pitches'][-1]['tablature'] = {'string': self.number(item.findtext('string'), integer=True, positive=True), 'fret': self.number(item.findtext('fret'), integer=True)}
self.fail('authored TAB and finger instructions are unsupported; guitar positions are generated')
if item.tag == 'tuplet' and not is_chord:
number, action = (voice, item.get('number', '1')), item.get('type')
self.attrs(item, {'number', 'type', 'bracket', 'show-number', 'show-type', 'line-shape'})
@@ -524,13 +523,10 @@ class Importer:
for item in root.findall('identification/miscellaneous/miscellaneous-field'):
name = item.get('name', '')
if name.startswith('vamp:'):
if name not in ('vamp:style', 'vamp:tonic') or name in fields:
if name != 'vamp:style' or name in fields:
self.fail(f'unknown or duplicate Vamp property {name!r}')
fields[name] = item.text or ''
metadata = {'title': root.findtext('work/work-title') or root.findtext('movement-title') or self.path.stem, 'composer': ' / '.join(c.text for c in root.findall('identification/creator') if c.get('type') == 'composer' and c.text), 'style': canonical_style(fields.get('vamp:style'))}
if 'vamp:tonic' in fields:
from generator.model import parse_pitch_name
metadata['transpose_origin'] = parse_pitch_name(fields['vamp:tonic'])
measures = []
self.children(parts[0], {'measure'})
for index, bar in enumerate(parts[0]):