Audio
In short
There are no audio files.
AudioSynthis a small DSP kit;SoundBankandBallparkOrganbuild every clip once at boot.GameAudiolistens toGameEventsand plays them, so gameplay code never calls audio. Outside the menu organ, every sound is a reaction to something on the field; the cutscenes and the live hit counter callGameAudio’s static one-liners directly.
How it works
GameRootaddsGameAudioto[Game]. ItsAwakebuilds aSoundBank, the organ loop, the “Charge!” fanfare and five clips of its own (intro impact, firework bang, sad trombone, counter tick, riser), and makes fourAudioSources: music (loops, ignores listener pause), ball (the pitch whir), sfx (one-shots) and counter (the hit counter’s ticks, on their own source so changing their pitch never bends a cheer).- The music source plays all the time at volume 0 and fades: on in menus, off in
AtBat,CoopWatch,IntroandOutro. - Each
GameEventsevent maps to sounds (table below). - UI code calls static one-liners:
GameAudio.Click,Coin,Shuffle,Buzz,LevelUp,Cheer,Groan,YourTurn. The cutscenes and the hit show have their own (table below). - Pausing sets
AudioListener.pause(GameAudio.SetPaused): the field goes silent, the organ keeps playing.
Event to sound
| Event | Sound |
|---|---|
StateChanged | Organ fades in (menus) or out (at bat, spectating); the ball whir stops. |
PitchThrown | Special-ball cue at the windup (pitch per effect; on a boss pitch the boss’s ball, PitchData.Primary), then the whir from release to the plate at the pitch’s speed, then a glove pop if nobody hit it. |
SwingStarted | Whoosh. |
SwingResolved | Contact: a crack by exit velocity (green crack on a green), a ping on solid contact, a small cheer on a green that grows with the streak. Whiff: an “ooh”. |
HitLanded | Home run: homer bell, a big or huge cheer, then “Charge!“. Foul: soft ooh. In play: groan. |
CountChanged | Wood block on an out (plus a groan on a strikeout); a lighter, higher wood block on a strike. |
RoundFinished | Cleared: cheer and “Charge!“. Failed: groan (not for a co-op turn). |
RunEnded | Huge cheer on a win; a chime on a new best. |
ScoreboardHit | Smash: crunch, boom and tinkling glass (Scoreboard). |
Direct calls (no event)
| Call | Sound | Called by |
|---|---|---|
CrowdSwell | Small cheer at 0.55 | Match intro opening (Cutscenes) |
Whoosh | The whoosh at pitch 1.15 | Every slash wipe in the intro and outros |
Impact | Low thump plus a dark noise burst | A name slamming in (intro), outro titles; also under StackHit and CounterSlam |
Fanfare | Huge cheer, then “Charge!” 0.3 s later | MAP BEATEN |
FireworkBang | Falling 90 to 28 Hz boom plus 26 crackle pops | Each firework burst (Fireworks) |
SadTrombone | D4, C#4, C4, then a long wobbling B3 | GAME OVER |
CounterTick(feet) | A 30 ms blip that climbs a major scale, a step every 35 ft (pitch capped at 3), louder per heat tier | HitCounter, every 10 ft (Hit Show) |
CounterDing(tier) | Chime, a little higher per tier | Distance milestones |
Gone | Half-second riser plus a small cheer | The ball clearing the wall |
StackHit(step) | Coin, pitch 1 + 0.14 per step, plus a soft impact | Each multiplier joining the home-run score |
CounterSlam | Impact plus six quick coins | The total landing in the score panel |
CounterStamp | Wood block | OUT / FOUL stamp |
The clips
SoundBank builds: CrackSoft, CrackMedium, CrackHard, CrackGreen, Ping, HomerBell, PitchWhir, Whoosh, GlovePop, WoodBlock, Tick, Coin, Shuffle, Buzz, Chime, SpecialBall, CheerSmall, CheerBig, CheerHuge, Groan, Ooh, Smash. Crowd sounds are layered voices, not noise. There is no umpire voice: a wood block marks strikes and outs and the HUD shows the call.
GameAudio builds its own five clips in code with AudioSynth: IntroImpact, FireworkBang, SadTrombone, CountTick, Riser.
BallparkOrgan plays the public-domain “Take Me Out to the Ball Game” chorus as a 3/4 waltz from note tables, and builds the “Charge!” fanfare. The melody was transcribed from memory: a wrong note is a one-line fix in its table.
AudioSynth gives oscillators (Tone, Organ, Brass, Sweep, Voices, Noise), filters (LowPass, LowPassSweep, HighPass), envelopes (Envelope, ExpDecay), mixing (Mix, MixInto, Gain, Wobble, MakeLoop, Normalize, Clamp), NoteHz("C5") and ToClip.
Numbers
| What | Value | Where to tune |
|---|---|---|
| Sample rate | 44,100 Hz, mono | AudioSynth.Rate |
| Organ tempo | 116 BPM, 3 beats per bar | BallparkOrgan.Bpm |
| Music fade | 0.7 s | GameAudio.MusicFadeSeconds |
| Organ loudness at slider 1 | 0.5 | GameAudio.MusicBase |
| Whir loudness at slider 1 | 0.55 | GameAudio.WhirBase |
| Whir pitch | speedMph / 85, clamped 0.7 to 1.6 | ReferencePitchMph |
| Solid contact (ping) | quality >= 0.55 | SolidContactQuality |
| Crack choice | green: CrackGreen; < 78 mph soft; < 96 mph medium; else hard | SoundBank.CrackFor |
| Huge cheer | home run of 450 ft or more | GameAudio.OnHitLanded |
| ”Charge!” delay after the bell | 0.6 s | ChargeDelay |
| Special-ball cue pitch | $$$ 1.25, Super Fast 1.1, Anti-Gravity 0.9, Ghost 0.75, Sticky 0.6, Wiffle 1.4, Headwind 0.8, Tailwind 1.2 | SpecialBallPitch |
| Counter tick scale step | 35 ft per scale degree, base pitch 0.55, max 3 | GameAudio.CounterTick |
| Default volumes | music 0.6, sound 1 | GameSettings |
In the code
| File | What it does |
|---|---|
Scripts/Audio/GameAudio.cs | Sources, event handlers, UI, cutscene and counter one-liners, its own five clips, SetPaused. |
Scripts/Audio/SoundBank.cs | Builds and holds every effect clip; CrackFor. |
Scripts/Audio/AudioSynth.cs | The DSP kit. |
Scripts/Audio/BallparkOrgan.cs | BuildLoop, BuildCharge. |
Gotchas
README drift
The README’s tuning list says to assign a real clip to
GreenFeedback.GreenClip. That field no longer exists:GreenFeedbackonly shakes the camera, and the green sound isCrackGreenplus the small cheer inGameAudio.
- The whir and glove pop wait on game time (
WaitForSeconds), so they follow the ball through hit stop and slow motion. Delayed one-shots use real time. - Volumes are read from
GameRoot.Instance.Save.settingson every play, so the MUSIC and SOUND sliders apply live. - All clips are built in
Awake, which adds a little to boot time. - The counter source keeps the last pitch it was given; every call through
PlayCountersets it first.
Related
- Game Events: the events behind every sound
- Add a Sound: making and hooking a new sound
- GREEN Swings: the green feedback
- Save System: where the volume settings live
- Cutscenes and Hit Show: the direct-call sounds