Minor, minor minor tuning based on running this for 10 minutes grinding 4 spears

I had a BPM calculator going for 10 minutes and it KNOWS we're in the 119.88 range, maybe a high 119.87 but probably closer to mid-.88
This commit is contained in:
2025-01-30 04:31:58 -06:00
parent d86f5dbfb3
commit 3cc391d210

View File

@@ -3,10 +3,10 @@ import argparse
import subprocess
import time
def ydotool(key, multiplier=1):
# This runs with a 100ms delay (by default, modulated by multiplier) because
def ydotool(key, delay=60, multiplier=1):
# This runs with a bit of a delay (by default, modulated by multiplier) because
# Patapon -- the game, not the emulator or the input layer -- will drop inputs
# if it's any lower.
# if it's too low.
subprocess.run([
"ydotool",
"key",
@@ -60,15 +60,17 @@ def main():
parser.add_argument('song',default="R-R-L-R-",nargs="+",choices=songs,help="The song to play. Defaults to Aria of Attack. When expressing a song, use eighth notes, dashes, and cardinal directions to designate the drums. For example, party would be \"L-R-D-U-\", and djinn would be \"D-DD-DD-\"")
parser.add_argument('--bpm',type=float,default=1,help="Multiplier for the BPM. Change if you're running the game at a higher speed")
parser.add_argument('--iterations',type=int,default=10000,help="Number of iterations of the sequence to run. Defaults to 10,000")
parser.add_argument('--key-delay',type=int,default=60,help="Number of milliseconds to hold each key down for. Defaults to 100. Tune if you're getting dropped inputs or if the program can't keep up")
args = parser.parse_args()
# Schedule out our beat interval
# 120.000 Naiive, does not work
# 119.905 Still fast
# 119.900 Still fast
# 119.890
# 119.890 Just baaaaarely too fast
# 119.880
# 119.000 Wicked slow, outpaces in like 4 measures
bpm_constant = 119.890
bpm_constant = 119.880
beat_interval = 60 / (bpm_constant * args.bpm * 2)
print(f"Beat interval: {beat_interval}")
@@ -90,7 +92,7 @@ def main():
lastbeat += beat_interval
button = keymapping.get(key, '-')
if button != '-':
ydotool(button, multiplier=args.bpm)
ydotool(key=button, delay=args.key_delay, multiplier=args.bpm)
print(drummapping.get(key, '-'), end="", flush=True)
else:
print(" ", end="", flush=True)