Water waves sound

Any tips to dynamically make sounds playing near water terrain, like waves? I don’t know where to start for this.

1 Like

To make it play from a shore line, you could place invisible parts along the shore, parent the sound to each part, and have them play a wave sound in a loop. Start it from a script so they are all synchronized.

4 Likes

If you want to dynamically play sounds, you can use the PlaySound function:
local Sound = Instance.new(“Sound”)
Sound.SoundId = “rbxassetid://#####” --Change this to your sound ID
Sound.Parent = workspace
Sound:Play()

That could work, but I want it to make the parts automatically with a script. Is that possible?

The Volumetric Sounds Beta is Here explains the way Sounds now play from Parts.
Just put a thin Part at the surface of your Water that’s the size of your water and place the wave Sound in it.
Change the RollOffMin and Max distance so your sound only plays a certain distance above and below your sound Part.
It’s just that simple.

I’ve got it set up that way in my Steampunk place and my Boat Obby place. The farther you get from the water surface, the quieter the wave sound gets.

Can I make a script put the parts for me automatically? The problem is that water is scattered across the map, and probably won’t be able to do it manually.
I’m using the Pirate Island map:
image

Do you only want waves at shoreline areas, or just water wave sounds?
My Yeah, steampunk… place has just one ‘wave sound Part’ at the surface of the water. If I remember correctly I put the MaxRollOff distance at about 22 studs, so that if you climb up on land the sound is no longer heard.

If you mean wave sounds only at shoreline areas that’s going to be a bit tougher. You’d probably need a bunch of manually placed Parts like @Maelstorm_1973 said.

I only want the sounds to be heard on the shoreline areas. I guess I’ll go with the manually placed parts . Thanks!

1 Like

That’s definitely possible. Here’s some code that you would need to use (made on the fly, untested but should work).

local position = {
	Vector3.new(x1, y1, z1);
	Vector3.new(x2, y2, z2);
	Vector3.new(x3, y3, z3);
	-- Add more as needed.
	-- x, y, z are to be replaced by numbers and are not variables.
}
local soundList = {}

-- Create the parts.
for _, item in pairs(position) do
	local part = Instance.new("Part")
	part.Size = Vector3.new(1, 1, 1)
	part.Position = item
	part.Transparency = 1
	local sound = Instance.new("Sound")
	sound.SoundId = "rbxassetid://123456789"
	sound.Looped = true
	sound.Volume = 0.5
	sound.Parent = part
	table.insert(soundList, sound)
	part.Parent = game.Workspace
end

-- Start playing the sounds.  We want this to be as close
-- to synchronized as possible to reduce beat distortion
-- effects.
for _, item in pairs(soundList) do
	item:Play()
end

That should do it. You add an entry to the position table for each part you want to create.

If done that way @joystick should set the RollOffMinDistance and RollOffMaxDistance so they aren’t set at the default values.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.