Skip to content

MushroomFleet/Fivem-EngineSound-Simulator

Repository files navigation

FIVEM Engine Sound Simulator

GitHub License: MIT

A React + TypeScript + Vite application that parses real FIVEM/GTA V audio files (.awc, .dat151.rel, .dat54.rel) and simulates engine sounds using Web Audio API with authentic granular synthesis parameters.

Engine Simulator Preview

✨ Features

  • Complete AWC Parser - Parses ADAT format AWC files from FIVEM/GTA V modpacks
  • ADPCM Audio Decoder - Decodes IMA ADPCM compressed audio to PCM
  • RelFile Parser - Parses .dat151.rel and .dat54.rel binary configuration files
  • Dat151 Engine Settings - Extracts GranularEngineAudioSettings (RPM ranges, volumes, rev limiter, etc.)
  • Dat54 Sound Data - Extracts GranularSound parameters (channel volumes, granular clock, pitch settings)
  • Granular Audio Synthesis - Multi-layer audio playback (idle, onLoad, offLoad, exhaust)
  • Real Engine Parameters - Uses authentic GTA V audio parameters for realistic sound simulation
  • Web Audio Integration - Real-time audio mixing based on RPM, throttle, and extracted parameters
  • Modpack Support - Loads complete FIVEM audio packs with full .dat file parsing
  • TypeScript - Full type safety throughout the codebase

🚀 Quick Start

Prerequisites

  • Node.js 18+ and npm
  • Modern browser with Web Audio API support

Installation

  1. Clone the repository:
git clone https://github.com/MushroomFleet/Fivem-EngineSound-Simulator.git
cd Fivem-EngineSound-Simulator/fivem-engine-simulator
  1. Install dependencies:
npm install
  1. Start the development server:
npm run dev
  1. Open your browser: Navigate to http://localhost:5173 (or the port shown in terminal)

Building for Production

npm run build

The built files will be in the dist/ directory.

📦 Usage

Loading a FIVEM Audio Modpack

  1. Click "SELECT FOLDER" or drag-and-drop a FIVEM audio modpack folder

  2. The modpack should contain:

    • fxmanifest.lua - Resource manifest
    • /audioconfig/*.dat151.rel - Engine audio settings (AUDIO_GAMEDATA)
    • /audioconfig/*.dat54.rel - Sound data configuration (AUDIO_SOUNDDATA)
    • /sfx/**/*.awc - Audio wave container files
  3. Once loaded, you'll see:

    • Audio pack name and AWC file count
    • Extracted engine parameters (RPM range, granular clock entries, channel volumes)
  4. Enable "Use Real Audio" checkbox to use the loaded audio files

  5. Click "START ENGINE" and adjust the throttle slider!

What Gets Extracted

From .dat151.rel (GranularEngineAudioSettings):

  • RPM range (minRPMOverride, maxRPMOverride)
  • Volume settings (master, idle, accel, decel, engine, exhaust)
  • Gear change wobble parameters
  • Rev limiter settings
  • Synth definitions and presets

From .dat54.rel (GranularSound):

  • 6-channel file references and volumes
  • Granular clock (RPM-to-grain mapping)
  • Loop randomization parameters
  • Pitch fraction settings

📁 Project Structure

fivem-engine-simulator/
├── src/
│   ├── types/              # TypeScript type definitions
│   │   ├── awc.types.ts    # AWC file format types
│   │   ├── rel.types.ts    # RelFile base types
│   │   ├── dat151.types.ts # Dat151 engine settings types
│   │   ├── dat54.types.ts  # Dat54 sound data types
│   │   └── engine.types.ts # Combined engine parameters
│   ├── utils/              # Utility classes
│   │   └── BinaryReader.ts # Binary data reading utilities
│   ├── parsers/            # File parsers
│   │   ├── AWCParser.ts    # AWC audio container parser
│   │   ├── RelFileParser.ts # Core .rel file parser
│   │   ├── Dat151Parser.ts # Game data parser (engine settings)
│   │   ├── Dat54Parser.ts  # Sound data parser (granular sounds)
│   │   └── ModpackParser.ts # FIVEM modpack loader
│   ├── audio/              # Audio engine
│   │   ├── ADPCMDecoder.ts # IMA ADPCM audio decoder
│   │   └── AudioEngine.ts  # Web Audio synthesis engine
│   └── components/         # React components
│       └── EngineSimulator.tsx
├── public/                 # Static assets
├── index.html              # Entry HTML
├── vite.config.ts          # Vite configuration
├── tsconfig.json           # TypeScript configuration
└── package.json            # Dependencies

🔧 Technical Implementation

RelFile Binary Format

The parser handles GTA V's .rel file format based on CodeWalker:

RelFile Structure:
├── File Type (4 bytes) - Dat4, Dat54, Dat151, etc.
├── Data Block Length (4 bytes)
├── Data Block (variable) - Contains all entry data
├── Name Table
├── Index Entries - Hash/offset/length for each entry
├── Hash Table
└── Pack Table

Dat151 GranularEngineAudioSettings

Parses 60+ engine audio parameters including:

  • Pre/post-submix volumes for engine and exhaust
  • Gear change wobble (pitch, volume, speed variances)
  • Rev limiter configuration
  • Synth definitions for upgraded engines

Dat54 GranularSound

Parses granular synthesis configuration:

  • 6 audio channels with file references
  • Channel settings (output buffer, clock index, pitch stretch)
  • Granular clock array (RPM → grain index mapping)
  • Loop randomization parameters

Audio Engine

Multi-layer synthesis with real parameters:

  • Idle Layer: Uses channel 0, influenced by idle volume settings
  • OnLoad Layer: Uses channel 1, influenced by accel volume
  • OffLoad Layer: Uses channel 2, influenced by decel volume
  • Exhaust Layer: Uses channel 3, influenced by exhaust volume

Dynamic pitch calculated from granular clock data for authentic RPM-to-pitch mapping.

🌐 Browser Support

Requires modern browsers with:

  • Web Audio API
  • File System Access API (for folder upload)
  • ES6+ JavaScript features

Tested on:

  • Chrome 90+
  • Firefox 88+
  • Edge 90+
  • Safari 14+

📚 References

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Credits

Built for the FIVEM modding community.

  • AWC/RelFile formats reverse-engineered from GTA V audio files
  • Binary parsing based on CodeWalker by dexyfex
  • Original audio research by CamxxCore

📚 Citation

Academic Citation

If you use this codebase in your research or project, please cite:

@software{fivem_engine_sound_simulator,
  title = {FIVEM Engine Sound Simulator: Real-time GTA V Audio Parsing and Granular Synthesis},
  author = {Drift Johnson},
  year = {2025},
  url = {https://github.com/MushroomFleet/Fivem-EngineSound-Simulator},
  version = {1.0.0}
}

Donate:

Ko-Fi

About

ORAGEN TEAM

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages