Roblox Audio Analyzer Is Really Great... — Transcript
Full transcript
- 0:00so Roblox has fixed the audio analyzer
- 0:02from the new audio API and this was an
- 0:04information brought to me in the
- 0:05comments by one of you guys so I'm going
- 0:07to make a video on it but as usual leave
- 0:09a like And subscribe to support the
- 0:10channel and let's get to it so the first
- 0:12thing I need to mention is that the
- 0:13audio API is still a beta feature and
- 0:16it's not recommended to use it in live
- 0:18games but to enable it you need to go
- 0:20into file then beta features and then
- 0:23scroll down to the new audio API right
- 0:25here then press on Save restart studio
- 0:27and you will be able to use the new
- 0:29audio API instances and now let just
- 0:31talk about setting everything up so
- 0:33unlike the normal sound instances for
- 0:35the audio API we need something called
- 0:37an audio player so I'm just actually
- 0:39going to insert a
- 0:41part and just make it enchor and I'm
- 0:44going to do this in a separate folder so
- 0:47this part is going to be the player part
- 0:50and I'm just going to make it green to
- 0:52separate it a little bit better because
- 0:54like I said to play a sound from the
- 0:55audio API we need to insert the audio
- 0:57player instance into the part and then
- 1:00we want to put it a song audio ID or
- 1:02whatever into the asset ID property and
- 1:06I'm just going to use this audio for the
- 1:09video this is a free sound that's
- 1:11uploaded by Roblox onto the platform so
- 1:13I'm just going to fiercely insert the
- 1:15instance and just copy the sound ID from
- 1:17right here then just paste it into the
- 1:20asset ID and then just remove the sound
- 1:23instance so now we have something that
- 1:25will play the audio but we also need
- 1:27something that will emit it into the
- 1:29word
- 1:30so I'm just going to duplicate this part
- 1:32and fly before adding an audio emitter
- 1:34I'm going to add an audio fader and this
- 1:37part is going to be named fader part and
- 1:40you don't have to set everything like I
- 1:41do in this video I'm just doing this for
- 1:43Simplicity but after we get the audio
- 1:46fader we also need an audio
- 1:48emitter so this is going to be the
- 1:50emitter
- 1:51part and it will use the audio emitter
- 1:55and really quickly I'm just going to
- 1:56make a folder and name IT wires
- 2:02because to connect the audio player to
- 2:04the audio fader then the audio fader to
- 2:06the audio emitter we need to use a wire
- 2:09for that where this wire is going to be
- 2:11the player into fader so we select the
- 2:15source instance to be the other player
- 2:19and the target instance to be the audio
- 2:22fader then add another wire this one is
- 2:25going to be the fader into emitter so
- 2:28just select the audio fader in to the
- 2:30audio
- 2:31emitter and now if you just add a script
- 2:33into the audio analyzer folder and
- 2:36change its run context to be on the
- 2:38client because this doesn't have to be
- 2:41done on the server I'm just going to
- 2:42make a line of code to the reference to
- 2:45the audio player and here I'm just going
- 2:47to do audio player and then the play
- 2:50Method as well as change the loop
- 2:52property to be on through so this is
- 2:55basically going to play our audio but we
- 2:58are not going to be able to hear it
- 3:00if I just do a play test and come close
- 3:02to this part there is going to be no
- 3:04audio track that we can actually hear
- 3:07and that's because we need some kind of
- 3:08a listener that we can create by adding
- 3:11a local script into the starter player
- 3:17scripts where this one is going to be
- 3:19called ad
- 3:21listener and all the script is going to
- 3:24do this is going to create an audio
- 3:26listener that's going to listen to any
- 3:28audio emitting from the word so local
- 3:31listener is equal to a new instance
- 3:33audio listener and I'm also going to
- 3:35make a reference to the camera because
- 3:37we're going to put the audio listener
- 3:39inside of the camera then you to change
- 3:41the listener. parent is equal to the
- 3:43camera and then we need to create an
- 3:45audio device output because this
- 3:47listener needs to stream the audio into
- 3:50our device so I do local audio device is
- 3:53equal to instance at new and then audio
- 3:55device output then we can set the parent
- 3:58to be the listener and then we just need
- 4:00to connect them Through the Wire where
- 4:03you need to set the source instance
- 4:05which is equal to the listener and then
- 4:07the wire Target instance that's going to
- 4:09be equal to the audio device output so
- 4:12now with this ad listener script if I do
- 4:15a play test we are able to actually hear
- 4:18the
- 4:23audio so now this is a basic setup for
- 4:26the audio API so now let's move to the
- 4:29audio analyz with the spectrogram right
- 4:31here and this time I'm going to
- 4:32duplicate the emitter part and just name
- 4:35this one analyzer part where I'm going
- 4:37to insert an audio analyzer which also
- 4:40needs to be connected with a wire from
- 4:42the audio fader so I need to add another
- 4:45wire this one is going to be the fader
- 4:48into the analyzer where the source is of
- 4:51course the audio fader and the target is
- 4:53the audio analyzer and now this part
- 4:56what it's going to do it's going to
- 4:58analyze the audio track but F I'm going
- 5:01to move into the documentation before I
- 5:03actually get into the scripting so the
- 5:05audio analyzer is going to have the peak
- 5:08level and the RMS level properties which
- 5:11are set to read only but these two these
- 5:14aren't really what we care about it's
- 5:16mostly the methods and the get Spectrum
- 5:19method to be exact and now what this
- 5:21method does it Returns the frequency
- 5:23spectrum of the last audio buffer as an
- 5:25array of numbers and the elements of the
- 5:27array are rootman square volume levels
- 5:30evenly space from 0 to 24,000 HZ and
- 5:33what this exactly means is that it's
- 5:35going to return a table where each
- 5:37element is a volume level that's inside
- 5:40of this range and how can you basically
- 5:43just translate that into scripting so
- 5:46you see I'm just going to duplicate the
- 5:48spectrogram and just move this one into
- 5:51the audio analyzer folder and now the
- 5:54number of parts in the spectrogram
- 5:55doesn't really matter what matters is
- 5:58going to be the orientation
- 6:00where you want to keep the same
- 6:01orientation for all of the parts on the
- 6:03spectogram and that's because when you
- 6:05change it size we basically just want
- 6:07them going like this instead of if let's
- 6:09say this one was rotated instead it
- 6:12would go like this and just to presented
- 6:15on the previous
- 6:17example I'm going to just comment this
- 6:19line so I don't hear the audio double
- 6:21from both of the examples at once so if
- 6:24I do a play test you can see the
- 6:26analyzer basically working correctly
- 6:28right but if I duplicate the number of
- 6:31these
- 6:32parts it's also going to work fine
- 6:35except it's going to have a wider
- 6:37variety of range so it's going to be a
- 6:39bit more accurate so I'm just going to
- 6:41uncommon this line and let's get into
- 6:44scripting so first you just want to get
- 6:46references to the audio analyzer and the
- 6:49spectrogram
- 6:50folder like this so here we get the
- 6:53spectogram and the audio analyzer and
- 6:55then we want to get a local function
- 6:57that's going to be called setup where
- 6:59this this function is going to be called
- 7:01on a local variable and that's because
- 7:03we want to return basically a table of
- 7:06all of these parts so each of the local
- 7:09Parts is equal to the spectogram get
- 7:11children but there is two things that we
- 7:12need to actually do with this one is
- 7:14that since this is a local script we
- 7:17need to wait for all of these to
- 7:18actually load on the client so we just
- 7:21do a repeat Loop until this spectogram
- 7:23get children is more or equal to the
- 7:26number of the children that we currently
- 7:28have in my case is 27 so I'm just going
- 7:32to do a Tas bit until everyone is loaded
- 7:35then we want to return the parts but
- 7:37first what we want to do is actually
- 7:38sort them by position since if this
- 7:40isn't sorted it's basically just going
- 7:42to make it so Random volume ranges are
- 7:45going to be assigned to random parts so
- 7:47we want to do table at sort and you can
- 7:50see that there is a com which is a
- 7:52comparison cbak so you want to sort the
- 7:55parts table and then give it a function
- 7:58where a is going to be the this index
- 8:00and B is going to be the next index that
- 8:03we want the function to compare and this
- 8:05one is going to basically just do a
- 8:07return on the red axis which is going to
- 8:09be the red one you can see from this box
- 8:11right here so you just want to do a.
- 8:15position X and I want to check if this
- 8:18one is more than b. position. X and now
- 8:22since I don't really have the time for
- 8:24this right now I'm going to get two
- 8:26functions from the audio API place and I
- 8:29will just explain them so now one
- 8:30function is going to be deler which is a
- 8:33linear interpolation and another one
- 8:36which is a main function in the script
- 8:38is going to be the get mapping beIN and
- 8:40now this one requires a ban count where
- 8:43this ban count is going to be the parts
- 8:44from the setup and then it says its own
- 8:47be variable which is the audio range
- 8:50returned by the get spec through method
- 8:52then it basically just checks if the
- 8:53Spectrum was empty and if so it's
- 8:56basically just going to return a table
- 8:57containing only zeros but then there is
- 9:00a result which does basically just a lot
- 9:03of math where it gets the power value
- 9:06the lower the upper and the fluctuate
- 9:08then says the result for the index and
- 9:11what all of this map is basically just
- 9:13used for this is for calculating the
- 9:15size from the Spectrum range to later
- 9:18translated into the parts and it's done
- 9:21in a y
- 9:23Loop where again we do local beans is
- 9:26equal to the get mapping beans from the
- 9:28length of of the parts and that's also
- 9:31why I said that the number of these
- 9:33parts right here doesn't really matter
- 9:35because this function is just going to
- 9:37space everything out separately then we
- 9:39need to do a for Loop to set every value
- 9:42from The Returned result to the
- 9:52parts where the current part is going to
- 9:56be the parts from index since for part
- 9:58one which is going to be this part based
- 10:00on the Sorting from right here is going
- 10:02to have the current size and then as set
- 10:05size from the result where in this case
- 10:08we only want to change the Y size so
- 10:10it's going to go like this so now we
- 10:13just want to clamp
- 10:14it and I'm just going to format this a
- 10:16little bit differently so you want to
- 10:18clamp this one from 10 times beans from
- 10:22index and we want to clamp it basically
- 10:25so it's not going to extend its Grand
- 10:27range or the size rather when this size
- 10:30is basically just set to 10 so we just
- 10:32want to go from zero if it's going to be
- 10:35completely silent and then the Z value
- 10:37is going to be the current size do Z and
- 10:40this should actually just be while TK
- 10:42quite do instead of the true so now if I
- 10:45just do a play test it's not going to
- 10:47work because I messed something up also
- 10:50in the meantime when I'm trying to
- 10:51figure out what's wrong do you guys know
- 10:52that I make ug items you can go check
- 10:54them out the link is going to be in the
- 10:55description but anyways oh it was
- 10:57supposed to be the current part not
- 10:59parts so now if I do a play test
- 11:02everything should work fine like this
- 11:04except it's going from the different
- 11:05direction so let me just fix that and it
- 11:07should work if I just reverse this right
- 11:09here and here it is so yeah I've got a
- 11:12working audio visualizer and let's see
- 11:14what happens if I just make this one
- 11:16like really long and this one is
- 11:18actually just going to be
- 11:19216 parts and yeah it's actually just
- 11:22going to visualize the audio still so
- 11:24yeah this is actually pretty cool
- 11:26technology but you may also ask about
- 11:28the performance right and since this is
- 11:31a lot of parts this script is currently
- 11:33running at well three almost 4% of
- 11:36activity so that's actually a little bit
- 11:39so what would happen if we actually made
- 11:41it wait let's say1 second and it's still
- 11:43going to visualize the audio but this
- 11:45time it's going to do it a little bit
- 11:47slower and it's going to be the same if
- 11:49I make it wait let's say 1 second but
- 11:52yeah that's for the audio analyzer
- 11:53instance and that's basically going to
- 11:55be it for today so go join my Roblox
- 11:57group and leave a like and subcribe to
- 11:58support the channel and yeah I hope you
- 12:00guys enjoyed the video and see you
About this transcript
This page contains the full transcript of Roblox Audio Analyzer Is Really Great... by Paul1Rb, generated from the public captions YouTube serves with the video. The transcript has 2,301 words across 305 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.