Audify - Lightweight Framework module for new Audio API

(yes this is a bit late but who cares)

Introducing Audify!

Audify is a lightweight framework for the new Audio API, which allows you to manage your audio easier. It is used to construct a Source-Middlewares-Output-structured AudioSystem which connects the audio source, middlewares (such as an AudioReverb), and the audio output (not necessarily added if no need).

Middlewares are arranged in a prioritized sequence and connected with wires (automatically!), which will affect the how the audio ultimately plays.

Download it

Benefits of Audify

  • Allows coexistence of AudioAnalyzers and other middlewares and Output device. :ok_button:
  • Simple and elegant. :broom:
  • Mostly strictly typechecked. :check_box_with_check:
  • Wires are created and connected automatically. :linked_paperclips:
Usage Examples

Basic Usage

local SoundPart = workspace:WaitForChild("SoundPart") -- Any part under workspace local Audify = require(path.to.Audify) local AudioSystem = Audify(SoundPart, "AudioPlayer", "AudioEmitter") local source = AudioSystem.Source :: AudioPlayer -- Get the created AudioPlayer (Source) source.Asset = "rbxassetid://1848354536" -- This will play "Relaxed Scene" from the toolbox. local output = AudioSystem.Output :: AudioEmitter -- Get the created AudioEmitter (Output) local modifier = system:AddMiddleware("AudioReverb", 1) :: AudioReverb -- Add an AudioReverb with priority set to 1 (middleware) modifier.WetLevel = 10 -- Modify its properties however you like. AudioSystem:Finalize() -- You must call this before playing the audio. Otherwise, it won't work as expected. source:Play() -- Play the audio -- ONLY DESTROY IT AFTER YOU DON'T NEED THE AUDIO ANYMORE! AudioSystem:Destroy() 

Integration with VC + AudioAnalyzer

--!! SERVER SCRIPT (credits to @int3rv4l for this code) function connectDevices(src, target)	local wire = Instance.new("Wire")	wire.Parent = target	wire.SourceInstance = src	wire.TargetInstance = target end game.Players.PlayerAdded:Connect(function(player)	local micIn = Instance.new("AudioDeviceInput")	micIn.Name = "MyVoiceInputDevice"	micIn.Parent = player	micIn.Player = player	micIn.Muted = false	player.CharacterAdded:Connect(function(character)	local emitter = Instance.new("AudioEmitter")	emitter.Parent = character	connectDevices(micIn, emitter)	end) end) 
--!! CLIENT SCRIPT local Players = game:GetService("Players") local player = Players.LocalPlayer local myMic = player:WaitForChild("MyVoiceInputDevice") local Audify = require(game.ReplicatedStorage:WaitForChild("Audify")) local AudioSystem = Audify(nil, myMic, "AudioEmitter") local analyzer = AudioSystem:AddMiddleware("AudioAnalyzer", 1) :: AudioAnalyzer analyzer.Parent = myMic task.spawn(function()	while task.wait(1) do	if analyzer.RmsLevel > 0.01 then	print("VOICE")	end	end end) AudioSystem:Finalize() 
Types in this module
type AudioSystem = {	AddMiddleware: (self: AudioSystem, AudioMiddleware) -> (AudioMiddlewareInst),	Finalize: (self: AudioSystem) -> (),	Destroy: (self: AudioSystem) -> (),	Source: AudioSourceInst,	Output: AudioOutputInst } type AudioSourceInst = AudioPlayer | AudioListener | AudioDeviceInput type AudioOutputInst = AudioEmitter | AudioDeviceOutput type AudioMiddlewareInst =	AudioFlanger |	AudioLimiter |	AudioTremolo |	AudioChorus |	AudioReverb |	AudioFilter |	AudioFader |	AudioGate |	AudioEcho |	AudioAnalyzer |	AudioEqualizer |	AudioCompressor |	AudioDistortion |	AudioPitchShifter |	AudioChannelMixer |	AudioChannelSplitter type AudioSource =	"AudioPlayer" | AudioPlayer |	"AudioListener" | AudioListener |	"AudioDeviceInput" | AudioDeviceInput type AudioMiddleware =	"AudioFlanger" | AudioFlanger |	"AudioLimiter" | AudioLimiter |	"AudioTremolo" | AudioTremolo |	"AudioChorus" | AudioChorus |	"AudioReverb" | AudioReverb |	"AudioFilter" | AudioFilter |	"AudioFader" | AudioFader |	"AudioGate" | AudioGate |	"AudioEcho" | AudioEcho |	"AudioAnalyzer" | AudioAnalyzer |	"AudioEqualizer" | AudioEqualizer |	"AudioCompressor" | AudioCompressor |	"AudioDistortion" | AudioDistortion |	"AudioPitchShifter" | AudioPitchShifter |	"AudioChannelMixer" | AudioChannelMixer |	"AudioChannelSplitter" | AudioChannelSplitter type AudioOutput =	"AudioEmitter" | AudioEmitter |	"AudioDeviceOutput" | AudioDeviceOutput 
API Documentation

NOTE: MAKE SURE YOU READ THE TYPES FIRST, OR YOU CAN GET EASILY OVERWHELMED!

Audify(source: AudioSource?, output: AudioOutput?): AudioSystem, AudioSourceInst?, AudioOutputInst? Registers an AudioSystem object with given parameters. AudioSystem.Source: AudioSourceInst -- The Source object of the AudioSystem. This is either AudioPlayer or AudioListener or -- AudioDeviceInput. AudioSystem.Output: AudioOutputInst -- The Output object of the AudioSystem. This is either AudioDeviceOutput or AudioEmitter. AudioSystem:AddMiddleWare(middleware: AudioMiddleware, priority: number?): AudioMiddlewareInst -- Adds a Middleware into the AudioSystem. The number of middlewares are not limited. If -- middleware is an AudioAnalyzer, it is thrown into a standalone list that will work -- along the original list of middlewares. AudioSystem:Finalize(): void -- Finalize the AudioSystem and connects all the components. No modifications to the -- structure is allowed once this has been called. AudioSystem:Destroy(): void -- Destroy the AudioSystem. Purging all objects and data and ending the audio instantly. 

Wait, before you leave..

Rate Audify! (1 = lowest, 5 = highest)
  • 1
  • 2
  • 3
  • 4
  • 5
0 voters
Will you use Audify?
  • Yes, this seems good!
  • No, I don’t think I need it yet.
  • No, this is bad to be used.
0 voters

Please leave suggestions and report bugs if there are any, happy coding!

yummy burgi in my tummy 67676767