Add jp's ultrafast "ambience" (immersive sounds) mod.

This commit is contained in:
AntumDeluge 2016-08-05 11:13:08 -07:00
parent 09c7609294
commit 878b2bee8f
20 changed files with 295 additions and 0 deletions

View File

@ -93,12 +93,14 @@ The following mods are also included:
* [lightning][] ([LGPL/CC-BY-SA](mods/weather/lightning/README.md))
* [weather][] ([LGPL/WTFPL/CC-BY-SA](mods/weather/weather/README))
* world/
* [ambience][ambience_ultralite] (WTFPL / [CC-BY / CC-BY-SA / CC-BY-NC-SA / CC0](mods/world/ambience/sounds/SoundLicenses.txt))
* [areas][] ([LGPL](mods/world/areas/LICENSE.txt))
* [glow][] (GPL)
* [worldedge][] ([DWYWPL](mods/world/worldedge/licence.txt))
[ambience_ultralite]: https://forum.minetest.net/viewtopic.php?p=151166#p151166
[areas]: https://forum.minetest.net/viewtopic.php?t=7239
[3d_armor]: https://forum.minetest.net/viewtopic.php?t=4654
[adv_spawning]: https://github.com/sapier/adv_spawning

View File

@ -0,0 +1,4 @@
# ambience_ultralite
Mod that adds environment sounds in Minetest.
Stripped version of Immersive Sounds .36 mod by Neuromancer and TenPlus1.

View File

@ -0,0 +1 @@
default

View File

