Volumetric Sound

I wanna make volumetric sound system. Basically shoot rays, reflect em N amount times and create new emitters, but for some reason it always going wrong :sob:

local COS = math.cos
local SIN = math.sin
local RAD = math.rad
local EXP = math.exp
local ABS = math.abs
local RANDOM = math.random

local SOUNDEMITTER_FOLDER = workspace:FindFirstChild("SoundEmitters") or Instance.new("Folder")
SOUNDEMITTER_FOLDER.Name = "SoundEmitters"

local function RandomCFrame()
	math.randomseed(os.clock())
	return CFrame.Angles(
		RAD(RANDOM(0,360)),
		RAD(RANDOM(0,360)),
		RAD(RANDOM(0,360))
	)
end

local function RandomCFrameInDirection(direction, range)
	direction = direction.unit
	local theta = RAD(RANDOM()*360)
	local phi = RAD((RANDOM()*range)-(range/2))

	local x = COS(theta)*COS(phi)
	local y = SIN(phi)
	local z = SIN(theta)*COS(phi)

	return CFrame.lookAt(direction, direction + Vector3.new(x,y,z), Vector3.new(0,1,0))
end
function SWS.PropogateSoundWaves(p)
	local SoundEmitter = p.sound or p.soundemitter or p.Sound or p.SoundEmitter
	local SoundEmitterLifeTime = p.soundlifetime or p.soundemitterlifetime or p.SoundLifetime or p.SoundEmitterLifetime
	local NumRays = p.rays or p.Rays or p.NumberOfRays or p.numberofrays
	local NumReflections = p.reflections or p.Reflections or p.NumberOfReflections or p.numberofreflections
	local Direction = p.direction or p.Direction or p.dir or p.Dir
	local Range = p.range or p.Range

Main problem: Instancing new Sound Emitters, calculating Volume and PlaybackSpeed
Baically sound occlusion with reverb and echo, using raycasts and material lookup table.

Nobody knows how your script works. Can you explain at least a little??

Well, variables of math is just micro-optimization, because it’s needs to run every frame, 8 rays, 4 reflections, cframe functions - just read name, random cframe and random cframe in direction, SWS.PropogateSoundWaves is just, does nothing for now

Why do you need your sounds to behave in this way?

Realism? 3D effect? Deep feeling? multiplie answers, but those is most… understandable

Maybe this link will help:

Yeah, i read that already, kinda gives me overall about algorithm, but things wont work whatever.