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

Many overlapping sounds cause distortion #39

Open
Enet4 opened this issue Mar 17, 2015 · 2 comments
Open

Many overlapping sounds cause distortion #39

Enet4 opened this issue Mar 17, 2015 · 2 comments
Milestone

Comments

@Enet4
Copy link
Contributor

Enet4 commented Mar 17, 2015

Back in the original Notrium, the underlying engine had a limit on the number of sounds played simultaneously, which had a curious effect on rapid-fire guns and fires. With the transition to SDL, this limit was removed, but now we get some uncomfortable distortion when lots of fires or continuous sounds coexist. An example: simply have the player stay among many fires (such as the first room in the Hermit's house), and you will notice this.

Is there anything that can be done to alleviate this? I'm not sure if we have 3D sound working right now, but maybe we need a bit more than this.

@verhoevenv verhoevenv added this to the v1.0 milestone Jun 23, 2015
@Enet4
Copy link
Contributor Author

Enet4 commented Sep 21, 2015

It seems that the volume and pan for each sound are calculated here. The original version worked just as well as what we have right now, with the exception of not supporting as many sounds at the same time. This actually helped cut some noise in places with lots of sounds, but now it's something we should fix properly. I suggest we pick a more advanced solution to 3D audio, such as OpenAL.

@Enet4
Copy link
Contributor Author

Enet4 commented Sep 4, 2016

So as discussed on Gitter a while ago, I first suggested that we limit the number of sounds being reproduced at the same time (therefore attempting to replicate the behaviour of 1.4.2). What I first noticed is that our current code makes dynamically allocated mixing channels, so that new channels would be created when all of them are full.

This didn't seem right, so I tried removing that logic and keeping the number of mixing channels to a lower number. With values of 6 and 8, the distortion becomes slightly less noticeable, but this will also prevent any incoming sound samples from being played if the channels are full.

Note that this isn't the original behaviour: in Ville's Notrium, there is some sort of mechanism that prevents the same sound from being played too many times (3 I think) in a short period of time. That makes me wonder how sound is handled there, and what we are missing to achieve this.


I also think that the ambient sounds occur much more frequently in this version (bird chirps, winds, alien growls, ...). I wonder what parts of the code handle this...

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

2 participants