Assigning Pitch modulation to an asset.

I’m attempting to assign a sound cue pitch to an object in UE4.
So as the player gets closer to the object, the pitch of the sound will increase, and vice versa.
Is it possible to set this up in UE4?

Thank You

I have actually attempted to do something similar so all i can tell you is the wrong way to do it and maybe you can figure out what i’m doing wrong:

So essentially what i’m doing here is almost a for loop, but i’m trying to use the pitch multiplier to make the heartbeat go faster, and i’m checking it against the “max heartrate” variable i set for myself to cap out the fastest i want it to speed up. What you’re not seeing is that this whole section is being called by a custom event i added that triggers every time someone presses the shift button. At the end of that custom event, it calls itself, essentially creating a loop, and the break function is a boolean i have set to true when the button is pressed, and false when the button is released, so with every loop it will check if the button is still being pressed and then if it isn’t, it will do nothing, if it is, it will continue to loop.

For your case, what you would do is create a simple collision sphere around your object at the radius when you want the sound effect to start speeding up, and assign a “on component begin overlap” to it that kicks off the custom event loop and turns the activation boolean on inside your character. And then you would assign the deactivation of that boolean to the “on component end overlap” event, and in each loop you would have a local variable that checks the distance of your character from the object, compares that distance to the previous distance recorded, and if it is smaller, it sets the pitch multiplier higher, if it is larger, it sets the pitch multiplier lower. Maybe this is a bit of a crude method that would require a bit of bug testing on the actual numbers so you didn’t leave the collision sphere with pitch modulation still applied. There is probably a more graceful way but it should work.

So you get the logic of how a loop like this might be set up, so what is the problem with this method?

Well, it turns out the “set pitch multiplier” only updates for me ONCE. So in the end my heartrate doesn’t actually speed up. Even though i have done a lot of bug testing for this and got it to spit out the “get pitch multiplier” as a string just to check i was actually modifying it and indeed i was. WHY it is updating the pitch multiplier attribute but NOT actually multiplying the pitch is beyond me. So if you can figure out why thats happening or a workaround you will have fixed both of our problems. But at least i can tell you how to set up the rest of it.

Hi BenVolo,

Thank you for taking the time to answer. Unfortunately I’m very new to UE4 so I’m still getting to know how all this coding works. I’m coming from Wwise where it was much easier to set up.

Lets keep our fingers crossed for an UE4 expert to jump in our problems.

Cheers,