Scripting training 7 Audio objects

Hello developers, I tried to create a new and cool tutorial for developers by practicing English and gathering information. I posted the video on YouTube, and the scripting and reading section is also here. You can give me your ideas so I can add them to this tutorial.

:one: AudioAnalyzer

Description: This tool is used to measure and analyze audio streams.
Features: It has one input and no output

local mic = Instance.new("AudioDeviceInput")
mic.InputDevice = Enum.AudioDevice.Microphone
mic:Start()

local part = workspace:WaitForChild("SoundPart") 

mic.OnInput:Connect(function(s)
    local loudness = s:GetLoudness()
    part.Size = Vector3.new(4, 4 + loudness * 10, 4)
    
    if loudness < 0.3 then
        part.BrickColor = BrickColor.new("Bright green")
    elseif loudness < 0.6 then
        part.BrickColor = BrickColor.new("Bright yellow")
    else
        part.BrickColor = BrickColor.new("Bright red")
    end
end)

:two: AudioChannelMixer

Description: This tool is used to combine multiple audio channels into a single channel.
Features: Allows adjusting the level of each channel individually

local mixer = Instance.new("AudioChannelMixer")
local music = Instance.new("Sound")
local effect = Instance.new("Sound")

music.SoundId = "rbxassetid://MUSIC_ID"
effect.SoundId = "rbxassetid://EFFECT_ID"

mixer:AddInput(music, 0.6)
mixer:AddInput(effect, 0.4)
mixer:Play()

:three: AudioChannelSplitter
Description: This tool is used to split a single audio channel into multiple channels.
Features: Allows sending audio signals to multiple destinations


local splitter = Instance.new("AudioChannelSplitter")
local explosion = Instance.new("Sound")
explosion.SoundId = "rbxassetid://EXPLOSION_ID"

splitter.Input = explosion
splitter:ConnectOutput(workspace.Position1)
splitter:ConnectOutput(workspace.Position2)
splitter:Play()

:four: AudioChorus

Description: This tool is used to add a chorus effect to audio signals.
Features: Creates a richer and more complex sound

local chorus = Instance.new("AudioChorus")
local guitar = Instance.new("Sound")
guitar.SoundId = "rbxassetid://GUITAR_ID"

chorus.Input = guitar
chorus.Depth = 0.7
chorus:Play()

:five: AudioDeviceInput

Description: This tool is used to receive audio input from hardware devices, such as a microphone.
Features: Allows recording sound from input devices.

local mic = Instance.new("AudioDeviceInput")
mic.InputDevice = Enum.AudioDevice.Microphone

local speaker = Instance.new("Sound")
speaker.Parent = workspace

mic.OnInput:Connect(function(sound)
    speaker.SoundId = sound.SoundId
    speaker:Play()
end)

mic:Start()

:six: AudioDistortion

Description: This tool is used to apply a distortion effect to audio signals.
Features: Produces a harsher and more energetic sound

local distortion = Instance.new("AudioDistortion")
local engine = Instance.new("Sound")
engine.SoundId = "rbxassetid://ENGINE_ID"

distortion.Input = engine
distortion.Level = 0.8
distortion:Play()

:seven: AudioPlayer

Description: This tool is used to play audio files in the game.
Features: Supports 2D or 3D sound playback.

local player = Instance.new("AudioPlayer")
player.SoundId = "rbxassetid://MUSIC_ID"
player.Volume = 1
player.PlaybackSpeed = 1
player:Play()

Please like the video if you enjoyed my tutorial and send it to your friends. I worked really hard on the video because English is not my native language.

7 Likes

We got headphone simulator, sound detection, and more realistic sounds on Roblox before GTA 6

2 Likes