mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-22 19:18:31 +00:00
add baseDir to prebake + obj params
This commit is contained in:
parent
60616a5228
commit
db1fc399a1
@ -1,7 +1,7 @@
|
|||||||
import { Pattern, toMidi } from '@strudel.cycles/core';
|
import { Pattern, toMidi } from '@strudel.cycles/core';
|
||||||
import { samples } from '@strudel.cycles/webaudio';
|
import { samples } from '@strudel.cycles/webaudio';
|
||||||
|
|
||||||
export async function prebake(isMock = false) {
|
export async function prebake({ isMock = false, baseDir = '.' } = {}) {
|
||||||
samples(
|
samples(
|
||||||
{
|
{
|
||||||
piano: {
|
piano: {
|
||||||
@ -39,12 +39,12 @@ export async function prebake(isMock = false) {
|
|||||||
},
|
},
|
||||||
// https://archive.org/details/SalamanderGrandPianoV3
|
// https://archive.org/details/SalamanderGrandPianoV3
|
||||||
// License: CC-by http://creativecommons.org/licenses/by/3.0/ Author: Alexander Holm
|
// License: CC-by http://creativecommons.org/licenses/by/3.0/ Author: Alexander Holm
|
||||||
'./piano/',
|
`${baseDir}/piano/`,
|
||||||
);
|
);
|
||||||
if (!isMock) {
|
if (!isMock) {
|
||||||
await fetch('EmuSP12.json')
|
await fetch('EmuSP12.json')
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
.then((json) => samples(json, './EmuSP12/'));
|
.then((json) => samples(json, `${baseDir}/EmuSP12/`));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ const panwidth = (pan, width) => pan * width + (1 - width) / 2;
|
|||||||
Pattern.prototype.piano = function () {
|
Pattern.prototype.piano = function () {
|
||||||
return this.clip(1)
|
return this.clip(1)
|
||||||
.s('piano')
|
.s('piano')
|
||||||
.release(.1)
|
.release(0.1)
|
||||||
.fmap((value) => {
|
.fmap((value) => {
|
||||||
const midi = typeof value.note === 'string' ? toMidi(value.note) : value.note;
|
const midi = typeof value.note === 'string' ? toMidi(value.note) : value.note;
|
||||||
// pan by pitch
|
// pan by pitch
|
||||||
|
|||||||
@ -123,7 +123,7 @@ const uiHelpersMocked = {
|
|||||||
backgroundImage: id,
|
backgroundImage: id,
|
||||||
};
|
};
|
||||||
|
|
||||||
prebake(true);
|
prebake({ isMock: true });
|
||||||
|
|
||||||
// TODO: refactor to evalScope
|
// TODO: refactor to evalScope
|
||||||
evalScope(
|
evalScope(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user