Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Audio Replaying audio clip at speed and position of players hand

Discussion in 'Audio & Video' started by konose, Mar 12, 2018.

  1. konose

    konose

    Joined:
    Oct 6, 2013
    Posts:
    4
    Hello!

    I am working on a project where I would like to allow the player to move their hand(VR) through a visualization of an audio clip (imagine an audio waveform along a line). When they do this, I would like to have the clip play back the audio at the current location their hand is at in the clip and at the same speed their hand is traveling. I also want this to work in reverse, so when their hand is traveling backward through the clip, the clip plays in reverse.

    The only way(hacky) I have been able to do anything close to this is to take the location of the hand on the waveform, and create a new sub clip of the main audio clip at that location(time), and then play that sub clip for a very short period of time. As the player moves their hand through the clip, I fade out the previous sub clip and start a new one. This method also does not work well when playing sound in reverse...

    This method doesn't sound great, as there is a bit of a stutter and an echo from the sub clips fading out. I am a super noob when it comes to Audio, so I would not be surprised if there is a much better approach to this problem.

    Any advice on how to do this properly is greatly appreciated :)
     
  2. Drown

    Drown

    Joined:
    Feb 5, 2017
    Posts:
    11
    I am just going to give a very theoretical approach as I don't know alot about VR programming and how one can interact with the stuff inside the view frustum.

    If I had to do this I would try to see the wave form as a slider, whereas 0 is the beginning of the track and 1 is the end of the track. Then pulling the slider between 0 and 1 would be translated into the appropriate amount of "audio time" . That would allow to simply "drag" through the audio without assigning a new subtrack or something like that.

    You would need to find a way to style the slider as a waveform (maybe make it an invisible child?) so that you can have the interaction look however you want.