xenharmonic-devs / sonic-weave

The SonicWeave DSL for manipulating musical frequencies, ratios and equal temperaments
MIT License
4 stars 4 forks source link

Temperaments as primitive values #383

Closed frostburn closed 4 days ago

frostburn commented 1 week ago

Construction

From vals

Temperament([
  <5 8 12],
  <12 19 28],
])

From svals

Temperament(
  [
    <1 0 -1 -7],
    <0 2 3 10],
  ] @2.3.13/5.19/5
)

From commas

Minimal prime subgroup

Temperament([81/80, 126/125])

Explicit subgroup

Temperament([256/243], @2.3.5)

From smonzos

Temperament(
  [
    [2 -3 2⟩,
    [6 -5 0 1⟩,
  ] @2.3.13/5.19/5,
  @2.3.13/5.19/5
)

Explicit subgroup is required, because I'm not adding primitive smonzos to the runtime.

Methods

Below const T = Temperament(...).

Tempering the scale

(* Fancy preimage goes here *)
TE(T)

Obtaining generators

const [period, generator] = generators(T)

Obtaining commas

const [syntonic, starling] = commas(T)

Simplifying preimages

(* Not-so-fancy preimage goes here *)
respell(T)