Jump to content

Recommended Posts

Posted

Ok, only mono sounds can be played using 3d spatialization. are there any examples for it, or is it automatic as long as the sound is mono format?

Posted

Ok I found this, but the documenation I think lies if i read it right.. loop=false doesn't let it keep playing. once the entity is released, the sound doesn't get a chance to play. It is killed with the entity.

 

self.entity:EmitSound(self.sound.glassbreak, 40, 1, 1, false)

Posted

Right, use a sound source if you don't want it associated with an entity.

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

I set up the source sound looking at the api, i know my audio is a mono (1 track), but when it plays, it doesn't sound like it's in the distance on the more distant ones. Am i missing something else? Thanks.

Start:

 

self.sound={}

self.sound.glassbreak=Sound:Load(self.glassbreak)

--Create a self.source

self.source = Source:Create()

self.source:SetSound(self.sound.glassbreak)

self.sound.glassbreak:Release()

self.source:SetLoopMode(false)

self.source:SetRange(60.0)

end

 

-- play this audio once when the glass breaks

 

self.source:SetPosition(self.entity:GetPosition())

self.source:Play()

self.entity:SetMass(0)

self.entity:SetCollisionType(0)

self.entity:Release()

Posted

Your sound is probably not mono. Take one of the provided samples, replace it with your sound, and make sure it works.

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

simple example that you can use to test your mono sound with:

window = Window:Create("Source",0,0,400,300,16)

context = Context:Create(window)

world = World:Create()

light = DirectionalLight:Create()

camera = Camera:Create()

 

box = Model:Box()

box:SetColor(1,.5,0,1)

box:SetPosition(0,0,5)

 

sound = Sound:Load("Sound/doors/fdn_door_automatic_servo_driven_close_short_05.wav")

source = Source:Create()

source:SetSound(sound)

sound:Release()

source:SetLoopMode(true)

source:SetRange(15)

source:Play()

 

toggle = 1

 

while window:KeyHit(Key.Escape)==false do

if window:Closed() then break end

 

box:Turn(.5,.5,0)

 

if box:GetPosition().z > 20 then

toggle = -1

elseif box:GetPosition().z < 3 then

toggle = 1

end

box:Translate(0,0,0.03*Time:GetSpeed()*toggle)

source:SetPosition(box:GetPosition())

 

Time:Update()

world:Update()

world:Render()

 

context:SetBlendMode(Blend.Alpha)

context:DrawText("Position: "..box:GetPosition():ToString(),0,2)

context:Sync(true)

end

 

It could be with the range being that high (60m) that its difficult for you to tell the difference in volume when you are 55m versus say 50m away? Whereas if the range was say only 25m, you could definitely tell the difference between 20m and 15m away. I am assuming that the volume is interpolated across the range. So moving 55m to 50m away (with 60m range) is only ~8.3% change in volume but moving 20m to 15m away (with 25m range) is a 20% change in volume. In both cases you only moved 5 meters, but had significantly different volume changes.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Posted

tried adding listener back, am using another mono sample. This is in the start function, but should it get moved to where the entity is instead of at 0,0,0 ?

 

Thanks.

 

--Create a listener

local listener = Listener:Create()

listener:SetPosition(0,0,0)

Posted

The listener should be positioned wherever the player/camera/entity that should hear the sound is located. If you position the listener at (0,0,0), then it will report sounds based on hearing from that location

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...