Playing events
In this guide we'll explore how to play Fmod events.
FmodEventEmitter nodes
FmodEventEmitter2D and FmodEventEmitter3D are nodes which play Fmod events.
Events and their parameters are loaded by id or name according to Fmod General settings.

Properties
First, set the event that the emitter will play. You can set the name or guid of the event manually, or use the event selection button.
Then, there are a few options you can toggle:
- attached: if true, the Fmod event's position will update alongside the node's position.
- autoplay: if true, the event will autoplay (if false, it will play when the play() function is called on it).
- auto_release: if true, the emitter node will be automatically freed when the event finishes playing.
- allow_fadeout: if true, the event will fade out when stopped.
- preload_event: if true, the event will be preloaded when the node is ready.
Fmod parameters
Event emitters have dynamics properties corresponding to fmod parameters associated with the current event.
You can set their values like any other godot float property.
From scripts, you can change them using get and set object's operators.
Example:
1 2 3 4 5 6 7 | |
Copy Property Path functionality.
You can also use following methods:
- get_parameter: Get the value of a parameter using its name.
- set_parameter: Set the value of a parameter using its name.
- get_parameter_by_id: Get the value of a parameter using its id.
- set_parameter_by_id: Set the value of a parameter using its id.
Example:
1 2 3 4 5 | |
Signals
FmodEventEmitter2D and FmodEventEmitter3D emits signals:
timeline_beat
Emitted on fmod event's timeline beat callback.
Parameters (as dictionary):
- beat: Beat number within bar (starting from 1).
- bar: Bar number (starting from 1).
- tempo: Current tempo in beats per minute.
- time_signature_upper: Current time signature upper number (beats per bar).
- time_signature_lower: Current time signature lower number (beat unit).
- position: Position of the beat on the timeline in milliseconds.
timeline_marker:
Emitted when fmod event timeline passes a named marker.
Parameters (as dictionary):
- name: Marker name.
- position: Position of the marker on the timeline in milliseconds.
started
Emitted when event starts and was not playing. No parameters.
restart
Emitted when event starts and was playing. No parameters.
stopped
Emitted when event has stopped. No parameters.
Methods
play
Starts the event.
parameters:
- restart_if_playing: If true, will restart event if it is already playing. Default value: true.
play_one_shot
Starts a one shot instance of the event that will not be managed by the emitter. Useful for short SFX.
stop
Stops the event.
Set event methods
Both methods set_event_name and set_event_guid changes the event played by the emitter.
Those methods stop and unload the current playing event. It also clear the current parameters values.
If emitter option preload_event is true, it will load the new event.
If emitter option autoplay is true, it will load and play the new event.
set_volume
This sets the emitter volume. If the emitter doe not have any loaded event yet, this will be applied to the future event.
Programmers callbacks
To use a programmer callback, you must first load the bank with the
audio table used by your event containing the programmer callback.
You can then use set_programmer_callback on the event to specify the
key from audio table to use.
1 2 3 4 5 | |
FmodServer api
You can also use FmodServer api to play events. Here is an example script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
In this script we create an instance of FmodEvent by calling FmodServer.
We then set its position attribute to the node's transform, set its RPM parameter to 600 and its volume to 2.
We then start it.
In the _process method, we pause the event if we press space action.
Here is another with setting callback:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
In this script we create an FmodEvent and set a callback on it. Each time the event emits the callback we change the
node's color.
Programmers callback
In order to play a programmer callback you must load the bank with audio table concerned by the programmer callback.
then you can use set_programmer_callback to specify key from audio table to use.
1 2 3 4 | |