-
Notifications
You must be signed in to change notification settings - Fork 993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Channel
nodes have gain < 1 even with volume set to 0 dB
#941
Comments
I'd appreciate any tips on how I might go about fixing this! |
Looks like it might be a bug in the |
Okay, I figured out the issue: the c.c. @tambien this behavior seems unintuitive to me. Shouldn't |
This seems like the same problem as #609 The issue is that Safari has not implemented the StereoPannerNode natively which means that we can't use that browser's native channel mapping and it has to be passed in explicitly for any node that uses the StereoPannerNode under the hood (like Channel and Panner, PanVol).
If we set it to either stereo or mono by default, it is going to be wrong some percentage of the time. The only solution for now is to wait until Safari implements this node type. |
That makes sense. For now I just made myself a little wrapper: import { Channel as ToneChannel } from 'tone';
export class Channel extends ToneChannel {
constructor(...args) {
const opts = { channelCount: 2 };
if (args[0]) {
opts.volume = args[0];
}
if (args[1]) {
opts.pan = args[1];
}
if (args[2]) {
opts.channelCount = args[2];
}
super(opts);
}
} |
Describe the bug
Using multiple
new Channel()
ornew Channel(0)
nodes in series results in very quiet volume. These nodes don't have unity gain when set to volume of 0 dB.In my application I'm using
Channel.send
andChannel.receive
all over the place, which is amazing and simplifies my life so much!However, I started to notice that the more
Channel
nodes I added, the quieter the sound got...To Reproduce
Open this JSFiddle and drag the slider to chain multiple channels together, observe the volume meter get quieter the more channels you add: https://jsfiddle.net/micahscopes/qbatvkj1/181/
Expected behavior
I should be able to chain together dozens of
new Channel(0)
nodes and the source volume will be preserved.What I've tried
I tried initializing the
Channel
objects withnew Channel(4)
and that seemed to roughly preserve the volume. So theChannel
nodes are doing something like -4 dB by default, even when they're set at a volume of 0 dB.I also looked at the code for
Channel
and saw that there's some basic unit conversion. Maybe the bug is in the unit conversion code?The text was updated successfully, but these errors were encountered: