Page 1 of 1

.ogg sounds volume

PostPosted: Wed Jul 24, 2013 15:55
by Dan Duncombe
Does anyone here know how to make a node play an .ogg louder than another when both sounds are at the same time?

PostPosted: Wed Jul 24, 2013 16:05
by Mossmanikin
Do you mean something like:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.sound_play("some_sound_01", {
            pos = self.object:getpos(),
            gain = 0.7,
        })
minetest.sound_play("some_sound_02", {
            pos = self.object:getpos(),
            gain = 0.5,
        })
?

PostPosted: Wed Jul 24, 2013 16:09
by Dan Duncombe
Mossmanikin wrote:Do you mean something like:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.sound_play("some_sound_01", {
            pos = self.object:getpos(),
            gain = 0.7,
        })
minetest.sound_play("some_sound_02", {
            pos = self.object:getpos(),
            gain = 0.5,
        })
?


Very similar, my two current (working) bits of code are as follows:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_abm({
    nodenames = {"camo:turret_computer"},
    interval = 2,
    chance = 1,
    action = function(pos, node)
    local objects = minetest.env:get_objects_inside_radius(pos, 20)
        for _,obj in ipairs(objects) do
            if not obj:is_player() then
                music_handle=minetest.sound_play("industrial_siren",
                {pos = pos, gain = 1.0, max_hear_distance = 25,})
            end
        end
    end
})

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_abm({
    nodenames = {"camo:mob_turret"},
    interval = 1,
    chance = 1,
    action = function(pos, node)
    local objects = minetest.env:get_objects_inside_radius(pos, 20)
    if minetest.env:get_node({x=pos.x,y=pos.y-1,z=pos.z}).name ~= 'camo:turret_computer' then return end
        for _,obj in ipairs(objects) do
            if not obj:is_player() then
                local obj_p = obj:getpos()
                local calc = {x=obj_p.x - pos.x,y=obj_p.y+1 - pos.y,z=obj_p.z - pos.z}
                local bullet=minetest.env:add_entity({x=pos.x,y=pos.y,z=pos.z}, "camo:arrow_entity")
                bullet:setvelocity({x=calc.x * ARROW_VELOCITY,y=calc.y * ARROW_VELOCITY,z=calc.z * ARROW_VELOCITY})
                music_handle=minetest.sound_play("gun",
                {pos = pos, gain = 1.0, max_hear_distance = 25,})
            end
        end
    end
})


I want the first ABM to be slightly louder than the second.

PostPosted: Wed Jul 24, 2013 16:21
by Mossmanikin
Have you tested setting one gain value to a lower one? (like "gain = 0.7")
If this doesn't work I'd change one of the ogg sounds with ocenaudio, or whatever program you use to edit sound files.