Skip to content

Instantly share code, notes, and snippets.

@frostburn
Created February 7, 2024 08:21
Show Gist options
  • Save frostburn/38e49973d7d6230934055f3764a0b847 to your computer and use it in GitHub Desktop.
Save frostburn/38e49973d7d6230934055f3764a0b847 to your computer and use it in GitHub Desktop.
Verify entries listed in https://en.xen.wiki/w/Generator_sequence
// commit f6fa7fcc809d2952d4cb3b991e0c6b8c6c559371 of https://github.com/xenharmonic-devs/sonic-weave
import {
Interval,
evaluateExpression,
hasConstantStructure,
subtensions,
} from '../src';
const obtained = [
['Zarlino', '5/4, 6/5', [7, 10, 17, 24, 41, 65]],
['Diasem', '7/6, 8/7', [5, 9, 14, 19, 24, 29]],
['GS(3/2, 14/9)', '3/2, 14/9', [5, 8, 13, 18]],
[
'Zil',
'8/7, 7/6, 8/7, 7/6, 8/7, 7/6, 8/7, 189/160, 8/7, 7/6',
[5, 9, 14, 19, 24],
],
['Porcusmine', '9/5, 50/27', [5, 6, 7, 8, 15, 23, 38, 61, 99]],
['Mavila detemp', '3/2, 3/2, 64/45', [5, 7, 9, 16, 25]],
['Rhombi', '14/9, 11/7, 52/33, 81/52', [5, 8, 11, 14, 17, 31, 48, 65]],
[
'Dwyn',
'25/24, 21/20, 22/21, 23/22, 24/23, 21/20, 22/21, 23/22, 24/23',
[15, 16, 31, 46],
],
[
'GS(13/11, ...)',
'13/11, 16/13, 77/64, 13/11, 16/13, 33/28',
[7, 11, 15, 19],
],
[
'Magic detemp',
'16/13, 20/16, 25/20, 31/25, 39/31',
[7, 10, 13, 16, 19, 22, 41],
],
['GS(30:42:57:80)', '42/30, 57/42, 80/57', []],
[
'GS(19/14, ...)',
'19/14, 51/38, 23/17, 63/46, 19/14, 51/38, 23/17, 896/621',
[],
],
['Porcupine detemp', '10/9, 11/10, 12/11', []],
[
'GS(9:10...)',
'10/9, 11/10, 12/11, 10/9, 11/10, 12/11, 10/9, 11/10, 189/176',
[],
],
['Bleu detemp', '24/22, 26/24, 28/26, 31/28, 33/31', []],
['Machine detemp', '8/7, 9/8, 112/99, 9/8', []],
['Slendric detemp', '8/7, 147/128, 8/7', []],
];
for (const [name, generators, sizes] of obtained) {
console.log('===', name, '===');
for (const size of sizes) {
const scale = evaluateExpression(
`gs([${generators}], ${size})`
) as Interval[];
const monzos = scale.map(i => i.value);
if (!hasConstantStructure(monzos)) {
console.log(`Size ${size} is not CS`);
const subtenders = subtensions(monzos);
for (const subtender of subtenders) {
if (subtender.subtensions.size > 1) {
console.log(subtender.monzo.toString(), subtender.subtensions);
break;
}
}
}
}
const csSizes: number[] = [];
for (let size = 5; size < 100; ++size) {
const scale = evaluateExpression(
`gs([${generators}], ${size})`
) as Interval[];
const monzos = scale.map(i => i.value);
if (hasConstantStructure(monzos)) {
csSizes.push(size);
}
}
console.log(
`CS sizes below 100: ${csSizes.map(i => i.toString()).join(', ')}`
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment