working
This commit is contained in:
parent
466574a856
commit
3776791239
3 changed files with 17 additions and 7 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { noteToMidi, freqToMidi } from '@strudel.cycles/core';
|
||||
import { noteToMidi, freqToMidi, _mod } from '@strudel.cycles/core';
|
||||
import { getAudioContext, registerSound, getEnvelope } from '@strudel.cycles/webaudio';
|
||||
import gm from './gm.mjs';
|
||||
import { getSoundIndex } from '../superdough/util.mjs';
|
||||
|
||||
let loadCache = {};
|
||||
async function loadFont(name) {
|
||||
|
|
@ -130,9 +131,9 @@ export function registerSoundfonts() {
|
|||
registerSound(
|
||||
name,
|
||||
async (time, value, onended) => {
|
||||
const { n = 0 } = value;
|
||||
const n = getSoundIndex(value.n, fonts.length);
|
||||
const { attack = 0.001, decay = 0.001, sustain = 1, release = 0.001 } = value;
|
||||
const font = fonts[n % fonts.length];
|
||||
const font = fonts[n];
|
||||
const ctx = getAudioContext();
|
||||
const bufferSource = await getFontBufferSource(font, value, ctx);
|
||||
bufferSource.start(time);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue