HackerTrans
TopNewTrendsCommentsPastAskShowJobs

retooth

no profile record

Submissions

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

xenharmlib.readthedocs.io
208 points·by retooth·vorig jaar·19 comments

comments

retooth
·vorig jaar·discuss
Maybe I should double down and rename it "harmful" as in "full of harmonies" ;)
retooth
·vorig jaar·discuss
Since xenharmlib is written in python it is not suitable for real-time audio because of the latency that an interpreted language introduces.

I think if someone was willing they could port the library to C or Rust rather easily, because apart from Exceptions the coding style is functional and stateless. AFAIK Rust has some libraries that provide a VST interface.
retooth
·vorig jaar·discuss
1. Thanks for the link. I am reading a bit of your code right now :) Also nice to see that it is GPL licensed too. In regards to intervals: What still confuses me in the design process is that in certain uneven tunings, (e.g. Pythagorean) there seems to be two approaches to naming intervals. One would be an "absolute" approach, where intervals that do not form a 5/4 ratio would not be considered a major third, and one "functional" approach, where the exact frequency ratio does not matter and the interval name is simply deduced from the note names (D to F# is a major third even tough the ratio is 81/64)

2. I'm not sure what you exactly mean by sub-scales. Imho the best approach in xenharmlib to define maqams from ajnas would be to define ajnas as interval sequences in 24-EDO and then concatenate them with + to a maqam interval sequences. Then you can use the result to define maqams on any note.

3. Thanks for the links. I will add something soon ;) I also tried my luck on the MEI Slack channel but did not receive any response. I think MusicXML might be a good format for exporting xenharmonic data, but importing from it is tricky. In certain temperaments the cent values have so many digits after the point that importing would be forced to apply heuristics for rounding errors :/

4. Option a) is currently the one I use, but I am somewhat unhappy about it, because it requires a "tacit" understanding between two programs of how exactly the 128 notes are redefined (also 128 is not plenty, just think of turkish makam that has 53 notes per octave. That is barely 2 octaves in this system). My hopes are currently on MIDI 2.
retooth
·vorig jaar·discuss
I often used this for reference: https://musictheory.pugetsound.edu/mt21c/MusicTheory.html
retooth
·vorig jaar·discuss
Hi! I'll try to answer in order:

1. Just Intonation and non-linear temperaments are on the roadmap, but there are a couple of design problems I still have to figure out, mainly how to have a consistent definition of interval objects in regards to transposition if the distances between notes are uneven. It works nicely, if one uses multi-dimensional tunings, e.g. in a 5-Limit tuning with 3 dimensions every interval obtained from two notes can be applied to any other note as a measure of transposition distance, but once you reduce it to one dimension you can have two notes which form an interval that can not be applied to every note without reaching a note that is outside the temperament.

2. Tetrachords are already supported and can be easily defined using the scale object. There is no quartertone notation yet, but if you are happy with Up/Down Notation you can analyze arabic ajnas by using EDOTuning(24) as the base. Currently there is no pitch/note sequence object, so downward scale movement in maqams can not be properly defined, but if you are interested only in the harmonic qualities, scales should do.

3. MusicXML sadly does not have good support for non-12-EDO tunings. You can define quartertone accidentals by providing floats (like 0.5) as accidental values, but this gets increasingly difficult if you want to do anything other than 24-EDO. I looked into the MEI format as it supports at least turkish makam accidentals, but a more generalized semantic definition for arbitrary EDOs seems to be out of reach for the foreseeable future. One could however think of supporting MEI for a couple of tunings (like 24- or 53-EDO)

4. MIDI is also somewhat difficult. There is the MPE specification which allows individual note bending, however it is not supported by any python library as far as I can tell. One could try to hack something with channel pitch bends, but it would be limited to playing 16 notes at the same time.

I am still looking for contributors, so if you are interested in these things, feel free to contact me ;)
retooth
·vorig jaar·discuss
Oh, neat :) This looks really cool. In one of the upcoming versions of xenharmlib I am planning to add hooks for visualization plugins, so structures can be rendered in JupyterLab. Maybe you would be interested in contributing, however it will take some time before JI is supported.
retooth
·vorig jaar·discuss
Yes, I do. For the actual score composition I used Ableton, but xenharmlib can export SCL files to define microtonal scales, which then can be imported in Ableton (a lot of other DAWs and VSTs support this format too).

For the most part however I use xenharmlib for theoretical aspects of music. I got interested in the "31 Equal Divisions per Octave" tuning a couple years ago, because of its psychoaccustic potentials, but thinking about chords, modes, notation in 31-EDO made my head hurt, so I built the library to help me think and answer my questions.
retooth
·2 jaar geleden·discuss
I am not sure if it is only JS libraries you are looking for (since it is an Electron app), but I released a fairly comprehensive python music theory library that not only supports Western tunings, but all sorts of equal temperaments. It even has some support for post-tonal music theory.

https://xenharmlib.readthedocs.io/en/latest/