iRacing Coach — test build
==========================

A voice driving coach. It compares each of your corners with a reference
driver's lap and tells you what to do with brake, throttle and gears: it warns
you before the corner and gives feedback right after it.


REQUIREMENTS
------------
- Windows 10 or 11 and iRacing.
- Internet for the coach's natural voice (Christopher or Ava; pick it in the
  panel, under "Coach voice"). Offline it uses the Windows voice (Zira or
  David) — missing? Settings > Time & language > Speech > Add voices >
  English (United States).
- A microphone and a free wheel button, if you want to talk to the coach.
- Internet the first time the microphone starts: the app downloads the speech
  recognition model (~460 MB). After that it works offline.


HOW TO USE
----------
1. Unzip the whole folder anywhere and open iRacingCoach.exe.
   Windows may show "Windows protected your PC" (the app isn't signed):
   click "More info" > "Run anyway".

2. Top right of the panel, set "Idioma / Language" to English (the app
   restarts).

3. Click "Load driver telemetry (.ibt)" and pick the .ibt file of the driver
   you want to follow, ON THE SAME TRACK AND CAR you'll drive. The coach uses
   the fastest lap in the file. You can load several (one per track and car).

4. Go on track in iRacing. The coach says "Reference loaded" and starts giving
   tips from your 2nd lap.

The first time, the coach creates an "iRacing Coach" shortcut on the desktop
and in the Start menu: open it from there next time.

Closing the window (X) doesn't close the coach: it keeps running in the icon
next to the Windows clock. Click the icon to open it; to close it for good,
right-click > Quit.

When a new version comes out, the panel shows it at the top. "Update now"
downloads it, closes the coach, swaps the files and reopens it by itself;
settings, login and references stay (they live in %LOCALAPPDATA%\iRacingCoach,
outside the program folder).


TALKING TO THE COACH (WHEEL BUTTON)
-----------------------------------
The microphone only listens while you hold a wheel button (or a key).
1. In the panel, under "Push to talk", click "Map" and press the wheel button
   you'll use (pick one iRacing doesn't use). Any wheel button works,
   including high-numbered ones, or a keyboard key.
2. On track: hold the button, say the phrase, release. The coach confirms out
   loud.

This version has no AI: it understands only the phrases below (anything else
gets the list read out). The panel shows the same list under "How to talk to
the coach".
- "Coach mode": driving tips for every turn (the default).
- "Engineer mode": no driving tips, for setup work.
- "Quiet" / "Silence": tips stop.
- "You can talk": tips come back.
- "Focus on turn 7": only that turn gets tips (also "on turns two and three").
- "All turns": turns focus off.
- "Explain turn 8": the whole turn — how the reference takes it (brakes,
  gear, when to release, when to get on the throttle) and how you do.
- "Racing line": in the pits, compares your line with the reference. Needs
  telemetry recorded in iRacing with Alt+L (press it again to stop recording
  before asking).
- "Skip springs": on ovals, the coach leaves the pit springs alone this stop.

Turns are numbered in the order the coach detects them, which may not match
the track's official numbering.


SUPER FORMULA SF23 DASHBOARD
----------------------------
A display copying the Super Formula SF23 steering wheel:
- shift lights on top;
- OT ReTime (bar on the left): overtake recharge between uses;
- LAP and TIME: laps completed and last lap time;
- REF and DIFF: your best lap and the gap to it;
- ECT and EOP: coolant temperature and oil pressure;
- gear, SPEED and FUEL (fuel used since leaving the pits);
- dots: throttle shape, brake bias, launch control (Start Limit) and your
  incidents;
- left of them, your iRating: in official races, the projected one if the
  race ended now (green gaining, red losing).
With push-to-pass active the screen turns green with "Overtake ON" and the
time left (red under 20 s); with the pit limiter on it flashes orange
"PIT LIMIT".
With the Start Limit armed, the sides turn green with "START LIMIT ON". iRacing
doesn't report this state: in the panel (Road > Super Formula SF23 > Overlays), map
the same button as Traction Control Arm. It goes off at about 70 km/h, like the car.
It starts off: turn it on in the panel. Use it on a second monitor: a window on
top of the game in exclusive fullscreen can push iRacing into windowed mode. It
opens next to the app window, on the same monitor; you can drag it with the mouse.


