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

Fixed volume of emulated wii mote speakers not being native. #8927

Merged
merged 1 commit into from Oct 21, 2020

Conversation

Filoppi
Copy link
Contributor

@Filoppi Filoppi commented Jul 3, 2020

As in the code comment, the panning was denaturalizing the volume (when panning was set to 0).
Unless users actually want to use panning, their wii mote volume should not be reduced, it should come out at the same volume the samples were, without using the "Constant Power Pan Law" as we can't assume the original wii mote speakers loadness is comparable to the loudness of the audio device you are currently using (in fact, it's likely to be lower).
If users want to reduce the volume of the wii mote speakers, they can do so from the wii home menu.
I opted for this instead of adding another setting "Enable Panning" as it would have been confusing, and the changes in the panning formula are unlikely to have any negative effect, as it still works.

@JosJuice
Copy link
Member

JosJuice commented Jul 3, 2020

I don't see how the "it implied that the loudness of a wiimote speaker is equal to the loudness of your device speakers" part makes sense. The constant power pan law is about making sure that the audio doesn't change in perceived loudness as you change the panning, not about making sure that the audio is the same in perceived loudness as the audio of a real Wii Remote speaker.

I think it's best to keep using the constant power pan law if we allow panning, since it does fix a problem. But I do also think that the utility of letting the user pan the Wii Remote speaker audio is limited.

@Filoppi
Copy link
Contributor Author

Filoppi commented Jul 3, 2020

Yes I understand that the pan law makes sense within panning, but it doesn't make sense if you don't want panning.
I don't want panning, and with panning at 0, Dolphin is assuming it needs to normalize the perceived volume of the wii mote speaker, so that I would hear it with the same volume as if it came from a single speaker. But that single speaker would have been a wii mote speaker, which isn't comparable to your device speakers/headphones at all, so not adjusting the volume at all is better than adjusting towards something that is likely wrong.

@Filoppi
Copy link
Contributor Author

Filoppi commented Jul 3, 2020

@JosJuice I discussed with multiple people yesterday, and they actually had one good use case for panning. For example, if 2 people were playing multplayer with 2 normal controllers on Dolphin, they could each pan their wii mote speaker to the PC speaker on their side, so the direction of the wii mote sounds would be clear.
This came out after I proposed to get rid of it altogether.

Panning still works fine without the pan law, so I don't think taking out the pan law is a problem. If a user wants panning, they mainly want it to have the sounds more or less loud on one side, and they can still achieve that, there is no need to adjust the perceived loudness towards a random direction which we can't know is right.

@jordan-woyak
Copy link
Member

The "pan law" is fun because it's cool to be mathematically correct but I think I might agree that it's not practical here.
95% of the time people will use pan 0 and basically everyone else will use a full -1 or +1.
We might as well just push the samples at full volume.

That being said your math looks a bit wrong.
You have exactly the same calculation for left_volume and right_volume.
std::min shouldn't be needed after using std::clamp.
I think multiplying by 256 and rounding-down should be more uniform than multiplying by 255 and rounding-to-nearest.

@Filoppi
Copy link
Contributor Author

Filoppi commented Jul 3, 2020

My CTRL key broke and CTRL+S doesn't work anymore, so I missed the last save where I fixed the math left/right

@Filoppi
Copy link
Contributor Author

Filoppi commented Jul 3, 2020

The "pan law" is fun because it's cool to be mathematically correct but I think I might agree that it's not practical here.
95% of the time people will use pan 0 and basically everyone else will use a full -1 or +1.
We might as well just push the samples at full volume.

That being said your math looks a bit wrong.
You have exactly the same calculation for left_volume and right_volume.
std::min shouldn't be needed after using std::clamp.
I think multiplying by 256 and rounding-down should be more uniform than multiplying by 255 and rounding-to-nearest.

No, clamp is very much not needed, but I put it there to be safe in case someone passed a pan over 1 or below -1, in that case the volume result would loop around.

@JosJuice
Copy link
Member

JosJuice commented Jul 3, 2020

If others agree on not wanting to keep the pan law, you don't have to treat my comment as a blocker.

@Filoppi Filoppi changed the title Fixed volume of emulated wii mote speakers not being native. WIP: Fixed volume of emulated wii mote speakers not being native. Jul 3, 2020
@Filoppi Filoppi changed the title WIP: Fixed volume of emulated wii mote speakers not being native. Fixed volume of emulated wii mote speakers not being native. Jul 3, 2020
@Filoppi Filoppi changed the title Fixed volume of emulated wii mote speakers not being native. WIP: Fixed volume of emulated wii mote speakers not being native. Jul 4, 2020
@Filoppi Filoppi changed the title WIP: Fixed volume of emulated wii mote speakers not being native. Fixed volume of emulated wii mote speakers not being native. Jul 4, 2020
@Filoppi
Copy link
Contributor Author

Filoppi commented Jul 20, 2020

@JosJuice I discussed with multiple people yesterday, and they actually had one good use case for panning. For example, if 2 people were playing multplayer with 2 normal controllers on Dolphin, they could each pan their wii mote speaker to the PC speaker on their side, so the direction of the wii mote sounds would be clear.
This came out after I proposed to get rid of it altogether.

Panning still works fine without the pan law, so I don't think taking out the pan law is a problem. If a user wants panning, they mainly want it to have the sounds more or less loud on one side, and they can still achieve that, there is no need to adjust the perceived loudness towards a random direction which we can't know is right.

Thinking about it, when emulating 2 wii mote simultaneously, they won't be able able to play sound at the same time, it would cripple both sounds as it would play a few samples from the first, then a few samples from the second and so on. I don't see how it could work with the current code. Which make my above comment "wrong", so we don't really have any reason to keep the padding. Unless I add support to play 2 wii mote sounds simultaneously, which I'm looking to do.

@Filoppi
Copy link
Contributor Author

Filoppi commented Jul 22, 2020

Worth mentioning here: if DPLII is enabled and panning is 0, the wii mote samples will only come out of the central channel because samples that are identical between the left and right channel are rerouted to the central speaker.

As in the comment, the panning was denaturalizing the volume (when the panning was at 0).
Unless users actually want to use panning, their wii mote volume should not be reduced, it should come out at the same volume the samples were.
If users want to reduce the volume of the wii mote speakers, they can do so from the wii home menu.
I opted for this instead of adding another setting "Enable Panning" as it would have been confusing, and the changes in the panning formula are unlikely to have any negative effect, as it still works.
@leoetlino leoetlino merged commit fd5f9f4 into dolphin-emu:master Oct 21, 2020
10 checks passed
@Filoppi Filoppi deleted the wiimote-pan-fix branch March 11, 2021 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants