Search Unity

Audio Shepard Tone

Discussion in 'Audio & Video' started by unity_4HuTETWIfh8F4Q, Nov 17, 2018.

  1. unity_4HuTETWIfh8F4Q

    unity_4HuTETWIfh8F4Q

    Joined:
    Oct 18, 2018
    Posts:
    1
    First time posting a forum, so apologies if this is the wrong place.

    Would anyone happen to know an Asset of sorts, that allows the user to increase the pitch of a sound on collision, for example the Shepard tone, so no matter how many times you hit the wall, it always sounds like the pitch is increasing.

    I've made a few attempts to make it myself but sadly no luck.

    Thanks!
    James
     
  2. leftshoe18

    leftshoe18

    Joined:
    Jul 29, 2017
    Posts:
    61
    Add something like
    audioSource.pitch += pitchIncreaseAmount
    to the OnCollisionEnter function. The variable audioSource would be an AudioSource component that you set elsewhere in the code and the pitchIncreaseAmount would be a float you set. The AudioSource component only allows you to modify the pitch to be between three times lower (-3) and three times higher (3) than the original sound clip though so there are limits to it.
     
  3. Docaroo

    Docaroo

    Joined:
    Nov 7, 2017
    Posts:
    82
    Unfortunately the Shepard Tone is a bit more complex than just increasing the pitch of one sound ... and in order for the illusion to work the tone sound needs to be constantly playing. Once the sound stops the listeners ears are "reset" and the illusion won't work.

    You will have to read some documention or tutorials on how to create shepard tones from sounds and then apply that in-game.