Xenharmlib 0.3.0 has just been released. Find out what’s new
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)
play ( chord )
... continue reading