@ -0,0 +1,228 @@
--= Ambience lite by TenPlus1 (2nd March 2015)
--= modified by kilbith (2015)
local max_frequency_all = 1000 -- larger number means more frequent sounds (10-1000)
local SOUNDVOLUME = 1
local volume = 0.3
local ambiences
local played_on_start = false
local tempy = {}
-- sound sets
local night = {
handler = {}, frequency = 40,
{name="hornedowl", length=2.5},
{name="cricket", length=6}
}
local day = {
handler = {}, frequency = 40,
{name="robin", length=4.5},
{name="bird1", length=11.5},
{name="bird2", length=6.5}
}
local air_high = {
handler = {}, frequency = 20,
{name="craw", length=3.5}
}
local cave = {
handler = {}, frequency = 60,
{name="drippingwater1", length=1.5},
{name="drippingwater2", length=1.5}
}
local beach = {
handler = {}, frequency = 80,
{name="seagull", length=4.5},
{name="wind", length=9.5}
}
local desert = {
handler = {}, frequency = 20,
{name="desertwind", length=8.5}
}
local flowing_water = {
handler = {}, frequency = 1000,
{name="waterfall", length=6}
}
local underwater = {
handler = {}, frequency = 1000,
{name="scuba", length=8}
}
local splash = {
handler = {}, frequency = 1000,
{name="swim_splashing", length=3}
}
local lava = {
handler = {}, frequency = 1000,
{name="lava", length=7}
}
-- check where player is and which sounds are played
local get_ambience = function(player)
-- where am I?
local pos = player:getpos()
-- what is around me?
pos.y = pos.y + 1.4 -- head level
local nod_head = minetest.get_node(pos).name
pos.y = pos.y - 1.2 -- feet level
local nod_feet = minetest.get_node(pos).name
pos.y = pos.y - 0.2 -- reset pos
-- START Ambiance
if nod_head == "default:water_source" or nod_head == "default:water_flowing" then
return {underwater=underwater}
end
if nod_feet == "default:water_source" or nod_feet == "default:water_flowing" then
return {splash=splash}
end
-- this may seem messy but is faster than checking each area separately for specific nodes
local num_lava, num_water_source, num_water_flowing, num_desert = 0,0,0,0
-- get block of nodes we need to check
tempy = minetest.find_nodes_in_area({x=pos.x-6,y=pos.y-2, z=pos.z-6}, {x=pos.x+6,y=pos.y+2, z=pos.z+6},
{"default:lava_flowing", "default:lava_source", "default:water_flowing", "default:water_source",
"default:desert_sand", "default:desert_stone",})
-- count separate instances in block
for _, npos in ipairs(tempy) do
local node = minetest.get_node(npos).name
if node == "default:lava_flowing" or node == "default:lava_source" then num_lava = num_lava + 1 end
if node == "default:water_flowing" then num_water_flowing = num_water_flowing + 1 end
if node == "default:water_source" then num_water_source = num_water_source + 1 end
if node == "default:desert_sand" or node == "default:desert_stone" then num_desert = num_desert + 1 end
end ; --print (num_fire, num_lava, num_water_flowing, num_water_source, num_desert)
if num_lava > 5 then
return {lava=lava}
end
if num_water_flowing > 30 then
return {flowing_water=flowing_water}
end
if pos.y < 7 and pos.y > 0 and num_water_source > 100 then
return {beach=beach}
end
if num_desert > 150 then
return {desert=desert}
end
if pos.y < -10 then
return {cave=cave}
end
if pos.y > 60 then
return {air_high=air_high}
end
if minetest.get_timeofday() > 0.2 and minetest.get_timeofday() < 0.8 then
return {day=day}
else
return {night=night}
end
-- END Ambiance
end
-- play sound, set handler then delete handler when sound finished
local play_sound = function(player, list, number)
local player_name = player:get_player_name()
if list.handler[player_name] == nil then
local gain = volume * SOUNDVOLUME
local handler = minetest.sound_play(list[number].name, {to_player=player_name, gain=gain})
if handler then
list.handler[player_name] = handler
minetest.after(list[number].length, function(args)
local list = args[1]
local player_name = args[2]
if list.handler[player_name] then
minetest.sound_stop(list.handler[player_name])
list.handler[player_name] = nil
end
end, {list, player_name})
end
end
end
-- stop sound in still_playing
local stop_sound = function (list, player)
local player_name = player:get_player_name()
if list.handler[player_name] then
if list.on_stop then
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME})
end
minetest.sound_stop(list.handler[player_name])
list.handler[player_name] = nil
end
end
-- check sounds that are not in still_playing
local still_playing = function(still_playing, player)
if not still_playing.air_high then stop_sound(air_high, player) end
if not still_playing.cave then stop_sound(cave, player) end
if not still_playing.beach then stop_sound(beach, player) end
if not still_playing.desert then stop_sound(desert, player) end
if not still_playing.night then stop_sound(night, player) end
if not still_playing.day then stop_sound(day, player) end
if not still_playing.flowing_water then stop_sound(flowing_water, player) end
if not still_playing.splash then stop_sound(splash, player) end
if not still_playing.underwater then stop_sound(underwater, player) end
if not still_playing.lava then stop_sound(lava, player) end
end
-- player routine
local timer = 0
minetest.register_globalstep(function(dtime)
timer = timer + dtime
-- every 1 second
if timer < 1 then return end
timer = 0
for _,player in ipairs(minetest.get_connected_players()) do
--local t1 = os.clock()
ambiences = get_ambience(player)
--print ("[AMBIENCE] "..math.ceil((os.clock() - t1) * 1000).." ms")
still_playing(ambiences, player)
for _,ambience in pairs(ambiences) do
if math.random(1, 1000) <= ambience.frequency then
if ambience.on_start and played_on_start == false then
played_on_start = true
minetest.sound_play(ambience.on_start,
{to_player=player:get_player_name(),gain=SOUNDVOLUME})
end
play_sound(player, ambience, math.random(1, #ambience))
end
end
end
end)
-- set volume command
minetest.register_chatcommand("svol", {
params = "<svol>",
description = "set sound volume (0.1 to 1.0)",
privs = {server=true},
func = function(name, param)
SOUNDVOLUME = param
minetest.chat_send_player(name, "Sound volume set.")
end,
})

View File

@ -0,0 +1,60 @@
--------------Music Lic:
Amethystium:
--Avalon
--Ethereal
--Faraway
--Strangely Beautiful
"I can't give you a formal license (legal paperwork) for it, but as long as it's non-commercial I can give you my personal blessing and guarantee that you won't get in trouble for using it :) If that's enough just feel free to use any of my tracks. Please credit the music properly though, and include a link to www.amethystium.com and www.am.mu (it's the same site right now, but the latter will be a label/music store site soon).
Best regards,
Øystein Ramfjord"
Jordach:
--dark_ambiance
--eastern_feeling
These sounds are used for the Mod for Minetest; Ambiance.
The included sounds are http://creativecommons.org/licenses/by-nc-sa/3.0/
Not Used:--mtest
-----------Sound Lic:
--Nightime Sound, Recorded by Mike Koenig, License: Attribution 3.0 http://soundbible.com/951-Nightime.html
--Crickets At Night Sound, License: Attribution 3.0 | Recorded by Mike Koenig |http://soundbible.com/365-Crickets-At-Night.html
--Medium Pack Of Wolves Howling, License: Public Domain | Recorded by fws.gov, http://soundbible.com/277-Medium-Pack-Of-Wolves-Howling.html
--Horned Owl Sound, License: Attribution 3.0 | Recorded by Mike Koenig , http://soundbible.com/1851-Horned-Owl.html
-- Single Water Droplet Sound, License: Attribution 3.0 | Recorded by Mike Koenig, http://soundbible.com/384-Single-Water-Droplet.html
--HollowWind, Black Boe, Creative Commons 0 License, http://www.freesound.org/people/Black%20Boe/sounds/22331/
--drippingwater*.ogg sounds: CC0, Dripping Water Mod, by kddekadenz, http://minetest.net/forum/viewtopic.php?id=1688
--birdsongnl: the Attribution License, HerbertBoland, http://www.freesound.org/people/HerbertBoland/sounds/28312/ (end)
--robin2: Attribution License, reinsamba, http://www.freesound.org/people/reinsamba/sounds/32479/ (end)
--scuba1*.ogg- digifishmusic, Attribution License, http://www.freesound.org/people/digifishmusic/sounds/45521/
ComboWind uses:
--wind-in-the-trees -Attribution License, laurent, http://www.freesound.org/people/laurent/sounds/16995/
--drygrassInWind- Creative Commons 0 License, felix.blume, http://www.freesound.org/people/felix.blume/sounds/146436/
--Splash: Attribution 3.0 | Recorded by BlastwaveFx.com, http://soundbible.com/546-Fish-Splashing.html
--small_waterfall Attribution License, volivieri, http://www.freesound.org/people/volivieri/sounds/38390/
--Lake_Waves_2*, Attribution License, Benboncan, http://www.freesound.org/people/Benboncan/sounds/67884/
--water_swimming_splashing*, Attribution Noncommercial License, Robinhood76, http://www.freesound.org/people/Robinhood76/sounds/79657/
--earth01a, Creative Commons 0 License., Halion , http://www.freesound.org/people/Halion/sounds/17785
-- Beach, Public Domain, blastwavefx's , http://www.freesfx.co.uk/info/eula/
--seagull, Attribution Noncommercial License., hazure, http://www.freesound.org/people/hazure/sounds/23707/,
desert:
coyote2, Attribution License, rogerforeman, http://www.freesound.org/people/rogerforeman/sounds/68068/
http://www.freesound.org/people/Proxima4/sounds/104319/
Desert Monolith.wav, Creative Commons 0 License, Proxima4, http://www.freesound.org/people/Proxima4/sounds/104319/

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.