Recording Inputs and replaying them

Hey! I’m working on a rhythm game (guitar hero/tap tap style), and i want to make a function where the player can record notes to a track, and then play it later. Basically, i need to record the time the player spawns notes, and then replay it later. Is there any way to do this? (if there’s a simple way to do this in C++ then that would be appreciated too)