A Godot-based application for testing audio latency by synchronizing key presses with a rhythmic beat.
This application helps you measure your ability to synchronize with a consistent audio beat, providing an indication of the overall latency you experience with your audio setup (headphones, sound card, system processing) and your own reaction time.
It plays a click sound at a user-configurable Beats Per Minute (BPM) and measures the time difference between your key presses (spacebar) and the nearest click sound.
- Rhythmic Testing: Plays continuous clicks at a specified BPM (default 120).
- User Synchronization: You press any letter key (A-Z) in time with the beeps.
- Rolling Average Latency: Calculates and displays the average latency of your last 15 clicks.
- Real-time Feedback: Shows the latency of your most recent click relative to the beat.
- Adjustable BPM: The BPM can be changed in the Godot editor inspector for the Main node.
- Results Export: Save the series of recorded latencies to a text file.
- Open in Godot: Open this project in the Godot Engine (version 4.x recommended).
- Run the Main Scene: Run the
Main.tscn
scene. (Optional) Adjust BPM: - Select the
Main
node in the scene tree. - In the Inspector panel, you can change the
Bpm
property. - Restart the scene if you change the BPM while it's running for it to take full effect (or stop and start the metronome).
- Select the
- Start the Metronome: Click the "Start Metronome" button.
- Synchronize: Listen to the clicks and press any letter key (A-Z) in time with the rhythm.
- Observe Latency:
- The "Avg. Latency" display shows the average difference between your presses and the beeps over the last 15 clicks.
- The "Last click" display shows the latency of your most recent press. A positive value means you pressed after the beep, a negative value means you pressed before.
- Stop the Metronome: Click "Stop Metronome" to pause the test.
- Clear History: Click "Clear History" to reset the recorded latencies.
- Save Results:
- After stopping the metronome (or while it's stopped), if you have recorded some latencies, you can click "Save Results".
- This saves the list of individual latencies from the current session to a file named
rhythmic_latency_results.txt
in your Godot project'suser://
directory (e.g.,C:/Users/YourUser/AppData/Roaming/Godot/app_userdata/YourProjectName
).
- Average Latency: This gives you a general idea of how consistently early or late you are pressing the key relative to the beat. A value close to 0 ms is ideal, indicating good synchronization.
- Individual Click Latency ("Last click"):
- Positive values: You pressed after the beep.
- Negative values: You pressed before the beep.
- This can help you understand if you have a tendency to lead or follow the beat.
- Consistency: Look at the spread of your individual latencies (which you can see in the saved file). Small variations mean you are more consistent.
Low and consistent latency values generally indicate a good audio setup and/or good rhythmic accuracy. High or inconsistent values might point to issues with audio drivers, Bluetooth latency, system load, or simply needing more practice with the rhythm.
Main.tscn
: The main scene for the application.Main.gd
: The core script handling the test logic, audio playback, and UI.project.godot
: The Godot project file.README.md
: This file.generate_click.gd
: A utility script (not run directly by the app) that was used to conceptualize click generation. It's not essential for the app's runtime but shows how the click sound is structured. (Consider removing or clarifying its role if it's confusing).
- Ensure your system audio is working correctly.
- For best results, use wired headphones to minimize Bluetooth latency.
- Other applications running in the background might affect system performance and audio latency.
- The
MAX_BEEP_HISTORY
constant inMain.gd
determines how many past beeps are stored to find the "closest" beep to your key press. This helps account for slightly early or late presses.
latency-test/
├── Main.tscn # Main scene with UI layout
├── Main.gd # Core application logic
├── generate_click.gd # Tool script for audio generation (optional)
├── project.godot # Godot project configuration
└── README.md # This file
- Godot 4.4 or later
- Audio output device (headphones recommended)
- Keyboard for letter key input (A-Z)
- Open the project in Godot Engine
- Press F5 or click "Play" to run the application
- The main scene should load automatically
You can modify the following parameters in Main.gd
:
total_tests
: Number of tests to run (default: 10)frequency
: Click sound frequency in Hz (default: 2000)duration
: Click sound duration in seconds (default: 0.05)- Timer ranges for random intervals between tests
Feel free to submit issues, feature requests, or improvements to this latency testing application.
This project is open source and available under the MIT License.