Lesson 5 of 6

Audio: recording, editing, licensing, the audio graph

Make game audio for Roblox from zero, recording and editing in Audacity, uploading within the licensing and privacy rules, and wiring 2D and spatial sound with the new audio API.

Tool lesson, about 80 minutes, 12 steps

By the end you can

  • Record, trim, clean up and export a sound effect in Audacity in a format Roblox accepts
  • Explain who may use an uploaded sound, the upload limits, and what you may and may not upload
  • Play sound with the classic Sound object and with the AudioPlayer, Wire, AudioEmitter and AudioListener graph, and mix it with faders
  • Route players' voice chat through audio effects with the same graph

Before this: UI fundamentals: ScreenGui, UDim2, layouts, Client and server: who owns what

1Seven sounds, all borrowed

Play Beacon Yard with your sound on. A ping when you collect a coin, a snap when you swing the wrench, a fanfare when the drill starts. Every one of those is a file that ships inside Studio itself, named in Config.SOUNDS with an rbxasset:// path. None of them was recorded for this game.

Figure 1.1.

A coin pickup and a drill start in a playtest, with their sound cues.

Transcript
  1. 0:05 The coin plays electronicpingshort through SoundClient.
  2. 0:10 LampMotes emit upward at 8 particles a second.
  3. 0:16 Drill start plays the victory cue and shifts ClockTime to 18.4.
	SOUNDS = {
		coin = "rbxasset://sounds/electronicpingshort.wav",
		swing = "rbxasset://sounds/snap.wav",
		hit = "rbxasset://sounds/hit.wav",
		buy = "rbxasset://sounds/switch.wav",
		start = "rbxasset://sounds/victory.wav",
		hurt = "rbxasset://sounds/uuhhh.mp3",
		deny = "rbxasset://sounds/button.wav",
Figure 1.2

Built-in sounds are fine for a prototype, but they are the same ones every beginner's game uses. By the end of this lesson you will have recorded your own sound, uploaded it, and played it through the newer audio API.

Where do Beacon Yard's current coin and swing sounds come from?

  1. Files bundled with Studio, addressed with rbxasset:// paths in Config.SOUNDS
  2. Sounds uploaded by the course account
  3. The Creator Store, inserted with the Toolbox
  4. Generated at runtime with AudioTextToSpeech
Answer

Files bundled with Studio, addressed with rbxasset:// paths in Config.SOUNDS. rbxasset:// points at files that ship with Studio and the player. They need no upload and no id, which is why Config can list them directly.

Open this step in lesson mode · Link to this step · This confused me

2Who plays the sound?

SoundClient.luau listens to the Feedback remote. When the server sends coin, the client creates a Sound under SoundService, sets Volume = 0.7, plays it and destroys it when it ends. The server never creates the sound.

local function playFlat(soundIdValue: string, kind: FeedbackKind)
	local sound = Instance.new("Sound")
	sound.Name = kind
	sound.SoundId = soundIdValue
	sound.Volume = 0.7
	sound.Looped = false
	sound.Parent = SoundService
	sound.Ended:Once(function()
		sound:Destroy()
	end)
	sound:Play()
Figure 2.1

If the server played the coin ping, it would go out on the broadcast to every player, and everyone would hear your coin. The server sends one note to your client instead, and your client plays the ping on its own speakers.

Think of it as The live broadcast

Both sidesRemember: Replication is the live broadcast.

Player A picks up a coin. Who hears the ping?

  1. Only player A; Feedback goes to A and A's client plays the sound
  2. Everyone in the server
  3. Everyone within 12 studs
  4. Nobody; sounds under SoundService are silent
Answer

Only player A; Feedback goes to A and A's client plays the sound. CoinService calls Remotes.fireClient("Feedback", player, "coin", ...). Only that player's SoundClient receives it.

Open this step in lesson mode · Link to this step · This confused me

3Record and edit in Audacity

AudacityAudacityA free, open-source audio recorder and editor for Windows, macOS and Linux.Think of it as a pencil and eraser for sound. is a free, open-source audio editor for Windows, macOS and Linux1. Install it from audacityteam.org. A phone voice-memo app is enough to record; transfer the file to your computer, or plug in a USB microphone and record straight into Audacity.

Record the sound of a metal spoon striking a pan, a few times, in a quiet room. Then edit in four moves:

  1. Trim. Select the silence before and after the best hit and delete it. Leave about 20 milliseconds before the hit, so it does not click.
  2. Fade. Select the last tenth of a second and apply Effect → Fading → Fade Out.
  3. Clean. Select a stretch of pure background hiss, choose Effect → Noise Removal and Repair → Noise Reduction → Get Noise Profile, then select everything and apply it gently.
  4. Normalize. Effect → Volume and Compression → Normalize to a peak of -1 dB, so every sound you make starts at the same level2.

Export with File → Export Audio as mono WAV or OGG. A sound effect does not need stereo, and a mono file is half the size.

Put the edits in a sensible order.

  1. Export as a mono WAV or OGG
  2. Reduce the background noise
  3. Fade out the tail
  4. Normalize the peak to -1 dB
  5. Trim the silence around the best take
Answer

1. Trim the silence around the best take 2. Fade out the tail 3. Reduce the background noise 4. Normalize the peak to -1 dB 5. Export as a mono WAV or OGG. Cut first so you only process what you keep, clean before you normalize, and export last. Normalizing earlier would raise the noise along with the sound.

Open this step in lesson mode · Link to this step · This confused me

4Formats, limits and licences

Roblox imports audio that is a single track in MP3, OGG, WAV or FLAC, under 20 MB and 7 minutes, at a sample rate of 48 kHz or less, in mono, stereo, 3.0 or 5.1. You may import 100 audio files per 30 days, or 2,000 if your account is ID verified3.

You must hold the rights to everything you upload3. Your own recordings are yours. A file from a free sound site is yours to use only under its licence, so keep a note of where each file came from. Commercial songs are not allowed unless you hold the rights. The Creator Store has more than 100,000 licensed effects and music tracks you can use in your games for free.

Who can use an upload is separate. A new audio asset is private: at first only you can use it, and you grant other creators or specific experiences permission from the asset's Permissions page3. The Asset Privacy setting for images and meshes does not change audio, which has its own defaults4.

Go deeper Why mono, and why 48 kHz?

Roblox accepts mono, stereo, 3.0 and 5.1 channel layouts and a sample rate of 48 kHz or less. A sound effect has a single source, so mono carries everything it needs at half the size of stereo. Anything above 48 kHz is rejected at import, so export at 48 or 44.1 kHz.

Which of these may you upload to Roblox and use in Beacon Yard?

  1. A wrench clank you recorded yourself
  2. A CC0 sound from a free library, with its source noted
  3. A chart song ripped from a streaming site
  4. A 9-minute ambient loop you composed
  5. A 48 kHz stereo WAV of your own drone hum, 3 MB
Answer

A wrench clank you recorded yourself; A CC0 sound from a free library, with its source noted; A 48 kHz stereo WAV of your own drone hum, 3 MB. Your own work and properly licensed CC0 audio are fine. A ripped song breaks the rights rule, and a 9-minute file is over the 7-minute limit even though you own it.

Open this step in lesson mode · Link to this step · This confused me

5Two ways to play a sound

The classic way is one object: a Sound, with a SoundId, a Volume and Play(). Parent it to a part and it comes from that point in the world; parent it to SoundService and it plays flat, as Beacon Yard does. Roblox's docs now call Sound a legacy object5.

The newer way is an audio graph6. Each job is a separate object, joined by Wire instances that carry the sound from one to the next:

  • AudioPlayer loads and plays an asset.
  • AudioEmitter is a virtual speaker placed in the world.
  • AudioListener is a virtual microphone, usually on the camera or the character.
  • AudioDeviceOutput is the player's real speakers or headphones.
  • Effects such as AudioEqualizer, AudioReverb and AudioFader sit in between.

For a flat sound, wire AudioPlayer → AudioDeviceOutput. For a sound in the world, wire AudioPlayer → AudioEmitter, and set SoundService.DefaultListenerLocation to Enum.ListenerLocation.Camera or Enum.ListenerLocation.Character (shown in Studio's Properties panel as ListenerLocation / DefaultListenerLocation) so the engine creates the listener and the output for you.

Luau
-- A model of the audio graph: each wire joins a source to a target.
local wires = {
	{ "DroneHum (AudioPlayer)", "DroneSpeaker (AudioEmitter)" },
	{ "CameraMic (AudioListener)", "Speakers (AudioDeviceOutput)" },
}
for i, w in wires do
	print(i .. ": " .. w[1] .. " -> " .. w[2])
end
-- The emitter and the listener are joined by space, not by a wire.
print("emitter to listener: distance in the world")
Figure 5.1. Expected output: 1: DroneHum (AudioPlayer) -> DroneSpeaker (AudioEmitter) 2: CameraMic (AudioListener) -> Speakers (AudioDeviceOutput) emitter to listener: distance in the world

Match each audio object to its job.

  1. AudioPlayer
  2. AudioEmitter
  3. AudioListener
  4. Wire
Answer

AudioPlayer: Loads and plays the uploaded asset; AudioEmitter: A virtual speaker at a place in the world; AudioListener: A virtual microphone that hears emitters; Wire: Carries the stream from a source to a target. The graph splits one Sound's jobs into parts you can rearrange, which is how one sound can feed an effect chain, two emitters or a radio.

Open this step in lesson mode · Link to this step · This confused me

6Spatial sound and the mix

A sound in the world is spatial: it gets quieter with distance and comes from the left or right. Put an AudioEmitter on the drone and its hum tells the player where the drone is without looking. The emitter's DistanceAttenuation curve sets how fast it fades6. Voice chat uses the same emitters and listeners.

The mix is how loud each group of sounds is compared to the rest. With classic sounds you assign each Sound to a SoundGroup and change the group's volume. The docs now discourage SoundGroups in favour of the audio objects7. Beacon Yard itself takes the classic route at m07-feel: every cue goes through one SoundGroup named Effects, with Config.SFX_VOLUME at 0.7, and each play nudges the pitch by up to 8 percent (SFX_PITCH_SPREAD) so ten coins in a row do not sound like a loop. In the graph, a mix bus is an AudioFader: wire every effect's player into one fader, every music player into another, and both faders to the output. A settings slider then changes one Volume.

The UI lesson's challenge toggles a MusicMuted attribute on the player. With the audio graph, what is the simplest way to apply it?

  1. Set the music AudioFader's Volume to 0 on that player's client
  2. Delete the music asset from Roblox
  3. Stop the music on the server for everyone
  4. Unplug the AudioListener
Answer

Set the music AudioFader's Volume to 0 on that player's client. One fader per group means one property to change. Doing it on the client affects only that player, which is what a personal setting should do.

Open this step in lesson mode · Link to this step · This confused me

7Where the broadcast breaks

Where does it break?“The live broadcast” is a good picture of replication. Where does it stop being true?

It breaks here. Only property changes in some containers are sent, and nothing a client changes ever travels back up to the server.

The true model. The server copies changes in replicated containers, such as Workspace and ReplicatedStorage, down to clients. A client's own changes stay on that client unless it asks the server through a remote.

Sound breaks the broadcast picture twice. First, a client can play any sound it likes and only that client hears it, because changes never travel back up to the server. Beacon Yard's project sets SoundService.RespectFilteringEnabled = true, which keeps it that way for sounds too. Second, a sound the server plays is not a frame-perfect copy on every screen: each client starts it when the change arrives, a little late and at a slightly different moment.

With RespectFilteringEnabled on, a LocalScript plays a loud siren in Workspace. Who hears it?

  1. Only the player whose client ran the LocalScript
  2. Everyone near the siren
  3. Everyone in the server
  4. Nobody; clients cannot play sounds
Answer

Only the player whose client ran the LocalScript. Client changes, including playing a sound, stay on that client. To make everyone hear something, the server has to play it or tell every client to.

Open this step in lesson mode · Link to this step · This confused me

8The tools pros use

Other ways pros do this

OptionWhat it isWhen pros pick itTrade-offs
AudacityFree, open-source recorder and editor.Trimming, cleaning and normalizing effects; the default for this course.Destructive editing by default and a basic mixer; not built for composing music.
REAPERA full digital audio workstation with a 60-day evaluation and a $60 discounted licence.Serious sound design and mixing on a budget; many game audio freelancers use it.Dense interface; you configure a lot yourself.
Ableton LiveA commercial DAW known for music production, with a 30-day free trial.Composing music and loops for your game.Paid licence, and more than you need for a coin ping.
jsfxr or BFXRFree browser generators of retro sound effects from sliders and presets.Jam games, placeholders and chiptune-style pickups and lasers.A recognisable 8-bit sound that rarely fits a realistic game.
Creator Store audioOver 100,000 licensed effects and music tracks, free to use in Roblox games.Music and common effects when you have no composer.Other games use the same tracks; you cannot take them off Roblox.

Why do studios keep a list of every sound's source and licence?

  1. To prove the rights if an upload is challenged, and to know what can be reused elsewhere
  2. Because Roblox requires a list with every upload
  3. To make the files smaller
  4. So the audio loads faster
Answer

To prove the rights if an upload is challenged, and to know what can be reused elsewhere. The uploader must have the rights. A list answers a takedown quickly and tells the team which sounds they own outright.

Open this step in lesson mode · Link to this step · This confused me

9Build along: your own drone hum

Build along

m06-drone-wrench

  • src/shared/Ids.luau
  1. Record a low hum (a fan, a fridge, or your own voice), trim it to two seconds in Audacity, fade both ends very slightly, normalize to -1 dB and export as mono WAV.

    You should see A mono WAV under 1 MB that loops without a click when you play it with looping on.

  2. In Studio, open the Asset Manager, choose Import, and pick your file. When moderation finishes, right-click it and copy the asset id.

    You should see The Asset Manager shows the audio with a green check, and you can copy its id.

  3. In a test Baseplate, insert a part. Inside it add an AudioPlayer (set Asset to a content URI built from your id (the rbxassetid scheme, a colon, two slashes, then the number), Looping on, AutoPlay on), an AudioEmitter, and a Wire with SourceInstance the player and TargetInstance the emitter. Set SoundService.DefaultListenerLocation to Character (in script: Enum.ListenerLocation.Character) and press Play.

    You should see In a new Baseplate, the hum gets louder as you walk to the part and quieter as you leave.

  4. In the game repo, add DRONE_HUM_ID = 0 to Ids.luau with a comment, copy Ids.local.example.luau to Ids.local.luau if you have not (at m06-drone-wrench only the example file exists, and the first-publish lesson shows the copy), and put your real id in Ids.local.luau, which Git ignores.

    You should see Ids.luau has a DRONE_HUM_ID entry defaulting to 0, and your id lives only in Ids.local.luau.

Open this step in lesson mode · Link to this step · This confused me

10Voice through the same graph

Voice chat runs on the same audio objects when VoiceChatService.UseAudioApi is Enabled. With EnableDefaultVoice on, Roblox builds a default setup for every voice-eligible player: an AudioDeviceInput (their real microphone) under the Player, an AudioEmitter under their character, and an AudioListener under the camera. That is proximity voice: you hear a player from where their character stands8. Voice is for users 13 and over who pass an age or ID check and turn it on, so plan your tests with eligible accounts.

Because the microphone is an object, you can wire it through effects9. A crew radio for Beacon Yard: each player's microphone also runs through a band-pass AudioFilter and a little AudioDistortion into one AudioFader, and from there to an AudioDeviceOutput every client plays. Teammates then hear each other across the yard with a walkie-talkie sound, and still hear each other normally up close.

luau
-- src/server/CrewRadio.luau
local Players = game:GetService("Players")
 
local CrewRadio = {}
 
local function wire(source: Instance, target: Instance)
	local link = Instance.new("Wire")
	link.Name = "CrewRadioWire"
	link.SourceInstance = source
	link.TargetInstance = target
	link.Parent = source
end
 
function CrewRadio.start()
	local bus = Instance.new("AudioFader")
	bus.Name = "CrewRadio"
	bus.Parent = workspace
	local speakers = Instance.new("AudioDeviceOutput")
	speakers.Parent = workspace
	wire(bus, speakers)
 
	local function onDevice(device: AudioDeviceInput)
		local band = Instance.new("AudioFilter")
		band.FilterType = Enum.AudioFilterType.Bandpass
		band.Frequency = 1500
		band.Parent = device
		local crunch = Instance.new("AudioDistortion")
		crunch.Level = 0.3
		crunch.Parent = device
		wire(device, band)
		wire(band, crunch)
		wire(crunch, bus)
	end
 
	local function onPlayer(player: Player)
		player.ChildAdded:Connect(function(child)
			if child:IsA("AudioDeviceInput") then
				onDevice(child)
			end
		end)
		local device = player:FindFirstChildWhichIsA("AudioDeviceInput")
		if device then
			onDevice(device)
		end
	end
	Players.PlayerAdded:Connect(onPlayer)
	for _, player in Players:GetPlayers() do
		onPlayer(player)
	end
end
 
return CrewRadio

Every client plays that output, your own included, so you would hear yourself on the radio. The voice guide's fix is a LocalScript that deletes, on your own client only, the wires under your own Player. Here it deletes only the ones named CrewRadioWire.

Build along

m14-ship

  • src/server/CrewRadio.luau
  • src/server/init.server.luau
  • src/client/init.client.luau
  1. Select VoiceChatService in Explorer and check both properties. They may already be set for you.

    You should see VoiceChatService shows UseAudioApi Enabled and EnableDefaultVoice ticked in the Properties window.

  2. Add CrewRadio.luau, require it in init.server.luau and call CrewRadio.start(). In init.client.luau, destroy every Wire named CrewRadioWire under Players.LocalPlayer, now and on DescendantAdded.

    You should see In Play, Workspace holds a CrewRadio AudioFader and an AudioDeviceOutput, and the Output shows no errors from CrewRadio.

  3. Publish to your test place, join with two voice-eligible accounts, walk to opposite ends of the yard and talk.

    You should see Two voice-enabled accounts in the published test place hear each other across the yard with a thin, crackly radio sound, and neither hears their own voice back.

After the players-teams-chat challenge, the yard can have a Spectators team. Which setting stops spectators hearing a Driller's microphone?

  1. AudioDeviceInput.AccessType set to Allow, with SetUserIdAccessList listing the Drillers
  2. A lower Volume on the CrewRadio AudioFader
  3. A shorter DistanceAttenuation on the Driller's AudioEmitter
  4. EnableDefaultVoice turned off on VoiceChatService
Answer

AudioDeviceInput.AccessType set to Allow, with SetUserIdAccessList listing the Drillers. AccessType and SetUserIdAccessList on the AudioDeviceInput limit the microphone's audience. The voice guide's team chat sample does exactly this, updating the list when teams change.

Open this step in lesson mode · Link to this step · This confused me

11Challenges

Level 1, Apprentice

Challenge

Replace the coin ping with your own sound without putting an id in a committed file.

Start from
The game at milestone m06 (download)

Done means

  • A coin sound you recorded or generated replaces electronicpingshort
  • The upload is under 20 MB, mono, and you hold the rights
  • Its id is in Ids.local.luau, not in Config or Git

Hints

  1. jsfxr's Pickup/coin preset is a quick start.
  2. Config.SOUNDS can stay as the fallback when your id is 0.
  3. Build the content string the way Ids.asset does.

An account that is not ID verified uploaded 64 sounds in the last 30 days. How many more can it upload in that window?

Answer

36. 100 minus 64 leaves 36. ID verification raises the limit to 2,000.

Level 2, Builder

Challenge

Give the drone a spatial hum built with the audio graph.

Start from
The game at milestone m06 (download)

Done means

  • The drone carries a looping hum through an AudioEmitter
  • The hum fades with distance and stops when the drone is defeated
  • At DRONE_HUM_ID 0 the drone is silent and one [Ids] warning prints

Hints

  1. The drone exists only in Play, so create the audio objects where DroneService builds it.
  2. Stop the AudioPlayer when the drone's health reaches 0.
  3. Follow the pattern of the other features that switch off at 0.

Level 3, Professional

Challenge

Plan the mix before you build it: start from the m14-ship tag in the game repo to get challenges/work/audio_mix.luau and challenges/audio.luau, then write the bus rules in challenges/work/audio_mix.luau. The written solution is challenges/solutions/audio.md.

Start from
The game at milestone m14 (download)
Grade it
In Studio, press Play, then run game.ServerScriptService.RunGameTests:Invoke("audio", "audio-mix-buses") in the server command bar. Copy the pass code from Output.

Done means

  • challenges/work/audio_mix.luau exports bus(kind) and cueVolume(cue, busName, mix, master)
  • bus sorts buy, deny, toast and announce into "ui", and gameplay or unknown kinds into "sfx"
  • cueVolume multiplies the cue's own volume by its bus (defaulting to 1 if missing) and the master volume, and clamps the result between 0 and 1
  • challenges/audio.luau prints TEST PASS for every check

Hints

  1. buy, deny, toast and announce are interface sounds.
  2. Unknown kinds go to sfx.
  3. A missing volume in the mix table means 1.

Open this step in lesson mode · Link to this step · This confused me

12Recap

Recap

  1. Beacon Yard's cues are built-in rbxasset files played by SoundClient on the one client that the server's Feedback names.
  2. Record, trim, fade, clean and normalize in Audacity; upload MP3, OGG, WAV or FLAC under 20 MB and 7 minutes that you have the rights to.
  3. The audio graph wires AudioPlayer to AudioEmitter or the output; AudioFader buses replace SoundGroups for the mix.
  4. Voice uses the same graph: each eligible player's AudioDeviceInput can be wired through effects, and its access list decides who hears it.

Replication is the live broadcast, until only property changes in some containers are sent, and nothing a client changes ever travels back up to the server.

Next VFX: particles, beams, trails, lighting effects

Open this step in lesson mode · Link to this step · This confused me