I need to play the same audio clip over and over in rapid succession and sometimes simultaneously. I’m struggling to do this without clipping or popping occurring.
I’ve tried capping the played clips, various plugins and even parsing them through a mixer with a load of predefined groups however I just can’t get a satisfactory result.
I’ve scoured the internet for a solution and have tried many different approaches all with limited success.
ok, so I’ve had some success but it really doesn’t feel… right!?
I’ve created a mixer with a parent group that has 10 child groups. My sound manager creates an audio source for each child group and then when the play request comes in I’m looping through each source to check if it’s playing and if not, I go ahead and try the next. Assigning each source to its own group seems to improve things and I can also mess around with the parent group to adjust volume (normalize seems to work quite well). I wish I could do all this in code however it doesn’t seem possible to create a group at runtime, yet!?
I’d love to hear anyone’s opinion on this approach, I’m no sound engineer and I’m really just stumbling around in the dark so any advice/recommendations would be greatly appreciated.
For the pops, have you tried using AudioSource.PlayOneShot(AudioClip); instead of Play();? This should allow the clip to ring out instead of being cut off (which is where the pop is coming from), even if you’re only using one audio source.
For the clipping, although it seems to have helped you, you shouldn’t need to create multiple mixer groups. If you’ve got clips piling on top of each other and it’s getting too loud then a compressor on the mixer group should help keep it under control.
Normalize is probably helping because it brings an audio signal to a target peak level, or in your case it may be because it’s reducing it to the target level. The difference is that Normalize uses a consistent change in gain (everything gets increased / reduced to the target level) and a Compressor reduces signals that go over the threshold (which is why it’s suitable for limiting). But use whichever you prefer the sound of.