Xenharmlib: A music theory library that supports non-western harmonic systems

https://news.ycombinator.com/rss Hits: 20
Summary

Welcome to xenharmlib’s documentation! Xenharmonic (adj.): Pertaining to music which sounds unlike that composed in the familiar 12 tone equal-tempered scale. —Ivor Darreg Xenharmlib is a generalized music theory library that supports traditional Western and non-western harmonic systems, unconventional microtonal and macrotonal tunings, diatonic and posttonal set theory and non-standard notations. It is easy to use, extendable, and tries to be intuitive. Have a peek: from xenharmlib import WesternNotation from xenharmlib.periodic import mod_connectors n = WesternNotation() # find out which I-III-V triads can be used # to modulate between d minor and g major d_minor = n.pc_scale(['D', 'E', 'F', 'G', 'A', 'Bb', 'C']) g_major = n.pc_scale(['G', 'A', 'B', 'C', 'D', 'E', 'F#']) for c in mod_connectors(d_minor, g_major, (0, 2, 4)): print(c) WesternNoteScale([A0, C1, E1]) WesternNoteScale([C1, E1, G1]) from xenharmlib import EDOTuning from xenharmlib import play from xenharmlib import UpDownNotation # create a supermajor 7 chord on vD for an # equal temperament with 31 notes per octave edo31 = EDOTuning(31) n_edo31 = UpDownNotation(edo31) d_down = n_edo31.note('vD', 4) SM3 = n_edo31.shorthand_interval('^M', 3) P5 = n_edo31.shorthand_interval('P', 5) m7 = n_edo31.shorthand_interval('m', 7) chord = n_edo31.scale( [ d_down, d_down.transpose(SM3), d_down.transpose(P5), d_down.transpose(m7), ] ) print(chord) UpDownNoteScale([vD4, F#4, vA4, vC5], 31-EDO) Your browser does not support the audio element. play(chord, duration=1, play_as_chord=True) Your browser does not support the audio element. from xenharmlib import EDTuning from xenharmlib import FrequencyRatio # analyze group theoretical properties of # Bohlen-Pierce tunings bp = EDTuning(13, FrequencyRatio(3)) p1 = bp.pitch(4) p2 = bp.pitch(18) i1 = bp.interval(p1, p2) print(p1.pc_index) print(p2.pc_index) print(i1.frequency_ratio) dist = i1.get_generator_distance( bp.pitch(7) ) print(dist) Audience & Design Philosophy Xenhar...

First seen: 2025-07-09 00:32

Last seen: 2025-07-10 14:42