This commit is contained in:
Jade (Rose) Rowland
2026-02-08 21:11:10 -05:00
parent 4f05674cb3
commit 0b69ce21c7
3 changed files with 16 additions and 8 deletions
+12 -1
View File
@@ -10,11 +10,17 @@ import {
releaseAudioNode,
} from './helpers.mjs';
import { logger } from './logger.mjs';
import { note2midi } from 'node_modules/@strudel/tonal/tonleiter.mjs';
const bufferCache = {}; // string: Promise<ArrayBuffer>
const loadCache = {}; // string: Promise<ArrayBuffer>
/**
*
* @typedef {Object} SampleMetaData
* @property {string} url
* @property {midi} number
*/
export const getCachedBuffer = (url) => bufferCache[url];
function humanFileSize(bytes, si) {
@@ -158,6 +164,11 @@ export const processSampleMap = (sampleMap, fn, baseUrl = sampleMap._base || '')
if (baseUrl.startsWith('github:')) {
baseUrl = githubPath(baseUrl, '');
}
/**
*
* @param {string} v
* @returns {SampleMetaData}
*/
const fullUrl = (v) => ({ url: baseUrl + v, midi: extractMidiNoteFromString(v) });
if (Array.isArray(value)) {
//return [key, value.map(replaceUrl)];
+1 -6
View File
@@ -2,12 +2,7 @@ import { logger } from './logger.mjs';
// currently duplicate with core util.mjs to skip dependency
// TODO: add separate util module?
/**
*
* @typedef {Object} SampleMetaData
* @property {string} url
* @property {baseFrequency} number
*/
export const tokenizeNote = (note) => {
if (typeof note !== 'string') {
return [];