Skip to content
skarukas edited this page May 15, 2020 · 9 revisions

xen

xen is a high-level, interpreted language for analyzing and operating upon musical pitch structures within the context of "xenharmonic" microtonal theory. The interpreter is written in ES6 JavaScript and based off "AEL" by Peter Olson. xen is heavily reliant on tune.js, a library which models the xen data types as classes in JavaScript/TypeScript.

This Wiki contains the documentation for the xen language. I also recorded a series of videos that serves as a helpful introduction.

Console

The online xen console includes the interpreter and can be used to evaluate expressions, like a sort of xenharmonic calculator.

More about the xen console

Data Types

xen contains 6 main data types, with special syntax to identify them:

type example
et 4#12
ratio 9:8
freq 300hz
cents 40c
number 1.10
list '(1, 2, 3, 4)

More about data types

Operators

Generally, math may be performed freely between all types using arithmetic operators (+, -, *, /, %). xen handles the type conversions automatically behind the scenes.

N.B. most operators work in pitch space. For example, adding intervals corresponds to "stacking" them, no matter if they are frequency ratios or et (equal-tempered) intervals.

More about operators

Functions

The function play() may be used to play back notes, intervals, or even lists of intervals & interval structures such as 4:5:6:7.

xen also includes functions for analysis, such as closest(), which finds the closest et intervals for a given ratio and the closest ratios for a given et interval.

xen is case-insensitive.

More about built-in functions

Clone this wiki locally