Add pitch variations for most noteblock sounds
This commit is contained in:
parent
fedbf49372
commit
79135be97a
|
@ -0,0 +1,15 @@
|
||||||
|
Credits of sound files:
|
||||||
|
|
||||||
|
Note: Most sounds have not been used verbatim, but tweaked a little to be more suitable for the noteblock mod.
|
||||||
|
|
||||||
|
* mesecons_noteblock_litecrash.ogg
|
||||||
|
* License: CC BY 3.0
|
||||||
|
* by freesound.org user ani_music
|
||||||
|
* Source: https://freesound.org/people/ani_music/sounds/219612/
|
||||||
|
|
||||||
|
Everything else:
|
||||||
|
Created by Mesecons authors, licensed CC BY 3.0.
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
License links:
|
||||||
|
* CC BY 3.0: http://creativecommons.org/licenses/by/3.0/
|
|
@ -6,8 +6,8 @@ This effector makes a sound if powered and can be used for making music. Normall
|
||||||
<tr><td>Chest or Locked Chest</td><td>Snare</td></tr>
|
<tr><td>Chest or Locked Chest</td><td>Snare</td></tr>
|
||||||
<tr><td>Any tree</td><td>Crash</td></tr>
|
<tr><td>Any tree</td><td>Crash</td></tr>
|
||||||
<tr><td>Any wooden planks</td><td>Lite Crash</td></tr>
|
<tr><td>Any wooden planks</td><td>Lite Crash</td></tr>
|
||||||
<tr><td>Coal Block</td><td>Explosion sound</td></tr>
|
<tr><td>Coal Block</td><td>Explosion sound (fixed pitch)</td></tr>
|
||||||
<tr><td>Lava Source</td><td>Fire sound</td></tr>
|
<tr><td>Lava Source</td><td>Fire sound (fixed pitch)</td></tr>
|
||||||
<tr><td>Steel Block</td><td>Piano (high pitch, one octave higher than normal)</td></tr>
|
<tr><td>Steel Block</td><td>Piano (high pitch, one octave higher than normal)</td></tr>
|
||||||
<tr><td>Any other block</td><td>Piano (low pitch)</td></tr>
|
<tr><td>Any other block</td><td>Piano (low pitch)</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -61,6 +61,18 @@ mesecon.noteblock_play = function(pos, param2)
|
||||||
pos.y = pos.y-1
|
pos.y = pos.y-1
|
||||||
local nodeunder = minetest.get_node(pos).name
|
local nodeunder = minetest.get_node(pos).name
|
||||||
local soundname = node_sounds[nodeunder]
|
local soundname = node_sounds[nodeunder]
|
||||||
|
local pitch
|
||||||
|
-- Special sounds
|
||||||
|
if not soundname then
|
||||||
|
for k,v in pairs(node_sounds_group) do
|
||||||
|
local g = minetest.get_item_group(nodeunder, k)
|
||||||
|
if g ~= 0 then
|
||||||
|
soundname = v
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- Piano
|
||||||
if not soundname then
|
if not soundname then
|
||||||
for k,v in pairs(node_sounds_group) do
|
for k,v in pairs(node_sounds_group) do
|
||||||
local g = minetest.get_item_group(nodeunder, k)
|
local g = minetest.get_item_group(nodeunder, k)
|
||||||
|
@ -79,6 +91,19 @@ mesecon.noteblock_play = function(pos, param2)
|
||||||
if nodeunder == "default:steelblock" then
|
if nodeunder == "default:steelblock" then
|
||||||
soundname = soundname.. 2
|
soundname = soundname.. 2
|
||||||
end
|
end
|
||||||
|
pitch = false
|
||||||
|
end
|
||||||
|
-- Disable pitch for fire and explode because they'd sound too odd
|
||||||
|
if soundname == "fire_fire" or soundname == "tnt_explode" then
|
||||||
|
pitch = false
|
||||||
|
end
|
||||||
|
if pitch == false then
|
||||||
|
pitch = nil
|
||||||
|
else
|
||||||
|
-- Calculate pitch
|
||||||
|
local val = (param2+1)%12
|
||||||
|
-- All semitones from C to B (analog to piano mode)
|
||||||
|
pitch = 2^((val-6)/12)
|
||||||
end
|
end
|
||||||
pos.y = pos.y+1
|
pos.y = pos.y+1
|
||||||
if soundname == "fire_fire" then
|
if soundname == "fire_fire" then
|
||||||
|
@ -86,6 +111,6 @@ mesecon.noteblock_play = function(pos, param2)
|
||||||
local handle = minetest.sound_play(soundname, {pos = pos, loop = true})
|
local handle = minetest.sound_play(soundname, {pos = pos, loop = true})
|
||||||
minetest.after(3.0, minetest.sound_fade, handle, -1.5, 0.0)
|
minetest.after(3.0, minetest.sound_fade, handle, -1.5, 0.0)
|
||||||
else
|
else
|
||||||
minetest.sound_play(soundname, {pos = pos}, true)
|
minetest.sound_play(soundname, {pos = pos, pitch = pitch}, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue