Here’s another example usage to show all the ways you can use this:
You can use it to keep your dialogue/subtitles from being super static and boring by just tossing some bars under the avatar!
Here’s another example usage to show all the ways you can use this:
You can use it to keep your dialogue/subtitles from being super static and boring by just tossing some bars under the avatar!
it doesnt work for me
You have to parent your Frame to the datamodel before you can link to sound. The error makes that pretty clear. You’re making it attempt to tween the bars but you haven’t put the bars anywhere tweenable.
This is an actual good audio visualizer that isn’t outdated or not working and the gui work is very smooth as well!
One thing is that maybe there should be a way to change it from a vertical to horizontal/bar type visualizer for people who want to use this as a music GUI as well?
Super easy to just change the anchor point and Y position of the bars in the module if that’s what you want. I don’t think I need to add usage complexity for things that take 2 seconds to change yourself.
Yet another mystifying creation from boat bomber. I don’t think roblox allow us to read sound data. I guess it’s time to check the code.
Thank you for your continuous contribution to roblox’s open source community <3
Bump, sorry.
I just came across this, but I’m having an issue. I created the GUI, that’s fine. I parented it to the Frame, which is ALSO fine.
Whenever I try linking the audio, it just tells me it’s a nil value, which is super vague and makes no sense at all.
local VisualBrains = require(script.Parent.Visualizer)
local Caleb = workspace.WorkspaceScripts:WaitForChild("MusicList").Audio1
local ActualVisualizer = VisualBrains.new(script.Parent, 80)
VisualBrains:LinkToSound(Caleb)
tried it on a caleb belkin song, all it does is throw that “attempt to call a nil value” line.
Cuz you did VisualBrains:Link
when you meant to do ActualVisualizer:Link
! You’re attempting to call a nil value since that function doesn’t exist there- it exists on the visualizer object.
Tysm! I didn’t even know that it worked that way, I guess I went over documentation a little too fast.
Now that we’re on the topic of playing, would it be possible to assign :LinkToSound() on multiple sounds at once so I can make it display the visualizer for multiple different Sound instances? If so would a if I, v in pairs loop work just fine? I also got the nil value error while doing that but I’m going to assume it was simply the error you have corrected here
*Worded this weirdly…
What I mean by show multiple different Sound instances, is when 1 is done playing, then the next completely separate sound then displays it’s link to sound
Just link the next sound when the first one finishes playing, you can swap between sounds by calling Link on the new one. Visualizers aren’t stuck with the first sound you link, you can hotswap them.
Please read the post, it shows all of this.
Oh sorry, I made it seem like I hadn’t read the post, I just wanted to know if it mattered if I made all link at once and it’d change accordingly to each song. This makes sense now, and I do have a proper way of doing this. Much appreciated.
I love it I hope to use it sometime.
Another issue I’ve encountered, is that it works in Studio, but not in the actual Roblox Game.
I have solutions I want to attempt, but if you could possibly tell me if there is something I need to do first for SurfaceGuis that’d be awesome, ty.
Edit
It appears my solutions for :WaitForChild()
and adding extra wait time didn’t do anything. The visualizer gets created, but doesn’t sync with the music even though I did link it with the sound.
I know this because it works in studio, but not the real Roblox Game.
Show your code please because there’s no way for anyone to debug your mistakes if we cant see them.
I will get that for you right now, and I will update this message when I got it ready. The codes long, so I will shorten it to represent what the rest of the script looks like
local VisualBrains = require(workspace.JukeVibe.Sign.SurfaceGui.SongFrame.Visualizer:WaitForChild("Visualizer"))
local ActualVisualizer = VisualBrains.new(workspace.JukeVibe.Sign.SurfaceGui.SongFrame.Visualizer, 25)
local SongBool = workspace.WorkspaceScripts:WaitForChild("MusicList")
while true do
wait(10) -- waits 10 seconds giving leisure time for songs to load
script.Parent.Audio1:Play() -- Play the song
ActualVisualizer:LinkToSound(SongBool.Audio1) -- Link to the song so it displays the Visualizer
game.workspace.JukeVibe.Sign.SurfaceGui.SongFrame.Song.Text = "Caleb Belkin - Life" -- This is to display text on a sign in game.
wait(script.Parent.Audio1.TimeLength) -- Waits the entire songs length until waiting 5 seconds next.
wait(5) -- Usually it will wait 5 extra seconds until playing the next song
end -- The code doesn't usually end here, I just shortened it because the code repeats with different things. Not the most idle code, but it's worked fine and I don't know any other way.
This code works in studio as stated, but not in the real game.
Please include a screenshot of your workspace because your code makes it extremely unclear. You index Audio1 in multiple different ways…
Are you using a LocalScript that’s parented somewhere inside workspace? That doesn’t work.
Also, that whole thing is just really poor practice and not the right way to do it. You’re essentially writing out an entire loop’s behavior by hand. Not to mention using wait()
instead of events.
local Visualizer = require(workspace.JukeVibe.Sign.SurfaceGui.SongFrame.Visualizer:WaitForChild("Visualizer"))
local SongVisualizer = Visualizer.new(workspace.JukeVibe.Sign.SurfaceGui.SongFrame.Visualizer, 25)
-- I assume SongBool is a folder of Sound objects?
local SongBool = workspace.WorkspaceScripts:WaitForChild("MusicList")
-- Make them automatically link to the visualizer when they play
for _,Song in ipairs(SongBool:GetChildren()) do
if not Song:IsA("Sound") then continue end
Song.Played:Connect(function()
SongVisualizer:LinkToSound(Song)
end)
end
-- Store the titles of each audio in a dictionary
local audioTitles = {
Audio1 = "Caleb Belkin - Life";
}
-- Continuously go through all the songs, playing them
wait(10) -- Load time
while true do
for _,Song in ipairs(SongBool:GetChildren()) do
if not Song:IsA("Sound") then continue end
game.workspace.JukeVibe.Sign.SurfaceGui.SongFrame.Song.Text = audioTitles[Song.Name]
Song:Play()
Song.Ended:Wait() -- Properly waits for the song to end instead of using wait()
wait(0.5) -- Time between songs
end
end
I keep all my sounds located right here:
I am NOT using any local scripts for this. I was hesitant at first, but I stuck with a Server Script because I felt like that was more practical (in this case it was)
Right here is where I have my frame setup including the module itself
These 2 screenshots are the only things I’m messing with (ik theres a lot of sounds.)
Oh also I appreciate the code fix up. At the time I didn’t know much about how to make a sound system and I made that before I was ever introduced to in pairs() ipairs() systems.
Your code works fine, but the visualizer still does not show according to the music even without my old and messy spaghetti code.
On top of that, it will skip 8 songs after the first song, and then play the play list like normal, which then completely breaks some songs after. My game has slow loading for players sometimes so could this be the cause? I’m lost, for realzies.