local chr = owner.Character
local root = chr.HumanoidRootPart
script.Parent = chr
local sen = 40
local bars = {}
for i = 1, 44 do
local bar = Instance.new("Part")
bar.Material = "Neon"
bar.CanCollide = false
bar.CanQuery = false
bar.Anchored = true
bar.Parent = script
table.insert(bars, bar)
end
local remote = Instance.new("RemoteEvent")
remote.Name = "soundRemote"
remote.Parent = root
NLS([[local chr = owner.Character
local root = chr.HumanoidRootPart
local serverSound = root:FindFirstChild("visSound")
local visGui = root:FindFirstChild("visGui")
local remote = root:FindFirstChild("soundRemote")
local sound = Instance.new("AudioPlayer")
sound.Name = "vissong"
sound.AssetId = "rbxassetid://9043887091"
sound.Looping = true
sound.Parent = root
local soundAnalyze = Instance.new("AudioAnalyzer")
soundAnalyze.Parent = sound
local soundAnalyzeWire = Instance.new("Wire")
soundAnalyzeWire.SourceInstance = sound
soundAnalyzeWire.TargetInstance = soundAnalyze
soundAnalyzeWire.Parent = root
function blackman(fftTable)
local windowSize = #fftTable
local windowedData = {}
for i = 1, windowSize do
local a0 = 0.42659
local a1 = 0.49656
local a2 = 0.076849
local windowValue = a0 - a1 * math.cos((2 * math.pi * (i - 1)) / (windowSize - 1)) + a2 * math.cos((4 * math.pi * (i - 1)) / (windowSize - 1))
windowedData[i] = (fftTable[i] * windowValue) * 100
end
return windowedData
end
remote.OnClientEvent:Connect(function(...)
for i, p in pairs(...) do
sound[i] = p
if i == "AssetId" then
sound:Play()
end
end
end)
sound:Play()
serverSound.Changed:Connect(function(p)
if p == "SoundId" then
sound.AssetId = serverSound.SoundId
sound:Play()
elseif p == "PlaybackSpeed" then
sound.PlaybackSpeed = serverSound.PlaybackSpeed
end
end)
local freq = {}
local prevFreq = {}
game:GetService("RunService").PreRender:Connect(function()
local fft = blackman(soundAnalyze:GetSpectrum())
local prevSum = 0
local sum = 0
for i, v in pairs(prevFreq) do
prevSum = prevSum + v
sum = sum + fft[i]
end
if prevSum - sum < 0 then
freq = fft
end
prevFreq = fft
sound.TimePosition = serverSound.TimePosition
remote:FireServer(freq)
end)]], owner.Character)
local freq = {}
remote.OnServerEvent:Connect(function(plr, fft)
freq = fft
end)
local sound = Instance.new("Sound")
sound.Name = "visSound"
sound.SoundId = "rbxassetid://9043887091"
sound.Volume = 2
sound.Looped = true
sound.Parent = root
sound:Play()
owner.Chatted:Connect(function(msg)
if string.sub(msg,1,3) == '/e ' then
msg = msg:sub(4)
end
if msg:sub(1, 5) == "play " then
sound.SoundId = "rbxassetid://" .. msg:sub(6)
sound:Play()
elseif msg:sub(1, 4) == "vol " then
sound.Volume = msg:sub(5)
elseif msg:sub(1, 4) == "pit " then
sound.PlaybackSpeed = msg:sub(5)
elseif msg:sub(1, 4) == "sen " then
sen = msg:sub(5)
end
end)
game:GetService("RunService").PostSimulation:Connect(function(dt)
for i, v in ipairs(bars) do
v.Color = Color3.fromHSV(os.clock() / 10 % 1, 0.75, 1)
if freq[i] ~= nil then
v.Size = v.Size:Lerp(Vector3.new(4 / #bars, freq[i] * sen, 0.25), 0.3 * dt * 60)
end
v.CFrame = root.CFrame * CFrame.new(-i / (#bars / 8) + (#bars / 10) + math.cos(os.clock() * 1.5 + -i / math.pi) / 8, 3 + v.Size.Y / 2 + math.sin(os.clock() * 1.5 + -i / math.pi) / 8, 0)
end
end)