How can I make a bouncing ball sound effect?

This seems impossible to do. I need to be able to find a way to trigger the sound effect ball bounce every time the ball hits an object. When the ball falls and hits the ground the sound gets stuck in an infinite loop where it plays the 1st milliseconds of the sound over and over. I have to use a unbind all events blueprint to stop the loop but it then doesn’t play any sound on the second bounce. I’m using the below Blueprint.

I do this in my games, and solved it the following way…

If you double click the sound asset in UE4, there is a Max Concurrent Play Count

Here is an example.

Tweak the values and see what works best for you.

86031-max+play.png

Why are you using “Get Socket Location” when you 't provide a socket? Just use “Get Actor Location”. The problem most likely is located elsewhere; what type of sound are you producing? Is it a Sound Cue or are you just calling the sound file? What format is the sound file in?

You can’t use a get actor location because the ball is a static mesh and a static mesh is not compatible with an actor reference. Thats why you have to use Get Socket Location. Its a sound que and in a WAV format.

I tried tweaking almost every combination using Max Concurrent Play Count but it doesn’t make a difference. After the ball bounces when it rests in the ground the sound still gets stuck in an infinite loop where it plays the 1st milliseconds of the sound over and over its sounds like a synthesiser distortion like this Arturia Minibrute Synthesizer Demo with Rat distortion, and The Holy Stain. - YouTube

Do you have an example of this blueprint that I can see because I can’t see any option to check(Tick) impulse. Its not there as an option. I can see max play count but not impulse.

Also I 't know what you mean by get the length of that vector. Where do I get that and what do I connect it to?

In a project of ours we use a combination of the max play count and checking the normal impulse. Get the length of that vector and print it. Test at which minimum you want to have the sound played and do a simple branch.

That way it will only trigger the sound when the object hits the ground with enough force which is exactly what we wanted. And prevents silly infinite loops when it’s almost not moving anymore as well.

Ok so I’m trying to figure this out based on exactly what Erasio said. I’m guessing that when he said “checking the normal impulse” he didn’t mean find a node that says Normal impulse and check(tick) it. I was lead to believe this because he said “combination of the max play count and checking the normal impulse” this would suggest that there was a normal impulse option in the sound pic I posted above which there is not so I figured he must mean a normal impulse somewhere else even though he didn’t state that.I looked in the ball BP and there is an normal impulse in there so that must be it.

Please remember I obviously never would have used or be familiar with a normal impulse otherwise I wouldn’t be having this problem. Sometimes getting an answer like this is more frustrating than getting no answer at all because it makes assumptions on your level of knowledge.

Next I looked at “Get the length of that vector and print it.” again I’m guessing he means to bring this off the normal impulse. I’m not sure because he doesn’t say that so again I’m left to guessing the answer. I’ve done that I’ve hooked it up to a print string and then there is this

“Test at which minimum you want to have the sound played” ??? What, How? This doesn’t tell me anything. Test it with what?

Sorry if I sound testy but I’ve been trying to fix this one problem for days and the solution should only take a few seconds but because the answers I get have gaps and la eot infrmtion thn it is hard to fill in the blanks.

See the pic below to see what I have set up so far.

Sorry about that. It seems like assumed too much knowledge on your part. It’s kinda hard to determine in what way to answer. When being too simple it sounds really condescending if you’re talking to someone with knowledge and also waste quite a bit of time.

But assuming too much leaves issues like this. Sorry for that.

Basically your second guess was pretty good. This is close to what I mean.

The boolean that you wanna feed into your branch is the result of a test with your vector length from the normal impulse.

You simply compare if it is higher than an arbitrary number which you will have to determine. This is why the print comes in handy. You can just throw down a ball and test at which point it starts to feel / sound weird if it still makes that noise. You can also decide to apply a different pitch or volume depending on how hard the impact is (which is your vector length. It’s a value which tells you with how much force the object hit the other object).

And like this you have to figure out which value fits best for your case. At which point shouldn’t it make a sound anymore? Should it affect pitch / volume? How so? etc. It’s a lot of testing what seems right and decisions which you will have to make.

Hi Erasio thanks for getting back to me. 't worry about explaining it as simply as you can. If it helps me get the result I’m looking for then I’m happy.

You mention "The boolean that you wanna feed into your branch is the result of a test with your vector length from the normal impulse. " but right now I’m getting no feedback from vector length it just creates a long list of the word hello. Also what boolean are you referring to? I think there is no way to be able to explain the difference in knowledge between us.

I think I’m going to have to give you an example of what I mean. Say I wanted to understand how to turn on the Physics on a ball. If someone said to me

“You need to set it up so your main actor can control the input of the ball then setup a main event to turn that on or off”

That wouldn’t help me. I wouldn’t know where to start. However if someone said

You need to create an actor BP put the ball in a static mesh in the BP Turn off physics, then in this BP from an “event begin play” drag off and set an “enable input”. From the “player controller” in this enable input drag off “get player controller” This will allow you to control the ball. Then in the same BP create a key event choose the keyboard “Z” key then from that drag off and set a “Set simulate Physics” node and the ball should already be attached.

Do you understand what I mean because I have never done anything remotely like what you are explaining I 't have a clue where to go from here. What I need to be able to fix this problem is either explain each step in detail or if you can show me an example BP so I know what to create.

Thanks again for your time and sorry again about getting testy earlier. Its so frustrating that for the last 4 days I’m working on a problem that should only take a few minutes to fix when I know what to do.

Erasio thanks so much this has worked perfectly and the way you explained it was perfect also.

The number was quite low on mine when it was resting on the floor about 0.87 but that is because the mass of the ball is very light so it doesn’t move anything when it hits it anyway I set mine to 10 just to make sure.

Oh. You need to plug the wire from your vector length into the pink / purple “String” entry of the “Print String” node. It will automatically add a conversion from number to text and display the value of that vector length instead of “Hello World”.

In other words show you on your screen how strong the force of the hit between your bouncing ball and the table / floor / anything you want is.

You can then pull out the wire from the impact normal vector length again and search for “>” and pick the one that compares two float values (by default the first one when context sensitive is turned on). There will be one number field in which you have to enter the minimum value at which it should produce the sound. The resulting boolean should go into the branch. At the beginning just leave this at 0 until you know what impact values you will get.

In the true output from your branch add your code to produce a sound.

Set the capsule to be slightly larger than the mesh or be sure to turn off collision of your mesh and do the following setup.

hope this helps.

the number represents the tolerance for bounce vs role. Lower number will result in sound triggering when the object roles if it’s around “9000” And i didn’t test if this number was different if the size of the object was different so you may want to expose this as a variable and test it case by case if you have different sized objects you want to take advantage of this functionality.

Thank you for the reply tcla75. Has your issue been resolved? If so, could you please accept the answer provided for tracking purposes? If not, I would be happy to provide more assistance! Thank you.