Skip to content
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

Possible bug with chained panners #609

Closed
maximedupre opened this issue Jan 16, 2020 · 6 comments
Closed

Possible bug with chained panners #609

maximedupre opened this issue Jan 16, 2020 · 6 comments

Comments

@maximedupre
Copy link

maximedupre commented Jan 16, 2020

It's hard to say if this is a bug, or if I'm lacking knowledge on common audio effects.

https://stackblitz.com/edit/tone-js-issue-609?file=index.ts

To me, this should output sound only in my right speaker.

If the current behaviour is the expected behaviour, what should I replace the first panner with to accomplish what I am trying to do? 2 Panners (one extreme left, one extreme right), routed to a CrossFade, routed to the second panner?

Cheers!

@tambien
Copy link
Contributor

tambien commented Jan 20, 2020

I looked into this a little and it's related to chrisguttandin/standardized-audio-context#647. It might require a parameter being passed into the constructor indicating that the source signal is stereo instead of mono until Safari implements the StereoPannerNode natively. This isn't ideal, but also might be a bit of an edge case where multiple StereoPanners are chained together.

Will investigate a little more into other options.

@chrisguttandin
Copy link
Contributor

Hi @maximedupre,

I played a bit with your example. I think I don't fully understand what you want to achieve in the end but is this getting any closer?

https://stackblitz.com/edit/tone-js-issue-609?file=index.ts

This would route the sound through the Panners in parallel.

@maximedupre
Copy link
Author

maximedupre commented Jan 20, 2020

Hey @chrisguttandin,

What I'm trying to show in the example is a case I have in my DAW application, where one track is being panned and where the master is also being panned. I don't expect the master to override the panning of the track, instead I would like them to add up in some way.

The link you posted does not show any difference from my original link, you might have the fork the example.

@chrisguttandin
Copy link
Contributor

Thanks for the explanation.

So in your case it work if you can set the channelCount of a Panner yourself, right? You could set it depending on the source of an individual channel for the channel's Panner. And you could set it to stereo for the Panner on the master. Does that make sense?

@maximedupre
Copy link
Author

Yes, I have no problem setting the channelCount of a panner myself. I'm not sure I completely understand the problem, but as long as I can treat both my tracks and the master as stereo, I'm fine with that. Down mixing any part of the audio nodes graph to mono is not desirable, unless of course it's unavoidable because of browser limitations.

I'm sure @tambien can answer this better than I can.

@tambien
Copy link
Contributor

tambien commented Jan 30, 2020

I've added an option to set the channelCount to 2, which you'll have to do on the second chained panner in order to have your desired behavior.

const panner1 = new Panner({
	channelCount: 2,
}).toDestination();
const panner0 = new Panner(-1).connect(panner1);
const sig = new Signal(1).connect(panner0);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants