how to affect audio context for a specific howler.js sound #1623
Unanswered
viewescape
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to do my own fade in and out on specific howler sounds. (I know howler has a fade feature, however have the need to do them with audio context for various reasons). I know how to fade the global howler that affects all sounds, however I'm not understanding how to affect a specific howl object I've created - in the case of this example, we'll call the specific howl object 'test'
This has been tested and works for doing my own fade on the global howler:
Howler.masterGain.gain.setValueAtTime(1, Howler.ctx.currentTime);
Howler.masterGain.gain.linearRampToValueAtTime(0, Howler.ctx.currentTime + 10);
However for a howl object called 'test', I'm unclear how I would do the same fade out to only that howler object?
After reviewing the howler.js code, I've tried the following that all error in different ways:
test.masterGain.gain.setValueAtTime(1, Howler.ctx.currentTime);
test.masterGain.gain.linearRampToValueAtTime(0, Howler.ctx.currentTime + 10);
test.gain.setValueAtTime(1, Howler.ctx.currentTime);
test.gain.linearRampToValueAtTime(0, Howler.ctx.currentTime + 10);
test._node.gain.setValueAtTime(1, Howler.ctx.currentTime);
test._node.gain.linearRampToValueAtTime(0, Howler.ctx.currentTime + 10);
Please forgive my misunderstanding of how howler works with sounds, JS, and audio context in general. I'm not an expert, but am trying. I'm sure that this is not how to access the object 'test' and do a fade on it. Note that I'd still like to use howler to define 'test' including loading the sound, playback, pause, etc. I'm trying to stay away from raw coding audio context for 'test' from scratch. For now, I only need to directly access the volume for 'test' using the audio context.
Thank you in advance!
Beta Was this translation helpful? Give feedback.
All reactions