ji¶
Package for Just Intonation.
Classes
JI bundle. |
|
JI vector. |
- class abjadext.microtones.ji.JIBundle(pitch="c'", vector=JIVector(diatonic_accidental='natural', syntonic_commas_down=0, syntonic_commas_up=0, septimal_commas_down=0, septimal_commas_up=0, undecimal_quarter_tones_down=0, undecimal_quarter_tones_up=0, tridecimal_third_tones_down=0, tridecimal_third_tones_up=0, seventeen_limit_schismas_down=0, seventeen_limit_schismas_up=0, nineteen_limit_schismas_down=0, nineteen_limit_schismas_up=0, twenty_three_limit_commas_down=0, twenty_three_limit_commas_up=0))[source]¶
JI bundle.
>>> bundle = microtones.JIBundle() >>> bundle.pitch "c'"
>>> print(abjad.storage(bundle.vector)) microtones.JIVector( diatonic_accidental='natural', syntonic_commas_down=0, syntonic_commas_up=0, septimal_commas_down=0, septimal_commas_up=0, undecimal_quarter_tones_down=0, undecimal_quarter_tones_up=0, tridecimal_third_tones_down=0, tridecimal_third_tones_up=0, seventeen_limit_schismas_down=0, seventeen_limit_schismas_up=0, nineteen_limit_schismas_down=0, nineteen_limit_schismas_up=0, twenty_three_limit_commas_down=0, twenty_three_limit_commas_up=0, )
Attributes Summary
Gets interpreter representation.
Special methods
- overridden __repr__()[source]¶
Gets interpreter representation.
>>> microtones.JIBundle() JIBundle(pitch="c'", vector=JIVector(diatonic_accidental='natural', syntonic_commas_down=0, syntonic_commas_up=0, septimal_commas_down=0, septimal_commas_up=0, undecimal_quarter_tones_down=0, undecimal_quarter_tones_up=0, tridecimal_third_tones_down=0, tridecimal_third_tones_up=0, seventeen_limit_schismas_down=0, seventeen_limit_schismas_up=0, nineteen_limit_schismas_down=0, nineteen_limit_schismas_up=0, twenty_three_limit_commas_down=0, twenty_three_limit_commas_up=0))
- class abjadext.microtones.ji.JIVector(diatonic_accidental='natural', syntonic_commas_down=0, syntonic_commas_up=0, septimal_commas_down=0, septimal_commas_up=0, undecimal_quarter_tones_down=0, undecimal_quarter_tones_up=0, tridecimal_third_tones_down=0, tridecimal_third_tones_up=0, seventeen_limit_schismas_down=0, seventeen_limit_schismas_up=0, nineteen_limit_schismas_down=0, nineteen_limit_schismas_up=0, twenty_three_limit_commas_down=0, twenty_three_limit_commas_up=0)[source]¶
JI vector.
>>> from abjadext import microtones
>>> vector = microtones.JIVector(syntonic_commas_down=2) >>> vector.syntonic_commas_down 2
>>> vector = microtones.JIVector(syntonic_commas_down=2) >>> vector.syntonic_commas_up 0
Attributes Summary
Gets interpreter representation.
Calculates JI markup.
Is true when vector has just accidentals.
Special methods
- overridden __repr__()[source]¶
Gets interpreter representation.
>>> microtones.JIVector() JIVector(diatonic_accidental='natural', syntonic_commas_down=0, syntonic_commas_up=0, septimal_commas_down=0, septimal_commas_up=0, undecimal_quarter_tones_down=0, undecimal_quarter_tones_up=0, tridecimal_third_tones_down=0, tridecimal_third_tones_up=0, seventeen_limit_schismas_down=0, seventeen_limit_schismas_up=0, nineteen_limit_schismas_down=0, nineteen_limit_schismas_up=0, twenty_three_limit_commas_down=0, twenty_three_limit_commas_up=0)
Methods
Functions
Makes JI bundle. |
|
Transposes notehead in place and tweaks accidental stencil. |
- abjadext.microtones.ji.make_ji_bundle(pitch, ratio)[source]¶
Makes JI bundle.
>>> bundle = microtones.make_ji_bundle(abjad.NamedPitch("c'"), "3/2") >>> bundle.pitch NamedPitch("g'")
>>> print(abjad.storage(bundle.vector)) microtones.JIVector( diatonic_accidental='natural', syntonic_commas_down=0, syntonic_commas_up=0, septimal_commas_down=0, septimal_commas_up=0, undecimal_quarter_tones_down=0, undecimal_quarter_tones_up=0, tridecimal_third_tones_down=0, tridecimal_third_tones_up=0, seventeen_limit_schismas_down=0, seventeen_limit_schismas_up=0, nineteen_limit_schismas_down=0, nineteen_limit_schismas_up=0, twenty_three_limit_commas_down=0, twenty_three_limit_commas_up=0, )
- abjadext.microtones.ji.return_cent_deviation_markup(ratio=1, fundamental="a'", chris=False)[source]¶
- abjadext.microtones.ji.tune_to_ratio(note_head, ratio, *, omit_just_accidental=False, tempered=False)[source]¶
Transposes notehead in place and tweaks accidental stencil.
All implemented accidentals are available for both stylesheets:
>>> note = abjad.Note("c'4") >>> microtones.tune_to_ratio(note.note_head, "7/4") >>> 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", "ekmelos-ji-accidental-markups.ily"], ... global_staff_size=16, ... ) >>> style = '"dodecaphonic"' >>> lilypond_file.layout_block.items.append(fr"\accidentalStyle {style}") >>> abjad.show(lilypond_file)
>>> note = abjad.Note("c'4") >>> microtones.tune_to_ratio(note.note_head, "7/4") >>> 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", "heji2-ji-accidental-markups.ily"], ... global_staff_size=16, ... ) >>> style = '"dodecaphonic"' >>> lilypond_file.layout_block.items.append(fr"\accidentalStyle {style}") >>> abjad.show(lilypond_file)
Tweaks accidentals when
omit_just_accidental=False
:>>> note = abjad.Note("c'4") >>> microtones.tune_to_ratio(note.note_head, "5/1", omit_just_accidental=False) >>> print(abjad.lilypond(note)) \tweak Accidental.stencil #ly:text-interface::print \tweak Accidental.text \markup { \natural-one-syntonic-comma-down } e'''4
Does not tweak accidentals when
omit_just_accidental=True
:>>> note = abjad.Note("c'4") >>> microtones.tune_to_ratio(note.note_head, "5/1", omit_just_accidental=True) >>> print(abjad.lilypond(note)) e'''4
A harmonic series with the ekmelos font.
>>> ratios = [f"{_ + 1}/1" for _ in range(23)] >>> notes = [abjad.Note("a,,,8") for _ in ratios] >>> for note, ratio in zip(notes, ratios): ... microtones.tune_to_ratio(note.note_head, ratio) ... >>> staff = abjad.Staff() >>> staff.extend(notes) >>> abjad.attach(abjad.Clef("bass"), staff[0]) >>> abjad.attach(abjad.Clef("treble"), staff[6]) >>> 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", ... "harmonic-series-layout.ily", ... "ekmelos-ji-accidental-markups.ily", ... ], ... global_staff_size=16, ... ) >>> style = '"dodecaphonic"' >>> lilypond_file.layout_block.items.append(fr"\accidentalStyle {style}") >>> abjad.show(lilypond_file)
A harmonic series with the HEJI2 font.
>>> ratios = [f"{_ + 1}/1" for _ in range(23)] >>> notes = [abjad.Note("a,,,8") for _ in ratios] >>> for note, ratio in zip(notes, ratios): ... microtones.tune_to_ratio(note.note_head, ratio) ... >>> staff = abjad.Staff() >>> staff.extend(notes) >>> abjad.attach(abjad.Clef("bass"), staff[0]) >>> abjad.attach(abjad.Clef("treble"), staff[6]) >>> abjad.attach(abjad.TimeSignature((24, 32)), staff[0]) >>> 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", ... "harmonic-series-layout.ily", ... "heji2-ji-accidental-markups.ily", ... ], ... global_staff_size=16, ... ) >>> style = '"dodecaphonic"' >>> lilypond_file.layout_block.items.append(fr"\accidentalStyle {style}") >>> abjad.show(lilypond_file)
Prints tempered accidentals when
tempered=True
:>>> note = abjad.Note("c'4") >>> microtones.tune_to_ratio(note.note_head, "5/1", tempered=True) >>> 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", "ekmelos-ji-accidental-markups.ily"], ... global_staff_size=16, ... ) >>> style = '"dodecaphonic"' >>> lilypond_file.layout_block.items.append(fr"\accidentalStyle {style}") >>> abjad.show(lilypond_file)