mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-24 20:18:34 +00:00
level down soundfonts
+ do not load in prebake (breaks static rendering) + instead load on import
This commit is contained in:
parent
ac148b2f32
commit
ff412f6396
@ -126,13 +126,18 @@ export function registerSoundfonts() {
|
|||||||
const bufferSource = await getFontBufferSource(instrument, note || n, ctx);
|
const bufferSource = await getFontBufferSource(instrument, note || n, ctx);
|
||||||
bufferSource.start(time);
|
bufferSource.start(time);
|
||||||
const stop = (time) => bufferSource.stop(time);
|
const stop = (time) => bufferSource.stop(time);
|
||||||
|
const g = new GainNode(ctx, { gain: 0.3 });
|
||||||
|
bufferSource.connect(g);
|
||||||
bufferSource.onended = () => {
|
bufferSource.onended = () => {
|
||||||
bufferSource.disconnect();
|
bufferSource.disconnect();
|
||||||
|
g.disconnect();
|
||||||
onended();
|
onended();
|
||||||
};
|
};
|
||||||
return { node: bufferSource, stop };
|
return { node: g, stop };
|
||||||
},
|
},
|
||||||
{ type: 'soundfont', prebake: true },
|
{ type: 'soundfont', prebake: true },
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
registerSoundfonts();
|
||||||
|
|||||||
@ -18,6 +18,7 @@ if (typeof window !== 'undefined') {
|
|||||||
import('@strudel.cycles/webaudio'),
|
import('@strudel.cycles/webaudio'),
|
||||||
import('@strudel.cycles/osc'),
|
import('@strudel.cycles/osc'),
|
||||||
import('@strudel.cycles/csound'),
|
import('@strudel.cycles/csound'),
|
||||||
|
import('@strudel.cycles/soundfonts'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import { Pattern, toMidi, valueToMidi } from '@strudel.cycles/core';
|
import { Pattern, toMidi, valueToMidi } from '@strudel.cycles/core';
|
||||||
import { registerSoundfonts } from '@strudel.cycles/soundfonts';
|
//import { registerSoundfonts } from '@strudel.cycles/soundfonts';
|
||||||
import { registerSynthSounds, samples } from '@strudel.cycles/webaudio';
|
import { registerSynthSounds, samples } from '@strudel.cycles/webaudio';
|
||||||
|
|
||||||
export async function prebake() {
|
export async function prebake() {
|
||||||
// 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
|
||||||
registerSynthSounds();
|
registerSynthSounds();
|
||||||
registerSoundfonts();
|
//registerSoundfonts();
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
samples(`./piano.json`, `./piano/`, { prebake: true }),
|
samples(`./piano.json`, `./piano/`, { prebake: true }),
|
||||||
// https://github.com/sgossner/VCSL/
|
// https://github.com/sgossner/VCSL/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user