mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-24 12:08:28 +00:00
Merge pull request #550 from tidalcycles/fix-soundfont-loading
fix: load soundfonts in prebake
This commit is contained in:
commit
c26f6b72d9
@ -153,5 +153,3 @@ export function registerSoundfonts() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
registerSoundfonts();
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ import '@strudel.cycles/xen/xen.mjs';
|
|||||||
// import '@strudel.cycles/webaudio/webaudio.mjs';
|
// import '@strudel.cycles/webaudio/webaudio.mjs';
|
||||||
// import '@strudel.cycles/serial/serial.mjs';
|
// import '@strudel.cycles/serial/serial.mjs';
|
||||||
// import controls from '@strudel.cycles/core/controls.mjs';
|
// import controls from '@strudel.cycles/core/controls.mjs';
|
||||||
import '../website/src/repl/prebake';
|
import '../website/src/repl/piano';
|
||||||
|
|
||||||
class MockedNode {
|
class MockedNode {
|
||||||
chain() {
|
chain() {
|
||||||
|
|||||||
16
website/src/repl/piano.mjs
Normal file
16
website/src/repl/piano.mjs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { Pattern, noteToMidi, valueToMidi } from '@strudel.cycles/core';
|
||||||
|
|
||||||
|
const maxPan = noteToMidi('C8');
|
||||||
|
const panwidth = (pan, width) => pan * width + (1 - width) / 2;
|
||||||
|
|
||||||
|
Pattern.prototype.piano = function () {
|
||||||
|
return this.clip(1)
|
||||||
|
.s('piano')
|
||||||
|
.release(0.1)
|
||||||
|
.fmap((value) => {
|
||||||
|
const midi = valueToMidi(value);
|
||||||
|
// pan by pitch
|
||||||
|
const pan = panwidth(Math.min(Math.round(midi) / maxPan, 1), 0.5);
|
||||||
|
return { ...value, pan: (value.pan || 1) * pan };
|
||||||
|
});
|
||||||
|
};
|
||||||
@ -1,13 +1,14 @@
|
|||||||
import { Pattern, noteToMidi, valueToMidi } from '@strudel.cycles/core';
|
import { Pattern, noteToMidi, 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';
|
||||||
|
import './piano.mjs';
|
||||||
|
|
||||||
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();
|
|
||||||
//registerSoundfonts();
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
registerSynthSounds(),
|
||||||
|
registerSoundfonts(),
|
||||||
samples(`./piano.json`, `./piano/`, { prebake: true }),
|
samples(`./piano.json`, `./piano/`, { prebake: true }),
|
||||||
// https://github.com/sgossner/VCSL/
|
// https://github.com/sgossner/VCSL/
|
||||||
// https://api.github.com/repositories/126427031/contents/
|
// https://api.github.com/repositories/126427031/contents/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user