mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-11 21:58:37 +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 { samples } from '@strudel.cycles/webaudio';
|
||||
|
||||
export async function prebake(isMock = false) {
|
||||
export async function prebake({ isMock = false, baseDir = '.' } = {}) {
|
||||
samples(
|
||||
{
|
||||
piano: {
|
||||
@ -39,12 +39,12 @@ export async function prebake(isMock = false) {
|
||||
},
|
||||
// https://archive.org/details/SalamanderGrandPianoV3
|
||||
// License: CC-by http://creativecommons.org/licenses/by/3.0/ Author: Alexander Holm
|
||||
'./piano/',
|
||||
`${baseDir}/piano/`,
|
||||
);
|
||||
if (!isMock) {
|
||||
await fetch('EmuSP12.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 () {
|
||||
return this.clip(1)
|
||||
.s('piano')
|
||||
.release(.1)
|
||||
.release(0.1)
|
||||
.fmap((value) => {
|
||||
const midi = typeof value.note === 'string' ? toMidi(value.note) : value.note;
|
||||
// pan by pitch
|
||||
|
||||
@ -123,7 +123,7 @@ const uiHelpersMocked = {
|
||||
backgroundImage: id,
|
||||
};
|
||||
|
||||
prebake(true);
|
||||
prebake({ isMock: true });
|
||||
|
||||
// TODO: refactor to evalScope
|
||||
evalScope(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user