-
-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
add sf2 soundfonts to sound registry #182
Comments
idea: add a new function that takes in a callback for creating the source web audio node: note("c a f e").sourceNode((hap, deadline, duration, cps) => {
/* webaudio code that uses above params to create a webaudio node * /
return node;
}).lpf(1000) the function is similar to onTrigger, but instead of being just a general purpose callback, the function is expected to return a web audio node, which is used by the webaudio output to apply the standard chain. Advantages:
the same approach could potentially also work for custom effects, e.g. |
this works really well! it opens up some interesting possibilities: const lfo = (freq, type = 'sine', range = 1) => {
const ctx = getAudioContext();
const osc = ctx.createOscillator();
osc.type = type;
osc.frequency.value = freq;
osc.start();
const g = new GainNode(ctx, { gain: range/2 });
osc.connect(g); // -range, range
return g;
}
const pitchLFO = lfo(.1, 'sine', 20);
note("c eb a*4 c4".add("12,12.05")).legato(.5 )
.source((t, value, duration) => {
const { release = 0.01 } = value;
const ctx = getAudioContext();
const o = ctx.createOscillator();
o.type = 'sawtooth';
const freq = getFrequency({value});
o.frequency.value = Number(freq/2);
o.start(t);
o.stop(t + duration + release)
pitchLFO.connect(o.frequency)
return o;
})
.room(.5).lpf(800)
.gain(.5) this cries for a thin web audio abstraction layer.. |
PR for sound registry #516 |
note to avoid confusion: #516 now has integrated gm soundfonts based on webaudiofontdata, but the soundfonts loaded from sf2 files are still not part of the registry, so I'll leave this open |
.s
instead of (or in addition to)
.soundfont
, soundfont presets should be usable via.s
When
loadSoundfont
is called, all presets in the loaded soundfont are added to the available sounds ofs
.Some type of sound registry has to be implemented to be able to add sounds from outside (webaudio package should not depend on soundfont package). Also remove the old non sf2 file based soundfonts
The text was updated successfully, but these errors were encountered: