Go to file
FaceDeer 8d4b806172 min and max y, count_min, and neighbors 2020-02-24 19:34:50 -07:00
sounds
README.txt min and max y, count_min, and neighbors 2020-02-24 19:34:50 -07:00
init.lua min and max y, count_min, and neighbors 2020-02-24 19:34:50 -07:00
license.txt
mod.conf genericize with a definition registration API 2020-02-05 18:17:13 -07:00

README.txt

Minetest Game mod: env_sounds
=============================
See license.txt for license information.

Environmental sounds are sounds that are played every once in a while (or continuously) based on what types of nodes are near to the player. They are registered with the following definition:

	env_sounds.register_sound(name, env_sound_def)

Where name is a unique identifier for this sound and env_sound_def is a table with the following properties:

	{
		nodes = {"default:water_flowing", "default:river_water_flowing"}, -- required, can include "group:groupname"
		count_min = 1		-- At least this many of the nodes must be present in range for the sound to play.
		neighbors = nil		-- A node list similar to above. If this is defined then one or more of any of these nodes
							-- must also be present within range of the player for this sound to play.
		radius = 8, 		-- Defaults to 8, this is the radius around the player that is scanned for nodes
		gain_minimum = 0.4,	-- Defaults to 0.4, minimum gain for the sound to be played
		gain_maximum = 1,	-- Defaults to 1, maximum gain for the sound to be played
		adjust_gain = true,	-- If true, adjust the gain based on how many nodes are nearby.
							-- If false, gain will be set to a random value between gain_minimum and gain_maximum.
		average_pos = true,	-- If true, the sound will come from the average position of all the nodes found
							-- If false, one node will be randomly selected as the sound source.
		sounds_day = {"env_sounds_water"}, -- list of SimpleSoundSpecs to be randomly selected from during the day
		sounds_night = {"env_sounds_water"}, -- list of SimpleSoundSpecs to be randomly selected from during the night
		delay_min = 3.5,	-- required, the minimum number of seconds to delay before testing for this sound again
		delay_max = 3.5,	-- required, the maximum number of seconds to delay before testing for this sound again
		y_min = -32000,		-- optional, lowest player elevation this sound will play at
		y_max = 32000,		-- optional, highest player elevation this sound will play at
	}

The delay between tests will be randomly set somewhere between delay_min and delay_max.

It is recommended that continuous ambient noise (such as that generated by flowing water) have "adjust_gain" set to true and a delay min/max value slightly below the duration of the sound being played to ensure the sounds overlap each other. For example, if your flowing water sound is 4 seconds long, have delay_max be 3.5 seconds to ensure that a new instance of the sound starts playing before the old one finishes fading away.

Occasional ambient noises (such as birds chirping in a forest's leaves) should usually have adjust_gain set to false since they represent individual sound sources scattered among the target nodes rather than the combined sound of many target nodes together.

Authors of source code
----------------------
paramat (MIT)

Authors of media (sounds)
-------------------------
Yuval (CC0 1.0)
https://freesound.org/people/Yuval/sounds/197023/
  env_sounds_water.*.ogg