OVAL: PIT-STOP SPRINGS
----------------------
On an oval, when you set the pit-stop fuel in the black box, the coach adds
what is already in the tank (and checks again when you enter the pit lane), says
the values and sets the LR and RR Spring Offset by itself (1/32 in. clicks),
using the 0 to 20 gallon table in the panel: each row has LR and RR with - and +
buttons, positive or negative. It starts as:
  20-18 gallons: LR +1, RR 0      11-10: LR +5, RR -5
  17-16: LR +2, RR -2             9-8:   LR +6, RR -6
  15-14: LR +3, RR -3             0-7 (short run): LR +10, RR -10
  13-12: LR +4, RR -4
For this, bind a keyboard key to each action in iRacing (Options > Controls >
Shocks & Springs) and press the same key under "Map" in the panel. Default,
with the number keys above the letters (not the numeric keypad):
- Left Spring Set: increase 0, decrease 7.
- Right Spring Set: increase 3, decrease 1.
The key replaces the wheel button for these two functions. The coach only
presses keys while iRacing is in front, and checks every click in the
telemetry. No AI needed.

On/off: the "Automatic adjustment" switch in the panel. "Map", next to it,
lets you pick a wheel button or a key that turns it on/off while iRacing is
in front (the coach confirms out loud). For one stop only, use "Skip this
stop" (also mappable to a wheel button or key: press to skip, press again to
undo) or say "skip springs" with the push-to-talk button. Once you leave pit
lane, it adjusts again.

Presets: you can keep several named tables (e.g. "A open Martinsville"). Pick
one in the "Preset" menu; to create one, type a name and click "Save as new"
(copies the current table). With the car on an oval, "Load automatically at
<track>" makes that preset load every time you join that track.

Sharing the table: "Export table" saves a .json file; whoever gets it uses
"Import table" (it becomes a new preset).


AUTOMATIC PRACTICE PLAN
-----------------------
In practice sessions, after 3 full laps of each run out of the pits, the coach picks
up to 3 turns that cost the most and works on one at a time: it tells you what to
do, measures every pass, and moves on only when your time drops or after 5 passes
with no progress. The other turns stay quiet. The target comes from your laps in that
run, so it works for any track, car and fuel load. There is no plan in races, and the
coach stays silent in qualifying.


AUTOMATIC BRAKE BIAS
--------------------
In the Road tab, under Super Formula SF23, the coach changes the brake bias by track section, following
your reference .ibt. Super Formula SF23 only. It starts off; when on, it works in every
session and never presses a key while you're braking. When you load an .ibt, the coach
tells you right away whether it works.

To use it:
1. Load an .ibt with at least 3 consecutive fast laps where the driver changes
   the brake bias. Without that there is no map and nothing happens.
2. In iRacing (Options > Controls), bind a Ctrl+Shift+key combination to Brake Bias
   "Increase value" and another to "Decrease value", for example Ctrl+Shift+A and
   Ctrl+Shift+S. A wheel button won't work: the coach can't press it, and the
   combination may replace the button for this function.
3. In the panel, under "Map", press on each row the combination bound under the same name.
4. Turn on "Automatic adjustment" or say "brake bias on" with the push-to-talk button.

Fine-tuning: in clicks, per section; saved per track and car. iRacing must be in
front. If a key doesn't change the bias, the coach stops and tells you.

Without an .ibt that has this data, enter the values by hand: on track, under "Enter
values", each row says from how many metres into the lap which bias applies, with as many
rows as the track needs. A manual map isn't replaced by a new .ibt; to use the .ibt again,
click "Delete manual map". "Export map" saves a file named after the track and car, which
another person opens with "Import map"; it applies to that track and car. For another track,
click "New track" and pick the track, without having to enter it. Maps stay saved:
in the card's "Track" menu, open any of them to view, edit or export. On track, the map for
the track and car you're in is always the one that applies.

WARNING: iRacing's rules ban automating real-time control inputs.
Use at your own risk.


PROBLEMS
--------
In the panel, under "Technical details", "Open data and logs folder" opens the folder with coach.log and
ouvir.log. Send those files along with a description of the problem.
