What causes the audio clicking & how do I get a clean sound?
I have two sounds that I'm triggering about twice a second, one for each player, for an old-arcade-style movement noise (wakka wakka wakka bloit bloit bloit...) using PlayClipAtPoint. They're just uncompressed AIFFs and there's no other sound going on yet. I get this intermittent "thwip...thwip" glitch at random times every few seconds that sounds like a loose speaker connection. I'm getting over 100fps so the CPU can't be struggling.
I thought it could be a problem trying to play the sound before the last one had finished so I made two AudioSources for each player and alternated which one played sound each time; that didn't seem to make any difference. Any other ideas?
I found out that the problem is definitely in the 3d sound playback. It goes away if I only have Player1's AudioSource using "PlayOneShot" and Player2's using "PlayClipAtPoint" which I decided is the way I want it to work anyway. So my specific problem is solved, but not my general one. So what's up with multiple PlayClipAtPoint calls not playing nice with each other- has anyone else who had that "thwipping" figured out what to do to avoid it?
You may want to check your sound files in a DAW or wave-editing software to make sure there's no clipping (i.e. values that go above 0db).
You'll also want to make sure the file begins and ends at 0 (not 0db $$anonymous$$d you, but a flat wave value). If the wave is cut in the middle it will cause pops and crackles.
Answer by kubajs · Feb 10, 2016 at 05:33 PM
I had the same issue with PCM compression format. When I chaneged "Load Type" to "Streaming", problem was solved. "Compressed in memory" or "Decompress on load" was causing the clicking sounds. Also Compression format ADPCM or Vorbis worked for me,
This can be set directly in Inspector in Unity when clicking on audio file.
Thank you! changing in to "Strea$$anonymous$$g" fixed it for me! <3
Answer by r2r313 · Aug 11, 2017 at 06:52 AM
I realize this is an old thread but I wanted to share how I solved this issue. I had a similar problem with some audio clips I had and the fixes listed here did not work for me. I solved my issue by exporting at a higher bitrate. Originally they were 44100 (Hz) but changing to 48000 (Hz) and exporting as a .wav file solved the clicking noise issue.
Answer by Abram-Painter · Jun 06, 2016 at 07:47 PM
Go to ProjectSettings>Audio and set the DSP buffer size to best performance. it works.
Answer by rh_galaxy · Feb 08, 2019 at 06:19 PM
The clicking comes from not starting or ending at a zero sample... and when shutting off a looping sound or any sound anywhere before the end, you could do the fade out your self like this
AudioSource oASEngine;
bool bEngineFadeOut = false;
...
void Start()
{
...
foreach (AudioSource aSource in GetComponents<AudioSource>()) {
if (aSource.clip!=null && aSource.clip.name.Equals("engine"))
oASEngine = aSource;
else ...
}
}
void FixedUpdate()
{
...
if (startEngine) {
bEngineFadeOut = false;
oASEngine.volume = 1.0f;
oASEngine.Play();
} else if(stopEngine) {
//oASEngine.Pause(); //don't, this may cause clicking noise
bEngineFadeOut = true;
}
if(bEngineFadeOut)
oASEngine.volume *= 0.8f; //fade out over ~100-200 ms
}
Answer by Fajardo · Jan 07, 2013 at 07:21 PM
When it goes to audio, always do a double check in a DAW before exporting to an Engine. It's very important to find out where the problem is. Sometimes it's a problem with the sound wave.
First of all, try looping one of the sounds all alone. Since you are using an uncompressed AIFF sound there won't be a looping problem. Them do the same with the second one.
Second, try adding some silence to the end of the clip. Since you are using two Audio Sources it won't cause gaps between sounds
Third, you can try getting the sound exported in other formats, like .mp3 and .wav.
I hope one of this solutions solves your problem.
Your answer
Follow this Question
Related Questions
Buzzing sound in Everyplay recording! 1 Answer
Second AudioClip won't play 0 Answers
Sound remains 0 Answers
Fix sound delay 6 Answers
Some sounds won't play 0 Answers