I’m working on a puzzle where each letter triggers a short audio, aiming for a smooth mechanical keyboard sound effect (sort of). How can I make this sound more smooth? I wanted to get sort of a mechanical keyboard sound effect. Any suggestions on how to make the sound more seamless and less glitchy?
private IEnumerator PlayAnimation()
{
animating = true;
animating = true;
int itemsIncluded = 4;
for (int i = 0; i < _cipherSlotList.Count; i++)
{
if (i >= itemsIncluded)
{
_cipherSlotList[i - itemsIncluded].StartSparkleAnimation(false);
}
_cipherSlotList[i].StartSparkleAnimation(true);
_cipherSlotList[i].StartLetterAnimation(true);
if (i % 2 == 0)
_cipherSlotList[i].PlaySound(); //play sound
yield return new WaitForSeconds(_timeBla);
}
for (int i = _cipherSlotList.Count - itemsIncluded; i < _cipherSlotList.Count; i++)
{
_cipherSlotList[i].StartSparkleAnimation(false);
}
animating = false;
}
internal void PlaySound()
{
_soundController.PlaySound();
_soundController.audioSource.pitch = UnityEngine.Random.Range(0.9f, 1.1f);
}
I tried playing the sound of every second item, but that didn’t work. Also, audioSource.PlayOneShot doesn’t make difference. The only way I could smooth out things a little bit, is with pitching the audio with random values.