Banks

EnvironmentBank

class EnvironmentBank[source]

Bases: object

Interface for environmental audio assets and FMOD Studio banks.

This class manages the lifecycle of environmental sound banks, including loading the ‘Master’ and ‘Environment’ banks. It instantiates and maintains persistent event instances for ambient sounds like rain and wind, allowing them to be modulated in real-time by the EnvironmentAdapter.

studio_system

The active FMOD Studio playback engine.

Type:

StudioSystem

rain_inst

Persistent instance for the rain audio loop.

Type:

EventInstance

wind_inst

Persistent instance for the wind audio loop.

Type:

EventInstance

DEFAULT_BANK_PATH = 'path/to/environment_bank'

The default filesystem directory containing the .bank files, sourced from the global configuration.

Type:

DEFAULT_BANK_PATH (str)

__init__()[source]

Initializes the FMOD system, loads the environment banks, and immediately starts the ambient sound instances.

update_studio_system()[source]

Synchronizes the FMOD Studio system. Must be called in main loop to apply parameter changes (intensity) to the running instances.

get_events()[source]

Provides access to the active event instances for external adapters.

Returns:

A dictionary mapping “rain” and “wind” to their

respective FMOD EventInstances.

Return type:

dict

shutdown()[source]

Releases the FMOD Studio System and stops all environmental audio.

ExampleBank

class ExampleBank[source]

Bases: object

This class handles the low-level initialization of the FMOD Studio System, manages the loading of .bank files, and provides an interface for retrieving event instances. It serves as a blueprint for specialized banks like EnvironmentBank and TriggerBank.

Note

The class explicitly configures ‘PYFMODEX_DLL_PATH’ and ‘PYFMODEX_STUDIO_DLL_PATH’ to locate the FMOD Engine binaries on Windows.

studio_system

The core FMOD Studio System instance managing audio execution.

Type:

StudioSystem

EXAMPLE_EVENT_PATH = 'event:/Example'

The FMOD project path for the example event.

Type:

EXAMPLE_EVENT_PATH (str)

__init__()[source]

Initializes the FMOD Studio System and prepares bank-specific events.

update_studio_system()[source]

Advances the FMOD Studio playback engine.

This must be called in the main loop to process playback states, parameter changes, and 3D positioning.

get_events()[source]

Returns a dictionary of available event instances.

Returns:

A mapping of event names to FMOD EventInstance objects.

Return type:

dict

shutdown()[source]

Gracefully releases the FMOD Studio System and frees native memory.

Ensures that all audio handles are invalidated to prevent memory leaks during simulation shutdown.

TriggerBank

class TriggerBank[source]

Bases: object

Interface for discrete, one-shot audio assets within FMOD Studio.

This class manages the loading and playback of trigger-based sound events, such as collisions, horns, and warnings. It maintains specific event instances and provides public methods to initiate playback, which are typically invoked by the TriggerAdapter.

warning_sound

Instance for the overspeed warning audio.

Type:

EventInstance

crash_sound

Instance for the vehicle collision audio.

Type:

EventInstance

honk_sound

Instance for the vehicle horn audio.

Type:

EventInstance

handBrake_sound

Instance for the handbrake engagement audio.

Type:

EventInstance

DEFAULT_BANK_PATH = 'path/to/trigger_bank'

Default directory for trigger .bank files, defined in the system configuration.

Type:

DEFAULT_BANK_PATH (str)

__init__()[source]

Initializes the FMOD system and prepares one-shot event instances.

play_honk()[source]
play_crash()[source]
play_warning()[source]
play_handBrake()[source]
update_studio_system()[source]
get_events()[source]

Returns a dictionary of event instances.

shutdown()[source]

Releases the FMOD Studio System and stops all active sounds.

config

FMOD Project Configuration

This module defines the filesystem paths and event strings required to link the Python engine with FMOD Studio assets. It dynamically resolves the project root to ensure cross-platform compatibility and defines the URI-style paths for specific FMOD events.

FMOD_CORE_DLL = 'C:\\Program Files (x86)\\FMOD SoundSystem\\FMOD Studio API Windows\\api\\core\\lib\\x64\\fmod.dll'

Absolute path to FMOD Core dll

FMOD_STUDIO_DLL = 'C:\\Program Files (x86)\\FMOD SoundSystem\\FMOD Studio API Windows\\api\\studio\\lib\\x64\\fmodstudio.dll'

Absolute path to FMOD Studio dll

TRIGGER_BANK_PATH = 'path/to/trigger_bank'

Absolute path to the Trigger sound banks directory.

ENVIRONMENT_BANK_PATH = 'path/to/environment_bank'

Absolute path to the Environment sound banks directory.

RAIN_EVENT_PATH = 'event:/Rain'

FMOD Studio path for the ambient rain loop.

WIND_EVENT_PATH = 'event:/Wind'

FMOD Studio path for the ambient wind loop.

WARNING_EVENT_PATH = 'event:/Warning'

FMOD Studio path for the overspeed warning signal.

CRASH_EVENT_PATH = 'event:/Crash'

FMOD Studio path for the vehicle collision impact.

HONK_EVENT_PATH = 'event:/Honk'

FMOD Studio path for the vehicle horn.

HANDBRAKE_EVENT_PATH = 'event:/HandBrake'

FMOD Studio path for the handbrake engagement sound.