0% found this document useful (0 votes)
101 views4 pages

Zeros Visualizer

This script plays a looping sound from a Roblox asset and visualizes the sound levels by manipulating the scale of bars in a 3D model. As the sound gets louder, the bars grow taller, with the tallest bar indicating the maximum volume reached. It also changes the color of the bars and lighting to a disco-like pattern in sync with the sound.

Uploaded by

Still Hoppin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views4 pages

Zeros Visualizer

This script plays a looping sound from a Roblox asset and visualizes the sound levels by manipulating the scale of bars in a 3D model. As the sound gets louder, the bars grow taller, with the tallest bar indicating the maximum volume reached. It also changes the color of the bars and lighting to a disco-like pattern in sync with the sound.

Uploaded by

Still Hoppin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

local p = game.Players.

LocalPlayer
local c = p.Character
local t = c.Humanoid.Torso
local Sound = Instance.new("Sound")
Sound.Volume = 1
Sound.Looped = true
Sound.SoundId = "http://www.roblox.com/asset/?id=189178814"
Sound.MaxDistance = 1000
Sound.Parent = c.Head
Sound:Play()
function waituntilsong()
repeat wait() until Sound.IsLoaded == true
print'Waiting for low frequency'
repeat wait() until Sound.PlaybackLoudness < 500
repeat wait() until Sound.PlaybackLoudness > 50
print'Visualizing'
end
waituntilsong()
local SoundClon = Sound:clone()
local bars = {}
local Lighting = game.Lighting
--Lighting.FogStart = 20
--Lighting.FogEnd = 900
local shouldvol = 1
local pow = 25
local smooth = 0.3
local Color = Color3.new(0,73,185)
local function GetDiscoColor(hue)
local section = hue % 1 * 3
local secondary = 0.5 * math.pi * (section % 1)
if section < 1 then
return Color3.new(1, 1 - math.cos(secondary), 1 - math.sin(secon
dary))
elseif section < 2 then
return Color3.new(1 - math.sin(secondary), 1, 1 - math.cos(secon
dary))
else
return Color3.new(1 - math.cos(secondary), 1 - math.sin(secondar
y), 1)
end
end
local function ChangeColor()
local val = 1
while wait() do
Color = GetDiscoColor(val)
val = val + 0.005
end
end
coroutine.wrap(ChangeColor)()
local function NoOutline(x)
x.TopSurface = "SmoothNoOutlines"
x.BottomSurface = "SmoothNoOutlines"
x.RightSurface = "SmoothNoOutlines"
x.LeftSurface = "SmoothNoOutlines"
x.FrontSurface = "SmoothNoOutlines"
x.BackSurface = "SmoothNoOutlines"
end
local barm = Instance.new("Model", c)
barm.Name = "Bars"
numbars = 100
startcf = t.CFrame * CFrame.new(0,5,-5)
local cir = Instance.new("Part")
local r = 2.5
local xsize = (math.pi*r) / numbars
cir.Size = Vector3.new(0.4,2*r,2*r)
cir.Anchored = true
cir.CanCollide = false
cir.Shape = "Cylinder"
cir.Material = "Neon"
cir.Transparency = 0
cir.BrickColor = BrickColor.new("Really black")
cir.CFrame = startcf * CFrame.Angles(math.rad(90),math.rad(0),math.rad(0))
startcf = cir.CFrame
cir.Parent = c
mycf = cir.CFrame
local angleinc = 360/numbars
for i = 0, numbars do
local bar = Instance.new("Part")
bar.Material = "SmoothPlastic"
bar.BrickColor = BrickColor.new("Deep orange")
bar.Anchored = true
bar.Name = i
coroutine.wrap(NoOutline)(bar)
bar.CanCollide = false
bar.Size = Vector3.new(0.4,0.4,xsize)
bar.CFrame = cir.CFrame * CFrame.Angles(math.rad(angleinc*i),0,0) * CFra
me.new(0,0,r)
bar.Parent = barm
table.insert(bars, bar)
local mesh = Instance.new("SpecialMesh")
mesh.Name = "Smooth"
mesh.TextureId = 1
mesh.MeshId = "http://www.roblox.com/asset/?id=12221758"
mesh.Parent = bar
end
local function CheckSet(N,S,D)
local nS=barm[tostring(N)].Smooth.Scale.Z
if S > nS then
Set(N,nS+(S-nS)/2,D)
end
end
local nBars = #bars-1
local Height = 10
function Set(N,S,D)
if N < nBars+1 then
barm[tostring(N)].Smooth.Scale = barm[tostring(N)].Smooth.Scale:
lerp(Vector3.new(0.2, xsize, S), smooth)
if N > 0 and D ~= 1 then -- Checks left for smaller bars to mani
pulate
CheckSet(N-1,S,-1)
end
if N < nBars and D ~= -1 then -- Checks right...
CheckSet(N+1,S,1)
end
end
end
--barm[tostring(Barnr)].Smooth.Scale = barm[tostring(Barnr)].Smooth.Scale:lerp(V
ector3.new(xsize/2, Scale, 5/2), smooth)
local HighestLoud, Loud = 0
local down = 0.1
p.Chatted:connect(function(msg)
if msg:sub(1,3):lower() == "id " then
Sound.SoundId = "http://www.roblox.com/asset/?id="..msg:sub(4)
Sound:Stop()
wait()
HighestLoud = 1
changingsong = true
Sound:Play()
waituntilsong()
waituntilsong()
elseif msg:sub(1,4):lower() == "pow " then
pow = msg:sub(5)
elseif msg:sub(1,7):lower() == "smooth " then
smooth = msg:sub(8)
elseif msg:sub(1,4):lower() == "vol " then
Sound.Volume = msg:sub(5)
shouldvol = msg:sub(5)
elseif msg:sub(1,7):lower() == "height " then
Height = msg:sub(8)
elseif msg:sub(1,5):lower() == "down " then
down = msg:sub(6)
end
end)
local soundt = 0
local dot = 0
local odot = 0
local dot2 = 0
local odot2 = 0
local valtouse = 0
while game:GetService("RunService").RenderStepped:wait() do
local Loud = Sound.PlaybackLoudness
if Sound.IsLoaded == true and (Loud > 1 or Loud < 1000) then
dot = dot + 5
dot2 = dot2 + 2.5
p = cir.CFrame.p
soundt = Sound.TimePosition
if Sound.IsPlaying == false then
Sound:Play()
end
if Sound == nil then
local cop = SoundClon:clone()
cop.TimePosition = soundt
cop.Parent = c.Head
end
if Sound.Volume == 0 then
Sound.Volume = shouldvol
end
Sound.Volume = shouldvol
Sound.Pitch = 1
HighestLoud = math.max(Loud, HighestLoud) Loud = Loud/HighestLou
d
if Loud == Loud then
Set(math.floor(Loud * nBars), Loud * Height)
end
for _,v in pairs(bars) do
if v ~= nil then
v.Smooth.Scale = v.Smooth.Scale:lerp(Vector3.new
(0.2,xsize,0.4), down)
v.Smooth.VertexColor = Vector3.new(Color.r,Color
.g,Color.b)
v.CFrame = cir.CFrame * CFrame.Angles(math.rad(a
ngleinc*v.Name),0,0) * CFrame.new(0,0,r + v.Smooth.Scale.Z / 2)
end
end
end
end

You might also like