Enginelicious
Engine sounds from physics: cylinders, valves and exhaust pipes







01 The story
A long-running experiment in engine sound from first principles. Redline, for macOS and the web, simulates an engine's thermodynamics and exhaust acoustics in real time for dozens of real cars. LidLab turns a MacBook's hidden lid-angle sensor into instruments, including a car you drive with the lid.
It started in December 2025 with small experiments. EV Sound Lab, a Flutter app, reads speed, pedal and torque from a car's OBD-II port through a Bluetooth ELM327 adapter, smooths them with a damped spring, and drives a low-latency synth to give an electric car a sound.
Redline is the main piece. Instead of playing samples, it simulates the engine. Each cylinder runs a zero-dimensional thermodynamic cycle: piston or Wankel-rotor geometry, cam lift, compressible flow through the valves, Wiebe-function combustion and a first-law heat balance. The pressure pulses travel through modeled headers, collectors and mufflers before they reach your ears. The drivetrain is simulated too, with a clutch and synchro state machine and a Pacejka tire model, so a gearshift sounds the way it does because of what the physics did.
The macOS version (Swift 6.2, macOS 26) splits into EngineKit for physics, acoustics, reverb and spatial audio, EngineRender for a Metal view of the moving engine and valvetrain, and a SwiftUI app with a garage of 41 designs. It has a dyno, a trackside view with spatial audio that follows your head on AirPods, gamepad driving, and Engine IQ, which uses Apple's on-device language model to turn a plain-English brief into an engine design and run it on the dyno. The web version carries 29 calibrated cars and a live-GPS mode that drives the engine from your real speed.
LidLab came out of the same audio work. Recent MacBooks have a lid-angle sensor, and LidLab reads it alongside the accelerometer, gyroscope, Force Touch trackpad, ambient light, Wi-Fi signal and thermals, then turns each into something to play: a creaky-hinge sound box, a theremin, a squeezebox, an auto-arranging band, a safe you crack with the lid, and an Engine Room that turns chip power draw into a jet turbine. Its Garage mode is a procedural car synth where each gear owns a band of lid travel, with a kickdown at 130°.
Where it stands: the macOS apps are written and LidLab has a launch video. The web Redline still runs its earlier prototype sound engine, and I've started a line-by-line Swift-to-TypeScript port of EngineKit (conventions and SIMD helpers so far) so the browser will sound the same as the Mac.
▶ Film
02 What it does
- 01
Real-time engine sound simulated from cylinder thermodynamics and exhaust acoustics, not recorded samples
- 02
A garage of real cars: 41 designs on macOS and 29 calibrated cars on the web, each tuned against published torque figures
- 03
Engine builder and dyno: change layout, induction and mods and see the torque curve, or describe an engine and let Engine IQ propose one
- 04
Live GPS mode on the web: your real speed and acceleration drive a virtual engine while you drive
- 05
Spatial trackside and cockpit listening on macOS, binaural on headphones and head-tracked on AirPods, plus gamepad driving
- 06
LidLab: a MacBook's lid becomes a theremin, a squeezebox, a creaking door, a band, a game controller, a safe dial and a car
- 07
EV Sound Lab (Android/iOS): turns live speed, pedal and torque from a Bluetooth OBD-II adapter into an EV soundtrack, with a simulator
03 How it's built
Everything runs on the device; there is no server. In Redline, the input drives a vehicle and drivetrain model, which sets the load on a per-cylinder thermodynamic engine model. Its pressure pulses feed an acoustic model of the exhaust and intake that renders sound for each ear. LidLab and EV Sound Lab are lighter procedural synths driven by a laptop hinge and by a real car's OBD-II data.
All 11 connections, as text
- Inputs: pedals/keyboard/gamepad, live GPS → GPS fusion: speed, g, virtual throttle: location fixes
- Inputs: pedals/keyboard/gamepad, live GPS → Drivetrain: clutch, gears, Pacejka tires: throttle, clutch, gear
- GPS fusion: speed, g, virtual throttle → Drivetrain: clutch, gears, Pacejka tires: road speed
- Drivetrain: clutch, gears, Pacejka tires → 0D cylinder model (Wiebe burn, valve flow): load, rpm
- 0D cylinder model (Wiebe burn, valve flow) → Exhaust/intake acoustics + reflections: per-cylinder pressure pulses
- Exhaust/intake acoustics + reflections → Spatial output / Web Audio worklet: per-ear streams
- Engine IQ (on-device language model) → 0D cylinder model (Wiebe burn, valve flow): proposed design, checked on the dyno
- Spatial output / Web Audio worklet → Redline for macOS (SwiftUI + Metal): audio + Metal render
- Spatial output / Web Audio worklet → Redline web (Vite + three.js): AudioWorklet
- MacBook lid, IMU, trackpad sensors → LidLab (macOS) + Garage car synth: angle, velocity
- Car OBD-II via ELM327 BLE → EV Sound Lab (Flutter) + SoLoud synth: speed, pedal, torque
04 Engineering notes
Zero-dimensional cylinder model: slider-crank and Wankel trochoid volumes, cam lift with variable cam switching, choked and subsonic orifice flow, Wiebe heat release and first-law integration with temperature-dependent cv, oversampled per audio sample
Exhaust acoustics as a network: per-cylinder primaries of slightly different lengths (the asymmetry keeps the half-orders), collectors, active bypass valves, afterfire pops, monopole radiation and ground-reflected paths to each ear
Native: EngineKit and Metal rendering in Swift 6.2 with -Ounchecked release builds, AVAudioEnvironmentNode spatial output with a peak limiter, and Apple FoundationModels for the engine designer
Web: physics runs in an AudioWorkletProcessor and car calibration in a Web Worker, while GPS fusion rebuilds speed, longitudinal and lateral g and a virtual throttle from the Geolocation API
LidLab reads the hinge encoder (1° steps) and gets angular velocity by timing the gaps between steps. It also reads the IMU, ambient light, Force Touch force, CoreWLAN signal, die temperatures, fans and power rails
EV Sound Lab speaks ELM327 over BLE: AT init, then standard and VW-specific PIDs (speed 010D, pedal 0149, torque 22F40B), bridging 10-20 Hz telemetry into a 60 fps loop with a damped-spring filter
05 By the numbers
- 41
- Car designs (macOS Redline)
- 29
- Calibrated cars (web Redline)
- 15
- LidLab modes: instruments, games and sensor experiments
- 24 s, 1920x1080
- LidLab launch video
06 Stack
App
- SwiftUI (macOS 26)
- Metal / MetalKit
- Vite + TypeScript
- three.js
- Flutter (EV Sound Lab)
Tooling
- Swift Package Manager (Swift 6.2)
- AVAudioEngine / AVAudioEnvironmentNode
- Apple FoundationModels
- GameController
- Swift Charts
- Accelerate / simd
- Web Audio AudioWorklet + Web Workers
- Geolocation API
- IOKit / CoreWLAN sensors
- flutter_soloud
- flutter_blue_plus (ELM327 BLE OBD-II)
- Playwright + ffmpeg (launch video render)
Lines of code (approx.)
- Swift48,641
- TypeScript11,881
- Dart4,988
- CSS1,781
≈ 67,291 lines
Repositories
- engineliciousprivate
- evsounds_appprivate
- enginesimflutterexpprivate
- enginesimpyexpprivate
enginelicious is a one-commit consolidation of the engine-sound and car-telemetry work, pushed 2026-11-09, so its history is lost. The Redline package targets Swift 6.2 and macOS 26. The related repos have real dates: evsounds_app has 15 commits from 2025-12-11 to 2025-12-16, and two small experiment repos, enginesimpyexp and enginesimflutterexp, have 3 commits between them on 2025-12-16. The 19-commit total covers all four repos.