et¶
Package for equal tempered microtones.
Classes
ET bundle. |
- class abjadext.microtones.et.ETBundle(pitch="c'", accidental_string=None)[source]¶
ET bundle.
>>> from abjadext import microtones
Attributes Summary
Gets interpreter representation.
Special methods
Functions
Applies alteration. |
|
Gets accidental value. |
|
Gets alteration. |
|
Gets value sum. |
- abjadext.microtones.et.apply_alteration(note_head, value, spell=None)[source]¶
Applies alteration.
Eighth tone accidentals:
>>> from quicktions import Fraction >>> steps = [0, "1/8", "2/8", "3/8", "4/8", "5/8", "6/8", "7/8", 1] >>> steps = [Fraction(step) * 2 for step in steps] >>> reverse_steps = [0 - step for step in steps] >>> reverse_steps.reverse() >>> total_steps = [] >>> total_steps.extend(reverse_steps) >>> total_steps.extend(steps) >>> final_steps = sorted(list(set(total_steps))) >>> notes = [abjad.Note("c'4") for step in final_steps] >>> for note, step in zip(notes, final_steps): ... microtones.apply_alteration(note.note_head, step) ... >>> staff = abjad.Staff(notes) >>> score = abjad.Score([staff]) >>> moment = "#(ly:make-moment 1 25)" >>> abjad.setting(score).proportional_notation_duration = moment >>> lilypond_file = abjad.LilyPondFile( ... items=[score, abjad.Block(name="layout")], ... includes=[ ... "default.ily", ... "abjad.ily", ... "all-edo-markups-example.ily", ... ], ... global_staff_size=16, ... ) >>> style = '"dodecaphonic"' >>> lilypond_file.layout_block.items.append(fr"\accidentalStyle {style}") >>> abjad.show(lilypond_file)
Tenth tone accidentals:
>>> from quicktions import Fraction >>> steps = [ ... 0, ... "1/10", ... "2/10", ... "3/10", ... "4/10", ... "5/10", ... "6/10", ... "7/10", ... "8/10", ... "9/10", ... 1, ... ] >>> steps = [Fraction(step) * 2 for step in steps] >>> reverse_steps = [0 - step for step in steps] >>> reverse_steps.reverse() >>> total_steps = [] >>> total_steps.extend(reverse_steps) >>> total_steps.extend(steps) >>> final_steps = sorted(list(set(total_steps))) >>> notes = [abjad.Note("c'4") for step in final_steps] >>> for note, step in zip(notes, final_steps): ... microtones.apply_alteration(note.note_head, step) ... >>> staff = abjad.Staff(notes) >>> score = abjad.Score([staff]) >>> moment = "#(ly:make-moment 1 25)" >>> abjad.setting(score).proportional_notation_duration = moment >>> lilypond_file = abjad.LilyPondFile( ... items=[score, abjad.Block(name="layout")], ... includes=[ ... "default.ily", ... "abjad.ily", ... "all-edo-markups-example.ily", ... ], ... global_staff_size=16, ... ) >>> style = '"dodecaphonic"' >>> lilypond_file.layout_block.items.append(fr"\accidentalStyle {style}") >>> abjad.show(lilypond_file)
Twelfth tone accidentals:
>>> from quicktions import Fraction >>> steps = [ ... 0, ... "1/12", ... "2/12", ... "3/12", ... "4/12", ... "5/12", ... "6/12", ... "7/12", ... "8/12", ... "9/12", ... "10/12", ... "11/12", ... 1, ... ] >>> steps = [Fraction(step) * 2 for step in steps] >>> reverse_steps = [0 - step for step in steps] >>> reverse_steps.reverse() >>> total_steps = [] >>> total_steps.extend(reverse_steps) >>> total_steps.extend(steps) >>> final_steps = sorted(list(set(total_steps))) >>> notes = [abjad.Note("c'4") for step in final_steps] >>> for note, step in zip(notes, final_steps): ... microtones.apply_alteration(note.note_head, step) ... >>> staff = abjad.Staff(notes) >>> score = abjad.Score([staff]) >>> moment = "#(ly:make-moment 1 25)" >>> abjad.setting(score).proportional_notation_duration = moment >>> lilypond_file = abjad.LilyPondFile( ... items=[score, abjad.Block(name="layout")], ... includes=[ ... "default.ily", ... "abjad.ily", ... "all-edo-markups-example.ily", ... ], ... global_staff_size=16, ... ) >>> style = '"dodecaphonic"' >>> lilypond_file.layout_block.items.append(fr"\accidentalStyle {style}") >>> abjad.show(lilypond_file)
Spells with sharps when
spell="sharp"
:>>> step = "3/2" >>> note = abjad.Note("c'4") >>> microtones.apply_alteration(note.note_head, step, spell="sharp") >>> staff = abjad.Staff([note]) >>> score = abjad.Score([staff]) >>> moment = "#(ly:make-moment 1 25)" >>> abjad.setting(score).proportional_notation_duration = moment >>> lilypond_file = abjad.LilyPondFile( ... items=[score, abjad.Block(name="layout")], ... includes=[ ... "default.ily", ... "abjad.ily", ... "all-edo-markups-example.ily", ... ], ... global_staff_size=16, ... ) >>> style = '"dodecaphonic"' >>> lilypond_file.layout_block.items.append(fr"\accidentalStyle {style}") >>> abjad.show(lilypond_file)
Spells with flats when
spell="flat"
:>>> step = "3/2" >>> note = abjad.Note("c'4") >>> microtones.apply_alteration(note.note_head, step, spell="flat") >>> staff = abjad.Staff([note]) >>> score = abjad.Score([staff]) >>> moment = "#(ly:make-moment 1 25)" >>> abjad.setting(score).proportional_notation_duration = moment >>> lilypond_file = abjad.LilyPondFile( ... items=[score, abjad.Block(name="layout")], ... includes=[ ... "default.ily", ... "abjad.ily", ... "all-edo-markups-example.ily", ... ], ... global_staff_size=16, ... ) >>> style = '"dodecaphonic"' >>> lilypond_file.layout_block.items.append(fr"\accidentalStyle {style}") >>> abjad.show(lilypond_file)
- abjadext.microtones.et.get_accidental_value(pitch)[source]¶
Gets accidental value.
>>> pitch = abjad.NamedPitch("cs'") >>> microtones.get_accidental_value(pitch) 1
- abjadext.microtones.et.get_alteration(pitch, value, spell=None)[source]¶
Gets alteration.
>>> pitch = abjad.NumberedPitch(0) >>> bundle = microtones.get_alteration(pitch, "2/1") >>> bundle.pitch NumberedPitch(2)
>>> bundle.accidental_string '\\abjad-natural-markup'
>>> pitch = abjad.NumberedPitch(0) >>> bundle = microtones.get_alteration(pitch, "1/1") >>> bundle.pitch NumberedPitch(1)
>>> bundle.accidental_string '\\abjad-sharp-markup'
>>> pitch = abjad.NumberedPitch(0) >>> bundle = microtones.get_alteration(pitch, "1/1", "flat") >>> bundle.pitch NamedPitch("df'")
>>> bundle.accidental_string '\\abjad-flat-markup'
>>> pitch = abjad.NumberedPitch(0) >>> bundle = microtones.get_alteration(pitch, "3/2", "sharp") >>> bundle.pitch NumberedPitch(1)
>>> bundle.accidental_string '\\three-quarters-sharp-markup'
>>> pitch = abjad.NumberedPitch(0) >>> bundle = microtones.get_alteration(pitch, "11/6", "sharp") >>> bundle.pitch NumberedPitch(1)
>>> bundle.accidental_string '\\eleven-twelfths-sharp-markup'