Sounds

EVSoundEngine

class EVSoundEngine[source]

Bases: object

Procedural Audio Engine for Electric Vehicle (EV) sound synthesis.

This engine utilizes the FMOD Core API to synthesize vehicle sounds in real-time using oscillators and noise generators. It simulates three primary acoustic components:

  1. Inverter/Motor: Sine-wave synthesis with harmonic overtones.

  2. Road/Tire Noise: Filtered white noise modulated by speed.

  3. Aerodynamic Hiss: High-frequency wind noise appearing at higher velocities.

system

The FMOD Core system instance.

Type:

pyfmodex.System

is_running

Tracks the active state of the audio emitters.

Type:

bool

engine_group

Audio bus for motor-related DSPs.

Type:

ChannelGroup

road_group

Audio bus for tire and wind-related DSPs.

Type:

ChannelGroup

__init__()[source]

Initializes the FMOD Core system and constructs the DSP signal chain.

Sets up sine oscillators for the motor, noise generators for the road, and a filtering pipeline (low-pass and resonance) to simulate cabin insulation and tire resonance.

start()[source]

Activates the DSP chain and begins audio playback.

Assigns DSPs to their respective channel groups and establishes the hierarchical routing from road and engine groups to the master group.

update_params(speed_kmh, torque, road_roughness=0.01)[source]

Modulates the synthesized sound based on real-time vehicle dynamics.

Parameters:
  • speed_kmh (float) – Current vehicle speed. Affects pitch of the motor and volume/frequency of road and wind noise.

  • torque (float) – Engine load. Directly modulates the volume of the motor oscillators to simulate power delivery.

  • road_roughness (float, optional) – Multiplier for tire noise volume. Defaults to 0.01.

stop()[source]

Gracefully releases the FMOD Core system resources.

ReverseBeep

class ReverseBeep[source]

Bases: object

Procedural audio generator for vehicle reverse warning signals.

This class synthesizes a rhythmic “beep” sound using a DSP signal chain instead of audio files. It uses a high-frequency sine oscillator processed through a distortion unit to create the characteristic industrial warning tone. The timing logic (on/off cycles) is managed via the internal state.

system

The dedicated FMOD Core system for reverse sounds.

Type:

pyfmodex.System

is_playing

Tracks whether a beep pulse is currently active.

Type:

bool

start_time

Timestamp of when the current beep pulse started.

Type:

float

grundton

Sine wave oscillator (1500Hz).

Type:

DSP

verzerrung

Distortion unit for harmonic grit.

Type:

DSP

fader

Final gain stage for the signal chain.

Type:

DSP

__init__()[source]

Initializes the audio system and constructs the DSP signal chain.

dynamisch_Beep_erstellen()[source]

Constructs the DSP signal chain: Oscillator -> Distortion -> Fader.

Configures a Sine wave at 1500.0Hz and applies full distortion (level 1.0) to create the sharp, piercing warning tone.

play()[source]

Initiates a single beep pulse.

Starts the DSP chain on a new channel and records the start time to facilitate the 400ms duration limit.

update()[source]

Handles the lifecycle and timing of the beep pulse.

If a beep has been active for more than 0.4 seconds (400ms), the channel is stopped. Also advances the FMOD system clock.

shutdown()[source]

Releases FMOD resources and shuts down the reverse beep audio system.