Answer the question
In order to leave comments, you need to log in
Panning HTML5 Audio
Good day! Looking for an answer to my own question: Is HTML5 Audio panning possible? Or some manual control of the volume of the right left channel at the source? Not a common master channel, but from individual sources. I can’t google anything on the topic, maybe I’m looking badly, of course, but if anyone knows the answer to the question: I will be very happy! Thanks to!
Answer the question
In order to leave comments, you need to log in
Here's what I found, hope it helps:
Audio Stereo Panning
HTML5 Audio currently has no way of panning audio tracks left or right (adjusting the balance). Recommended adding a HTMLMediaElement.balance property, floating point decimal, with a range of "-1" (full left speaker), to "0.0" (center, both channels at full volume), to "1.0" (full right speaker). This should work on both mono and stereo tracks.
var sound = new Audio('env/water-loop.mp3'); sound.balance = -1; // full left speaker sound.play();
Changing this value should have an immediate effect on audio that is already playing - ie balance should not be buffered.
And if you make two identical tracks, one with only the left channel, the second with the right, and control their volumes?
In theory, you can programmatically change the signal data and make software gain on the channel - but this is a computational load, there will be a lot of sounds (2D game for example).
Perhaps, in some case, it will help to transfer the required balance from the server immediately.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question