Changes to triplet characters

This commit is contained in:
2023-12-10 14:45:58 +02:00
parent 9bd4ec0ff0
commit 7cfc92db3d
5 changed files with 82 additions and 40 deletions

View File

@ -1,5 +1,5 @@
"""Collection of converters"""
from ziffers import zparse, Ziffers, Pitch, Rest, Chord, accidentals_from_note_name
from ziffers import zparse, Ziffers, Pitch, Rest, Chord, accidentals_from_note_name, MODES, MODE_ACCIDENTALS
try:
from music21 import converter, note, stream, meter, chord, environment, tempo, key
@ -102,8 +102,16 @@ if music21_imported:
if "key" in options:
accidentals = accidentals_from_note_name(options["key"])
if "scale" in options and options["scale"].upper() == "MINOR":
accidentals-=3 # If minor, subtract 3 from accidentals
else:
accidentals = 0
if "scale" in options:
scale_upper = options["scale"].upper()
scale_lower = options["scale"].lower()
if scale_upper in MODES:
accidentals += MODE_ACCIDENTALS[scale_upper]
note_stream.append(key.KeySignature(accidentals,mode=scale_lower))
else:
note_stream.append(key.KeySignature(accidentals))
if "bpm" in options: