Sounds
EVSoundEngine
- class EVSoundEngine[source]
Bases:
objectProcedural 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:
Inverter/Motor: Sine-wave synthesis with harmonic overtones.
Road/Tire Noise: Filtered white noise modulated by speed.
Aerodynamic Hiss: High-frequency wind noise appearing at higher velocities.
- system
The FMOD Core system instance.
- Type:
pyfmodex.System
- 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.
ReverseBeep
- class ReverseBeep[source]
Bases:
objectProcedural 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
- 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
- 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.