Automate piano playing in the Heartopia game! This tool reads note files and simulates keyboard inputs, letting you play songs automatically without manual key presses.
- Automatic piano performance using keyboard simulation
- Adjustable
tempo/speedsettings - Supports multiple song files
- Hotkey controls for easy operation
(F3, F4, ESC) - Real-time progress bar to track playback
- Quickly switch songs without restarting the program
- Python
3.6or higher (recommended:3.10.11) - Windows OS (relies on
pydirectinputfor keyboard simulation)
You can get song note files from anywebsite just download a MIDI file, make sure it Piano and convert it ask txt use convert.py
- Download this project as a ZIP (
Code → Download ZIP) - Extract it to a convenient location, e.g.:
C:\\Users\\YourName\\Desktop\\htp-piano - Remember this folder location—it will be used later
- Open Command Prompt in the project folder:
- Navigate to the folder or type the path in Explorer and type
cmdin the address bar
- Navigate to the folder or type the path in Explorer and type
- Install required Python packages:
```bash pip install -r requirements.txt ```
The program needs a folder named note to store music files.
- Option 1 (Command Prompt):
```bash mkdir note ```
- Option 2 (Windows Explorer):
Right-click → New → Folder → Name itnote
- Copy your downloaded
.midfiles to theprojectfolder - convert
.midusing convert.py totxt - run
main.pyafter converted
Tip: Enable “File name extensions” in Windows Explorer to rename file types easily
- Open your project folder
- Double-click
main.pyto run - Type the number of the song you want to play and press Enter
- Open Command Prompt as Administrator
- Navigate to your project folder, e.g.:
```bash cd /d C:\Users\YourName\Desktop\htp-piano ```
- Run the program:
```bash python main.py ```
- Select your song by typing its number and pressing Enter
- Open the Heartopia game and ensure the game window is active
- Press F4 to start playing
- You have 3 seconds to switch to the game window after pressing F4
- The program will automatically play the song for you
- F3 – Open song selection menu
- F4 – Start / Stop playback (toggle)
- ESC – Exit the program completely