xenharmonic-devs / sonic-weave

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

Respell/simplify ratios using a comma-basis #343

Closed frostburn closed 2 weeks ago

frostburn commented 1 month ago

akśeláiToday at 12:10 PM

I propose a "detempering" method, which takes some complex JI interval (say 531441/262144) and a list of commas (e.g. 81/80, 128/125) and multiplies the interval by these commas until it becomes the simplest (in this case 2/1).

I'm sure the simplest interval method is well defined (like in the coalesce modal). more examples: 531441/262144, [81/80] |--> 125/64 531441/262144, [128/125] |--> 531441/250000 531441/262144, [81/80, 128/125, 135/128] |--> 1/1

frostburn commented 1 month ago

intharToday at 2:47 PM

The exact optimization problem likely has to be at least exponential in dimension, but LLL is polynomial in dimension and finds reasonably short bases. I think sintel uses LLL to find detempered JI bases for temperaments, so we can just use sintel's API.

frostburnToday at 2:53 PM

Good to know. I'm scoping SonicWeave to be about tempering, but only equal tempering so we should at lest offer something in-library as well. I believe you can get close enough to higher ranks by using large equal temps and octave stretching so it shouldn't be too restrictive in principle.

akśeláiToday at 4:10 PM

when you really need higher ranks, two things will typically happen: either the GPV list will only have 1 or 2 elements (or even 0), or will start and end in edo numbers roughly in the thousands. in either case, you either choose an edo to work backwards from, or just use the large edo since we've already stepped into unnoticeable territory even for half-cent-JND people

I believe LLL refers to this: https://en.wikipedia.org/wiki/Lenstra%E2%80%93Lenstra%E2%80%93Lov%C3%A1sz_lattice_basis_reduction_algorithm