Merge branch 'main' into envelope_improvements
This commit is contained in:
commit
a800b32529
79 changed files with 4033 additions and 4306 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { noteToMidi, freqToMidi } from '@strudel.cycles/core';
|
||||
|
||||
import { noteToMidi, freqToMidi, getSoundIndex } from '@strudel.cycles/core';
|
||||
import { getAudioContext, registerSound, getEnvelope, getADSRValues } from '@strudel.cycles/webaudio';
|
||||
import gm from './gm.mjs';
|
||||
|
||||
|
|
@ -130,14 +131,14 @@ export function registerSoundfonts() {
|
|||
registerSound(
|
||||
name,
|
||||
async (time, value, onended) => {
|
||||
const { n = 0 } = value;
|
||||
const [attack, decay, sustain, release] = getADSRValues([
|
||||
value.attack,
|
||||
value.decay,
|
||||
value.sustain,
|
||||
value.release,
|
||||
]);
|
||||
const font = fonts[n % fonts.length];
|
||||
const n = getSoundIndex(value.n, fonts.length);
|
||||
const font = fonts[n];
|
||||
const ctx = getAudioContext();
|
||||
const bufferSource = await getFontBufferSource(font, value, ctx);
|
||||
bufferSource.start(time);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
"soundfont2": "^0.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"node-fetch": "^3.3.1",
|
||||
"vite": "^4.3.3"
|
||||
"node-fetch": "^3.3.2",
|
||||
"vite": "^5.0.10"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export default defineConfig({
|
|||
lib: {
|
||||
entry: resolve(__dirname, 'index.mjs'),
|
||||
formats: ['es', 'cjs'],
|
||||
fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' }[ext]),
|
||||
fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext],
|
||||
},
|
||||
rollupOptions: {
|
||||
external: [...Object.keys(dependencies)],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue