Turn an Engine Simulator preset into a small, game-ready bank of seamless engine loops. The generator runs offline on Windows, captures a configurable RPM/load grid, finds clean four-stroke loop boundaries, and writes WAV files plus JSON metadata that a Unity project can import directly.
It exists to remove the repetitive part of engine audio work. Instead of recording a simulator window and cutting every RPM by hand, define the engine once and regenerate the whole bank whenever its sound or RPM range changes.
This is an offline content-build tool. It does not run Engine Simulator inside Unity and has no runtime CPU cost.
v0.1.0 is the first public release. It is ready for Windows-based content pipelines and includes five working example presets. The generator is intentionally focused on offline WAV-bank production; runtime playback and blending remain the responsibility of the host game or audio middleware.
This tool is built on the open-source Engine Simulator by AngeTheGreat (Ange Yaghi). The Engine Simulator runtime in ThirdParty/engine-sim-runtime is his work and is kept under its original MIT license with his copyright intact.
The offline audio-bank generator, seamless-loop processing, manifest-driven automation, Unity-oriented export workflow, documentation, and repository scaffolding are original work by Vangardo. This repository does not claim that Vangardo created Engine Simulator. It builds on Engine Simulator to solve the separate problem of producing game-ready audio banks automatically.
See NOTICE.md for the exact attribution and file boundaries.
For every engine in engine-banks.json, the generator creates:
start.wav: starter, ignition catch, and a stable idle tailshutdown.wav: ignition-off rundownrpm_####/load_###.wav: seamless 48 kHz mono PCM16 loops for every requested RPM and loadEngineAudioBank.json: coordinates, measured RPM, normalization gain, and loop-quality metrics
The default manifest creates seven RPM rows and three load columns (0.0, 0.45, and 1.0), or 21 loops per engine. The numbers are settings, not a fixed limitation.
- Windows 10 or 11
- Visual Studio 2022 with Desktop development with C++
- CMake 3.20 or newer, available on
PATH
The repository includes the small Windows WinFlexBison runtime needed to build the parser and a pinned, headless Engine Simulator runtime. No Unity installation is required to generate audio.
Open PowerShell in the repository root:
& .\Build-Generator.ps1
& .\Generate-All.ps1 -ProbeOnly-ProbeOnly compiles every preset and reports the engine name, cylinder count, redline, and simulation rate. It is the quickest way to validate a new preset without creating WAV files.
& .\Generate-All.ps1Output goes to GeneratedBanks by default. Choose another location, including a Unity project's audio folder, with -OutputRoot:
& .\Generate-All.ps1 -ModuleId engine_h2 -OutputRoot 'D:\MyUnityGame\Assets\Audio\GeneratedEngineBanks'When an existing bank is regenerated, unreferenced WAV files are removed safely so a deleted RPM or load state cannot remain in the folder.
- Generate a bank into a folder under
Assetsor copyGeneratedBanks/<module-id>there. - Set each WAV importer to Decompress On Load and enable looping for the RPM/load WAVs. Do not loop
start.wavorshutdown.wav. - Read
EngineAudioBank.json, load the requested clips, and blend the four neighboring points around the current RPM and load. - Use
start.wavfor the start transition, crossfade its settled tail into idle, and playshutdown.wavwhen ignition turns off.
The metadata deliberately uses relative forward-slash paths, making it independent of Unity asset GUIDs and straightforward to import into another engine or middleware.
engine-banks.json is the source of truth. Each entry names a preset, its entry function, stable module ID, fallback idle RPM, and explicit RPM grid:
{
"moduleId": "engine_h2",
"displayName": "Torque H2 V-Twin",
"preset": "Presets/torque_h2_vtwin.mr",
"entry": "kohler_ch750",
"fallbackIdleRpm": 1600,
"idleRpm": 1600,
"rpms": [1600, 1900, 2200, 2500, 2800, 3100, 3450]
}To add an engine:
- Put an Engine Simulator
.mrfile inPresets. - Add an engine object to
engine-banks.jsonwith a uniquemoduleId. - Run
Generate-All.ps1 -ProbeOnlyuntil the preset compiles cleanly. - Generate the bank and audition the loops. Adjust the preset, RPM points, capture duration, or loads as needed.
idleRpm and rpms are optional. If omitted, the tool measures idle after startup and builds a rounded, near-redline grid automatically. Use explicit values when a gameplay design needs exact points.
At each RPM/load point the simulator is held on its dynamometer, allowed to stabilize, and captured offline. The generator estimates a four-stroke combustion-cycle length from the measured RPM, searches multiple whole-cycle candidates, scores the seam using waveform and derivative discontinuities, then applies a very short circular boundary correction. It normalizes the complete bank once, preserving the intended loudness difference between unloaded and loaded states.
This is designed for believable interpolation, not for a single audio clip played faster or slower across the full rev range.
src/ C++ generator and loop builder
Presets/ Editable example engine definitions
SourcePresets/ Untouched source versions of imported presets
ThirdParty/engine-sim-runtime/ Pinned Engine Simulator headless runtime
engine-banks.json Audio-bank manifest
Build-Generator.ps1 CMake/Visual Studio build entry point
Generate-All.ps1 Manifest-driven generation entry point
Prune-StaleBanks.ps1 Removes obsolete generated WAV files
docs/ Background and technical notes
The included Engine Simulator runtime is from AngeTheGreat/engine-sim, created by AngeTheGreat (Ange Yaghi), pinned at commit 85f7c3b959a908ed5232ede4f1a4ac7eafe6b630, and remains under its MIT license in ThirdParty/engine-sim-runtime/LICENSE. Its copyright is preserved in this repository's LICENSE and vendor license. Local headless-only changes are documented in ThirdParty/PATCHES.md.
The generator code and repository scaffolding are MIT licensed. Engine definitions can carry their own authorship and terms, so confirm that you may redistribute any preset before publishing it with a game.
Read From Engine Simulation to Game-Ready Audio for the problem this tool was built to solve and the workflow behind it.
Issues and pull requests are welcome. Start with CONTRIBUTING.md. Please keep third-party runtime changes narrowly scoped, document their purpose in ThirdParty/PATCHES.md, and run the build plus probe commands before opening a pull request.