DEV505 / SOUND LAB / 03
A little buzz.
Follow a tiny moving emitter through 3D space.
Try it in Unity
Section titled “Try it in Unity”In Unity’s Project window, open Assets/DEV505/SoundManager/Samples/03-Bee/Demo.unity. The supplied scene already has its Sound Manager, event registrations, generated keys, camera, and Audio Listener. Press Play, wait for the demo to be ready, and click the Game view before using the keyboard. If you are setting up a separate scene, follow Your first sound first.
| Control | Action |
|---|---|
| Space | Release or recall the bee. |
| Release bee / Recall bee | The same action from the HUD. |
Use headphones if possible. Release the bee, listen as it crosses to either side, and compare the distance shown in the HUD. Recall it to end the moving buzz. The listener represents you at the central DEV505 player, rather than the distant scene camera. Its orientation decides which direction is heard on the left and right.
Read the graph
Section titled “Read the graph”The graph starts a looping recording and connects WingSpeed to playback speed. Increasing that value makes the buzz faster and higher pitched; it does not move the bee through the scene. The recording is imported for a mono spatial source. A single emitter position lets Unity place it relative to the listener.
Spatial blend is fully 3D. The saved distance range is 0.8–4 units with linear rolloff: after the near distance, moving farther away reduces the level. Doppler is 0.3, adding a modest pitch change from relative movement. These settings and the listener’s position matter more than the camera’s view of the island.
Start, follow, and stop
Section titled “Start, follow, and stop”The demo’s essential call is:
var context = SoundPlayContext.Following(bee) .With(SoundParameters.Bee.WingSpeed, 1f);var result = SoundBus.Play(Sounds.Bee, context);bee is the Transform moved by the flight controller. Keep result.Handle only after checking result.Accepted. Following retains a reference to that Transform; the runtime reads it while the play is alive and updates its voices. It does not capture only the starting position. By contrast, SoundPlayContext.At(position) uses a fixed position.
To recall the bee, stop the retained play with SoundBus.Stop. This graph’s owner-loss policy is Stop, so destroying its follow target also ends playback. Following(bee) alone does not assign an explicit owner token. The complete recipe adds an owner for convenient object-wide cleanup and demonstrates how to change WingSpeed while buzzing.
What belongs to the demo?
Section titled “What belongs to the demo?”Flight paths, wing flapping, the flower perch, distance label, and glowing player are sample visuals and animation. Sound Manager follows the Transform and plays the graph. It does not calculate the bee’s route or simulate its wings. The event permits one Bee play; starting another replaces the old one.
Common surprises
Section titled “Common surprises”- The buzz stays in one place. Use Following with the bee Transform, not At with a copied position.
- It sounds centered or too quiet. Check the active Audio Listener, fully 3D settings, and the small distance range. Avoid a second listener on another camera.
- It keeps restarting. Play once, retain the handle, and move the Transform. Repeated Play calls replace the current buzz.
- WingSpeed changes instantly. This parameter has zero rise/fall smoothing in the saved graph. The flight animation’s smoothing is separate.
Event settings, parameters, and signals
Section titled “Event settings, parameters, and signals”These are the saved graph settings. A play can supply different initial parameter values. Float smoothing is measured in units per second; a rate of 0 applies changes immediately.
Sounds.Bee
- Position
- 3D · 0.8–4 units (minimum–maximum distance)
- Overlapping plays
- 1 ·
ReplaceOldest - Cooldown
- None
- Owner loss
- Stop
- Keep Alive
- Off — ends when its work is finished
| Parameter | Type | Default | Range | Rise / fall rate |
|---|---|---|---|---|
WingSpeed | Float | 1 | 0.7–1.5 | 0 / 0 |
Signals: None authored.
For the meaning of these settings, see Playback settings. The default numbers above come from the Unity graph audit stored with this documentation.
Take it into your own game
Section titled “Take it into your own game”Open the complete integration recipe for the script, Inspector setup, a short test, and cleanup. Use Play context for initial values and placement, and SoundBus for playback controls.
All Bee Unity captures includes further states and readable graph details, with steps to reproduce each view.