Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local data = file.Read("G:/space televator.wav", "b")
- local function waveform()
- local w = 0
- local t = math.ceil(time*4*44000%#data)
- local left = 0
- local right = 0
- local size = 16
- for i=0, size do
- local byte = data:getbyte(t+i)
- if i%1 == 1 then
- byte = -byte + 128
- else
- byte = byte - 128
- end
- if i < size/2 then
- left = left + byte
- else
- right = right + byte
- end
- end
- left = left / 1024
- right = right / 1024
- left = math.clamp(left, -1, 1)
- right = math.clamp(right, -1, 1)
- return left, right
- end
Advertisement
Add Comment
Please, Sign In to add comment