diff --git a/mesecons_noteblock/README.txt b/mesecons_noteblock/README.txt new file mode 100644 index 0000000..e0ad34c --- /dev/null +++ b/mesecons_noteblock/README.txt @@ -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/ diff --git a/mesecons_noteblock/doc/noteblock/description.html b/mesecons_noteblock/doc/noteblock/description.html index e11724d..a98c0f9 100644 --- a/mesecons_noteblock/doc/noteblock/description.html +++ b/mesecons_noteblock/doc/noteblock/description.html @@ -6,8 +6,8 @@ This effector makes a sound if powered and can be used for making music. Normall Chest or Locked ChestSnare Any treeCrash Any wooden planksLite Crash -Coal BlockExplosion sound -Lava SourceFire sound +Coal BlockExplosion sound (fixed pitch) +Lava SourceFire sound (fixed pitch) Steel BlockPiano (high pitch, one octave higher than normal) Any other blockPiano (low pitch) diff --git a/mesecons_noteblock/init.lua b/mesecons_noteblock/init.lua index d29ab88..79107bb 100644 --- a/mesecons_noteblock/init.lua +++ b/mesecons_noteblock/init.lua @@ -61,6 +61,18 @@ mesecon.noteblock_play = function(pos, param2) pos.y = pos.y-1 local nodeunder = minetest.get_node(pos).name 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 for k,v in pairs(node_sounds_group) do local g = minetest.get_item_group(nodeunder, k) @@ -79,6 +91,19 @@ mesecon.noteblock_play = function(pos, param2) if nodeunder == "default:steelblock" then soundname = soundname.. 2 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 pos.y = pos.y+1 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}) minetest.after(3.0, minetest.sound_fade, handle, -1.5, 0.0) else - minetest.sound_play(soundname, {pos = pos}, true) + minetest.sound_play(soundname, {pos = pos, pitch = pitch}, true) end end diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_litecrash.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_litecrash.ogg index 79ab256..36d83f3 100644 Binary files a/mesecons_noteblock/sounds/mesecons_noteblock_litecrash.ogg and b/mesecons_noteblock/sounds/mesecons_noteblock_litecrash.ogg differ