Different sounds for day/night cycle

Hi everyone!

First time doing this so please be gentle :slight_smile:

I have a day night cycle set up and I am wanting to add general forest noises to the day (Birds) and general night noises to the night (Crickets, frog, ect.) however my current setup plays correctly (day sounds come in during day and night sounds come in during night at the times I have specifed) but doesn’t stop when the other sound comes in so I have day sounds overlapping with night sounds. I have tried searching for a way to stop one if the other plays but havent come up with anything. I am a novice with unreal so pictures and simple explantions would be appreciated :slight_smile:

Thank you!

Picture of my BPs attached

What you’ll want to do is make variables out of the Play2DSound. right-click on the sound input on the node and click “Promote to variable”. Then what you can do with this variable is to stop the audio before it resets the DoOnce node. Give it a try.

Thanks for getting back to me so quickly. I have set up those sounds as variables but how would i go about stopping them before the reset on DoOnce. Thanks again!

Like this:

A lot of people new to the engine do everything on tick. It’s a habit to break :slight_smile:

You could use a timer, which could run once a second instead of every frame to control the time of day.


Yeah definitely use a timer. It would be wasteful to spend every tick on this. And I would just put a stop node after the play sound with the sound used just before. If that doesn’t work, maybe you could try adding a delay before the Do Once resets? Maybe the audio is finishing straight away and resetting.

Wow, that is great information, thank you both for getting back to me. One more question if you don’t mind, what am I setting the variable type as? I have tried a few things and they don’t seem to play nice with the stop node.

On the SpawnSound2d, right click the input pin and ‘promote to variable’.

Tried that and it gives me this.

So you do that on the left to get the right variable type to hold the wave files, do it on the right pin to get the variable type to hold the playing sound which you can call stop with…

Haha I am a lost cause. Thank you so much for all your help with this!