add xen package

This commit is contained in:
Felix Roos 2022-03-25 22:39:03 +01:00
parent 9458faf5b0
commit e1bb58fb06
6 changed files with 46 additions and 671 deletions

26
packages/xen/package.json Normal file
View file

@ -0,0 +1,26 @@
{
"name": "@strudel/xen",
"version": "0.0.1",
"description": "Xenharmonic API for strudel",
"main": "xen.mjs",
"scripts": {
"test": "mocha --colors"
},
"repository": {
"type": "git",
"url": "git+https://github.com/tidalcycles/strudel.git"
},
"keywords": [
"tidalcycles",
"strudel",
"pattern",
"livecoding",
"algorave"
],
"author": "Felix Roos <flix91@gmail.com>",
"license": "GPL-3.0-or-later",
"bugs": {
"url": "https://github.com/tidalcycles/strudel/issues"
},
"homepage": "https://github.com/tidalcycles/strudel#readme"
}

View file

@ -0,0 +1,8 @@
import { strict as assert } from 'assert';
import { edo } from '../xen.mjs';
describe('xen', () => {
it('edo', () => {
assert.deepStrictEqual(edo('3edo'), [1, Math.pow(2, 1 / 3), Math.pow(2, 2 / 3)]);
});
});

View file

@ -1,7 +1,7 @@
import { Pattern } from '@strudel/core/strudel.mjs';
import { mod } from '../../packages/core/util.mjs';
function edo(name) {
export function edo(name) {
if (!/^[1-9]+[0-9]*edo$/.test(name)) {
throw new Error('not an edo scale: "' + name + '"');
}