New zifferjs version with more tonnetz transformations

This commit is contained in:
2023-11-11 21:51:25 +02:00
parent a2dcfbad7d
commit 8e28eb5177
5 changed files with 80 additions and 77 deletions

View File

@ -21,20 +21,22 @@ if (!self.define) {
const singleRequire = (uri, parentUri) => { const singleRequire = (uri, parentUri) => {
uri = new URL(uri + ".js", parentUri).href; uri = new URL(uri + ".js", parentUri).href;
return ( return registry[uri] || (
registry[uri] ||
new Promise((resolve) => { new Promise(resolve => {
if ("document" in self) { if ("document" in self) {
const script = document.createElement("script"); const script = document.createElement("script");
script.src = uri; script.src = uri;
script.onload = resolve; script.onload = resolve;
document.head.appendChild(script); document.head.appendChild(script);
} else { } else {
nextDefineUri = uri; nextDefineUri = uri;
importScripts(uri); importScripts(uri);
resolve(); resolve();
} }
}).then(() => { })
.then(() => {
let promise = registry[uri]; let promise = registry[uri];
if (!promise) { if (!promise) {
throw new Error(`Module ${uri} didnt register its module`); throw new Error(`Module ${uri} didnt register its module`);
@ -45,31 +47,27 @@ if (!self.define) {
}; };
self.define = (depsNames, factory) => { self.define = (depsNames, factory) => {
const uri = const uri = nextDefineUri || ("document" in self ? document.currentScript.src : "") || location.href;
nextDefineUri ||
("document" in self ? document.currentScript.src : "") ||
location.href;
if (registry[uri]) { if (registry[uri]) {
// Module is already loading or loaded. // Module is already loading or loaded.
return; return;
} }
let exports = {}; let exports = {};
const require = (depUri) => singleRequire(depUri, uri); const require = depUri => singleRequire(depUri, uri);
const specialDeps = { const specialDeps = {
module: { uri }, module: { uri },
exports, exports,
require, require
}; };
registry[uri] = Promise.all( registry[uri] = Promise.all(depsNames.map(
depsNames.map((depName) => specialDeps[depName] || require(depName)) depName => specialDeps[depName] || require(depName)
).then((deps) => { )).then(deps => {
factory(...deps); factory(...deps);
return exports; return exports;
}); });
}; };
} }
define(["./workbox-b7fccfec"], function (workbox) { define(['./workbox-b7fccfec'], (function (workbox) { 'use strict';
"use strict";
self.skipWaiting(); self.skipWaiting();
workbox.clientsClaim(); workbox.clientsClaim();
@ -79,44 +77,28 @@ define(["./workbox-b7fccfec"], function (workbox) {
* requests for URLs in the manifest. * requests for URLs in the manifest.
* See https://goo.gl/S9QRab * See https://goo.gl/S9QRab
*/ */
workbox.precacheAndRoute( workbox.precacheAndRoute([{
[ "url": "registerSW.js",
{ "revision": "3ca0b8505b4bec776b69afdba2768812"
url: "registerSW.js", }, {
revision: "3ca0b8505b4bec776b69afdba2768812", "url": "index.html",
}, "revision": "0.48a0i720j7o"
{ }], {});
url: "index.html",
revision: "0.djkmkn674mo",
},
],
{}
);
workbox.cleanupOutdatedCaches(); workbox.cleanupOutdatedCaches();
workbox.registerRoute( workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { allowlist: [/^\/$/]
allowlist: [/^\/$/], }));
}) workbox.registerRoute(({
); url
workbox.registerRoute( }) => [/^https:\/\/raw\.githubusercontent\.com\/.*/i, /^https:\/\/shabda\.ndre\.gr\/.*/i].some(regex => regex.test(url)), new workbox.CacheFirst({
({ url }) => "cacheName": "external-samples",
[ plugins: [new workbox.ExpirationPlugin({
/^https:\/\/raw\.githubusercontent\.com\/.*/i, maxEntries: 5000,
/^https:\/\/shabda\.ndre\.gr\/.*/i, maxAgeSeconds: 2592000
].some((regex) => regex.test(url)), }), new workbox.CacheableResponsePlugin({
new workbox.CacheFirst({ statuses: [0, 200]
cacheName: "external-samples", })]
plugins: [ }), 'GET');
new workbox.ExpirationPlugin({
maxEntries: 5000, }));
maxAgeSeconds: 2592000,
}),
new workbox.CacheableResponsePlugin({
statuses: [0, 200],
}),
],
}),
"GET"
);
});
//# sourceMappingURL=sw.js.map //# sourceMappingURL=sw.js.map

File diff suppressed because one or more lines are too long

View File

@ -42,7 +42,7 @@
"tone": "^14.8.49", "tone": "^14.8.49",
"unique-names-generator": "^4.7.1", "unique-names-generator": "^4.7.1",
"vite-plugin-markdown": "^2.1.0", "vite-plugin-markdown": "^2.1.0",
"zifferjs": "^0.0.35", "zifferjs": "^0.0.36",
"zzfx": "^1.2.0" "zzfx": "^1.2.0"
} }
} }

View File

@ -6,6 +6,7 @@ import { SoundEvent, SoundParams } from "./SoundEvent";
import { MidiEvent, MidiParams } from "./MidiEvent"; import { MidiEvent, MidiParams } from "./MidiEvent";
import { RestEvent } from "./RestEvent"; import { RestEvent } from "./RestEvent";
import { arrayOfObjectsToObjectWithArrays } from "../Utils/Generic"; import { arrayOfObjectsToObjectWithArrays } from "../Utils/Generic";
import { TonnetzSpaces } from "zifferjs/src/tonnetz";
export type InputOptions = { [key: string]: string | number }; export type InputOptions = { [key: string]: string | number };
@ -244,8 +245,28 @@ export class Player extends Event {
return this; return this;
} }
tonnetz(transform: string) { triadTonnetz(transform: string, tonnetz: TonnetzSpaces = [3, 4, 5]) {
if (this.atTheBeginning()) this.ziffers.tonnetzTransformation(transform); if (this.atTheBeginning()) this.ziffers.triadTonnetz(transform, tonnetz);
return this;
}
tetraTonnetz(transform: string, tonnetz: TonnetzSpaces = [3, 4, 5]) {
if (this.atTheBeginning()) this.ziffers.tetraTonnetz(transform, tonnetz);
return this;
}
octaCycle(tonnetz: TonnetzSpaces = [3, 4, 5]) {
if (this.atTheBeginning()) this.ziffers.octaCycle(tonnetz);
return this;
}
hexaCycle(tonnetz: TonnetzSpaces = [3, 4, 5]) {
if (this.atTheBeginning()) this.ziffers.hexaCycle(tonnetz);
return this;
}
enneaCycle(tonnetz: TonnetzSpaces = [3, 4, 5]) {
if (this.atTheBeginning()) this.ziffers.enneaCycle(tonnetz);
return this; return this;
} }

View File

@ -2595,11 +2595,6 @@ iterate-object@^1.3.2:
resolved "https://registry.yarnpkg.com/iterate-object/-/iterate-object-1.3.4.tgz#fa50b1d9e58e340a7dd6b4c98c8a5e182e790096" resolved "https://registry.yarnpkg.com/iterate-object/-/iterate-object-1.3.4.tgz#fa50b1d9e58e340a7dd6b4c98c8a5e182e790096"
integrity sha512-4dG1D1x/7g8PwHS9aK6QV5V94+ZvyP4+d19qDv43EzImmrndysIl4prmJ1hWWIGCqrZHyaHBm6BSEWHOLnpoNw== integrity sha512-4dG1D1x/7g8PwHS9aK6QV5V94+ZvyP4+d19qDv43EzImmrndysIl4prmJ1hWWIGCqrZHyaHBm6BSEWHOLnpoNw==
jisg@^0.9.7:
version "0.9.7"
resolved "https://registry.yarnpkg.com/jisg/-/jisg-0.9.7.tgz#d080655808d1f30ec22eb2be070e8a10d8ee097f"
integrity sha512-JWoGHGgU3xxJnPCNm6FpgMl0791xYFZq2PsejV8guCbhNJGsMvImAENx9pMhp7HbqhJgkM4ZV5lRbh5zbmF9xw==
jake@^10.8.5: jake@^10.8.5:
version "10.8.7" version "10.8.7"
resolved "https://registry.yarnpkg.com/jake/-/jake-10.8.7.tgz#63a32821177940c33f356e0ba44ff9d34e1c7d8f" resolved "https://registry.yarnpkg.com/jake/-/jake-10.8.7.tgz#63a32821177940c33f356e0ba44ff9d34e1c7d8f"
@ -2619,6 +2614,11 @@ jest-worker@^26.2.1:
merge-stream "^2.0.0" merge-stream "^2.0.0"
supports-color "^7.0.0" supports-color "^7.0.0"
jisg@^0.9.7:
version "0.9.7"
resolved "https://registry.yarnpkg.com/jisg/-/jisg-0.9.7.tgz#d080655808d1f30ec22eb2be070e8a10d8ee097f"
integrity sha512-JWoGHGgU3xxJnPCNm6FpgMl0791xYFZq2PsejV8guCbhNJGsMvImAENx9pMhp7HbqhJgkM4ZV5lRbh5zbmF9xw==
jiti@^1.18.2: jiti@^1.18.2:
version "1.19.3" version "1.19.3"
resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.19.3.tgz#ef554f76465b3c2b222dc077834a71f0d4a37569" resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.19.3.tgz#ef554f76465b3c2b222dc077834a71f0d4a37569"
@ -3882,10 +3882,10 @@ yaml@^2.1.1:
resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.1.tgz#02fe0975d23cd441242aa7204e09fc28ac2ac33b" resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.1.tgz#02fe0975d23cd441242aa7204e09fc28ac2ac33b"
integrity sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ== integrity sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==
zifferjs@^0.0.35: zifferjs@^0.0.36:
version "0.0.35" version "0.0.36"
resolved "https://registry.yarnpkg.com/zifferjs/-/zifferjs-0.0.35.tgz#0518a84d031d2ef19417bc1084c21b08666df067" resolved "https://registry.yarnpkg.com/zifferjs/-/zifferjs-0.0.36.tgz#a7f0139c56cae38a5c68a0182363bab4ffeaad79"
integrity sha512-vtvyEO/hIPRboGinkb1IhqJu4iU5DdbkzrQX8Xg7n096fDi/PU72b5Nwxt0xt29D37CfOI99sjaLbtYPab1NoA== integrity sha512-zpzN2obiNYrmCxFdzqv3jzOHYPhgAkzW6ZeHxSoHtybLHf/HlDXWs3KtB1u8HOJt2ZPIogegNEDX+mMCQtxbMQ==
zzfx@^1.2.0: zzfx@^1.2.0:
version "1.2.0" version "1.2.0"