Tutorials · Sound and Music · Chapter 8
The bell
By the end
- A bell in its chamber that E rings while the knight stands by it, one toll at a time, by Max Voices
- A Ducking row: while Sfx is over
-18.4dB, Music comes down9dB, on over about a fifth of a second and back over a few - Why every other sound on Sfx sits under the duck’s Threshold
- A Sends row from Music to Sfx, and each snapshot’s Send Amounts: the music rings in the cave, and nowhere else
On this page
A bell to ring
In the bell chamber, south of the flooded passage, hangs a bell. Its sound came with the starter: bell.wav, a bronze bell struck once, a low A that rings on for two or three seconds and dies away over six.
- In Assets, click
bell.wavinaudio, set its Stream to Never in Details, and press Save. At six seconds Auto would stream it; a sound struck on a key is held whole, so each strike starts at once. - Select
bell, inbell_chamber. Press Add component and choose AreaComponent. In its Shape, set Size to48,48: the floor round the bell. Leave its Layer and Mask as they come. - Press Add component and choose AudioSourceComponent. Leave Clip empty, Bus on Sfx, Volume at
1, Positional ticked, Max Distance at512and Rolloff on Quadratic, as they come. Set Min Distance to48and Max Voices to1. - Add a trigger
toll, its Clipbell.wav. - In Assets, click Assets in the path bar, so the script is written at the project’s top, then click Create, choose New script, type
belland press Enter. In the Code tab, replace everything inbell.rgswith the script below, and press Ctrl+S. - Select
bell, press Add component and choose Bell. Press Ctrl+S.
/// The bell in its chamber. The knight rings it standing by it, as often as
/// he likes: each toll rings on for several seconds, and the music dips under
/// it while the ring is loud.
component Bell : Area {
/// How many knights stand by it.
#[readonly]
near: i32 = 0,
fn on_enter(other: NodeId) {
if in_group(other, "knight") {
near += 1;
}
}
fn on_exit(other: NodeId) {
if in_group(other, "knight") {
near -= 1;
}
}
fn loop() {
// E, which the input map calls action, pressed while he stands by it.
if near > 0 && pressed("action") {
play_sound("toll");
}
}
}
48, Max Voices 1, and toll.
near counts the knights inside the bell’s Area: on_enter adds one, on_exit takes one away. #[readonly] shows it in the Inspector, as Near, and keeps it out of your hands: the game writes it. E is action, the key chapter 4 gave the lever: the bell and the lever each listen for it only while he stands by them.
The music dips under it
The bell is a moment the game wants heard. A Ducking row holds one bus down while another is loud: here Music under Sfx. While the bell rings loud, the music steps aside; as the ring dies, it comes back.
- Select
mix. Press + beside Ducking: a row,1, readingSfx>Musicas a row comes, its Trigger Sfx and its Target Music. Open it. - Set Threshold to
-18.4, Amount to9, and Release to1. Leave Attack at0.05. - Press Ctrl+S.
- The Audio Mix’s Ducking
- Rules that hold one bus down while another is loud, a row each. The Inspector reads each by its place and its two buses,
1andSfx>Music, the bus that listens first. - A duck’s Trigger
- The bus it listens to: here Sfx, the whole bus, after its chain. It hears the bus, not the bell: anything on Sfx loud enough would duck the music too. Not Master, the sum of everything it would duck: a row whose Trigger is Master is dropped, and the Problems tab says so.
- A duck’s Target
- The bus it holds down: here Music. A bus cannot be both: a row whose Target is its Trigger is dropped, and the Problems tab says so, as below.
- A duck’s Threshold
- How loud the Trigger must be for the duck to come on, in decibels under full scale, from
-96to0. The bell’s ring reads over-18.4on the Sfx meter for its first three seconds and more; nothing else in the crypt reaches it. - A duck’s Amount
- How many decibels come off the Target while the Trigger is over its Threshold:
9, which leaves the music at a little over a third of its level. From0to96. - A duck’s Attack
- How quickly the duck comes on once the Trigger goes over, in seconds. It is a time constant, not a ramp: at
0.05, the duck is most of the way on in a twentieth of a second and all but fully on in about a fifth. - A duck’s Release
- How quickly it lets go once the Trigger falls back under, in seconds, a time constant too: at
1, the music is most of the way back in a second and all but back in about four, so it rises with the ring as it dies rather than jumping back.
Press F5, walk down through the passage’s south door into the bell chamber, stand by the bell and press E.
What it sounds like
Calm music alone; a deep bell is struck and rings, and the music sinks under it; the ring slowly fades over about six seconds, and the music swells back to where it was.
2.5 s, with nothing rung: Music at -29.0 dB, Sfx silent.
-16.0 dB, and Music 8.9 dB down.The two pictures are the same moment of two runs, alike but for E: the music is the same music, and the duck has it 8.9 dB under. Over the whole toll the music is down by about the Amount from a fifth of a second after the strike until the ring falls under the Threshold, and within a decibel of where it was some four seconds after that.
Everything else, under it
The duck hears the whole Sfx bus, after its Compressor. Every loud one-shot there sits near the Compressor’s -15 dB, so a Threshold of -18.4 would be crossed by any of them that came close. That is why Part 1 set them as low as it did: the doors at 0.5, the bridge at 0.4, the gate’s grind and thud at 0.3, the lever at 0.25, and the music box at 0.3. Walking the whole crypt, his steps, the torches, the doors, the bridge, the gate and the waterfall never move the duck: the bell is the one thing on Sfx loud enough to dip the music.
The music in the cave
The cave’s Reverb is on Sfx, so it rings what is in the room and not the music. A Sends row feeds some of one bus into another’s chain: some of the music through Sfx’s, so that in the cave it passes the Reverb and the room answers it too. It is fed at nothing, and each snapshot says how much.
- Select
mix. Press + beside Sends: a row,1. Open it, and set From to Music and To to Sfx. Leave its Amount at0. - Open the snapshot
cave, and press + beside its Send Amounts: an amount for the row, readingMusic>Sfx, at the row’s own0. Set it to0.5. - In
passageand inwell, press + beside Send Amounts and leave each at0. - Press Ctrl+S.
0, and the cave’s Send Amounts, 0.5.- The Audio Mix’s Sends
- Rows that feed some of one bus into another, a row each. A sent copy is heard where it ends, on Master, and not on the bus it is fed through: the Sfx meter, which the duck listens to, never hears the music, so the music cannot duck itself.
- A send’s From
- The bus that is tapped, after its own chain and fader: here Music.
- A send’s To
- The bus whose chain the copy is fed through, and then its volume: here Sfx, for its Reverb. So the music’s ring in the cave follows the options’ Sfx slider as well as the Music one.
- A send’s Amount
- How much of the bus is sent, from
0to1: the row’s own, used wherever a snapshot says nothing. Here0: no snapshot but the cave’s sends anything. - A snapshot’s Send Amounts
- How much each of the mix’s Sends carries in this snapshot, an amount for each row by its place, read with the row’s two buses,
Music>Sfx. A list shorter than the Sends leaves the rest at their own Amount. The cave’s0.5; the passage’s and the well’s0, the row’s own, written out so the Inspector shows them.
Stand in the cave’s east side, and listen.
What it sounds like
The calm music-box melody over its soft pad, with a faint hall-like wash behind it, and the waterfall’s distant roar.
What it sounds like
The same calm music, a little quieter and plainer, and the same distant roar.
The send’s copy of the music is about half dry, the Reverb’s Mix, and half the room’s ring of it. So in the cave the music is a little under 2 dB louder than without the send, and the ring under it is some 16 dB under the music: heard, and never in the way. Below the cave’s door, in no zone, the send carries nothing, and the music is as it was.
Who decides what you hear
The bell and the send
| Node | Component | Field | Value |
|---|---|---|---|
audio/bell.wav | its Details | Stream | Never |
bell | Area | Shape Size | 48, 48 |
| Audio Source | Clip, Bus, Volume | none, Sfx, 1 | |
| Positional, Max Distance, Rolloff | ticked, 512, Quadratic | ||
| Min Distance, Max Voices | 48, 1 | ||
trigger toll | Clip bell.wav | ||
| Bell | bell.rgs | ||
mix | Audio Mix | Ducking row 1 | Sfx over Music: -18.4 dB, 9 dB, 0.05 s, 1 s |
| Sends row 1 | Music to Sfx, Amount 0 | ||
| Send Amounts | cave 0.5, passage 0, well 0 |