beasty-visual-novel / production / audio-and-music.md

Audio and music

Sound comes in two layers: cues the story fires from a block, and a background music queue that follows the player from the main menu into the story and out into the world. This page covers both, and the mixer they run through.

The four channels

ChannelWhat it carries
MusicThe soundtrack: the background queue and any music cue from a block.
AmbientLooping atmosphere: rain, a crowd, a forest.
SfxOne-shots: a door, a hit, a UI click. Overlapping SFX do not cut each other off.
VoiceVoice lines. A new line stops the previous one.

Every channel routes through the shipped BeastyVNMixer AudioMixer, which has a group per channel under a Master group. The player’s volume sliders in the preferences screen drive the mixer’s exposed parameters, and a block’s own volume sets the source volume, so the two compose: a quiet cue stays quiet relative to whatever the player chose.

Each channel owns at least two physical AudioSources, which is what lets music and ambience crossfade instead of cutting.

Note If you leave a mixer group unassigned the manager still plays the sound; it just does not route that channel through the mixer, so the player’s slider for it does nothing. Use the shipped mixer unless you have a reason not to.

The audio blocks

These are the blocks you drop into a node. Full details in the blocks reference.

BlockWhat it does
MusicPlays a clip on the Music channel: clip, loop, volume, fade, and whether to pause the background queue.
AmbientPlays a clip on the Ambient channel: clip, loop, volume, fade.
VoicePlays a voice clip: clip, volume.
Sound effectA one-shot on the Sfx channel.
Stop channelStops Music, Ambient, Sfx or Voice, with a fade.

Music and Ambient crossfade: the new clip fades in as the old one fades out, over the block’s fade time. A fade of 0 swaps instantly.

Warning A block with no clip assigned does nothing — it is skipped, and whatever was playing keeps playing. To silence a channel on purpose, use Stop channel.

Background music per app mode

The persistent soundtrack is authored once, in a Music Config asset (Create > Beasty VN > Config > Music Config), and edited in the Music tab of the Beasty VN window. It holds one queue per top-level app mode:

QueuePlays while
mainMenuThe player is in the main menu.
visualNovelThe visual novel is running.
freeRoamThe player is walking around rooms.
customYour own Custom app mode is active (Custom mode).

Each queue has four fields:

FieldMeaning
clipsThe clips, in order. An empty queue means “no background music here”.
modeHow they are sequenced.
volumeThe queue’s own volume (0-1), composed with the player’s Music slider.
crossfadeSecondsThe crossfade when the queue starts, and between its tracks.

The play modes:

ModeBehaviour
SequentialLoopPlay the clips in order, then start again.
SingleInfinitePlay only the first clip, looping forever.
ShufflePlay in random order, reshuffling each cycle.
OncePlay the clips once in order, then stop.

The controller listens to the app mode and plays the matching queue. Re-entering a mode that is already playing its queue does not restart it — walking through a house whose rooms share the same music does not jump the track back to bar one.

Overrides: a room, or a story

Two things can replace the mode’s queue:

  • A room. A room prefab’s FreeRoamRoom carries a musicOverride queue. Enter that room and its music takes over; a room with no override plays the free-roam mode queue. See Free-roam rooms.
  • A story. A DialogueScene carries a musicOverride queue. Enter that visual novel and it takes over from the mode’s visualNovel queue.

An override with no clips is not an override: the mode queue applies.

Pausing the background for a scene’s own track

A Music block has a pause background flag, on by default. When the block fires, the persistent queue steps aside and the cue owns the Music channel for as long as the scene needs it. When the story moves on to a node that does not have a pausing cue, the background queue resumes on its own — you do not have to remember to restart it.

Turn the flag off when you want the cue to simply replace the music without the background layer ever coming back.

See also

  • Blocks reference — every block, including the audio ones, field by field.
  • Free-roam rooms — where a room’s music override lives.
  • UI prefabs — the mixer prefab and the preferences screen with the volume sliders.