Sound Visualisers

Learn to create your own audio visualiser

by JollyGameCrazy

Author Avatar

To create a sound visualiser you'll have to create a local script located in StarterGui and create fuction using the service "RunService".

game:GetService("RunService").RenderStepped:Connect(function()

end)

Within this function, you can define a local variable to inhibit the playback loudness.

    local loudness  =  workspace.Sound.PlaybackLoudness

After defining this variable, you can start adding equalities or if statements to make certain events occur.

Such as to change the size of an object:

local part = workspace.Part -- Part which will be visualised
local sizex = part.Size.X -- Unnecessary if using a fixed value for sizex
local sizez = part.Size.Z -- Unnecessary if using a fixed value for sizey
local positiony = part.Position.Y -- Unnecessary if using a fixed value for positiony
local positionx = part.Position.X -- Unnecessary if using a fixed value for positionx
local positionz = part.Position.Z -- Unnecessary if using a fixed value for positionz
local sound = workspace.Sound -- Referring the sound which will be visualised

game:GetService("RunService").RenderStepped:Connect(function()

    local loudness  =  sound.PlaybackLoudness -- Obtains the playback loudness of the sound
    local sizeincrement = loudness/60 -- The Number can be edited, depending on how you want it to behave.
    part.Size = Vector3.new(sizex, sizeincrement, sizez)
    part.Position = Vector3.new(positionx, positiony + (sizeincrement/2), positionz) -- Line unnecessary if you want the part to grow on both sides equally.
-- sizeincrement can be switched to any axis depending on how you want the part to grow (it should be on the same axis as the size line and position line to work dependently)

end)

This script will set the position of the object on the Y-axis to its original position plus half of the visualisation amount. The object won't grow on both sides equally, instead the position is moved upwards to compensate.

1* Note: The example given is for a when using a part. Since I don't work with GUIs, I couldn't script an example.

2* Note: You're not only limited to this format, you can use this for different things such as creating visual waves, beats, changing the color of an object, manipulating lighting or FOV, etc.

Have fun scripting!