Programming basics for rhythm game note tracks?

I want to learn about the creation of rhythm track games. In particular, a song plays and a beatmap formatted by note timings plays. There are notes to press and notes that you just hold. I analyzed source code for RoBeats and it’s still hard to really see how it all goes together. I gathered one fact which is that they lerp a pressing note from A to B using a calculation.

I plan to create “classes” (modules) of the notes to better organize and structure the code as well.

What I really need is how to setup the note track system entirely, starting from one track to have the two different kinds of notes, one for press and one for holding. I want to be able to record user input to see if the player has pressed or held the note relevant to what they’re inputting.

One thing I worry about is how can I record a note press or has finished its holding duration. Should I use collision detection with the notes? Is there some way I can calculate when a note passes in a specific spot that allows the player to press/hold to register it?

I already know the API of UserInputService and Audio instances. I just want the programming gist. Anyone familiar with programming a rhythm track game can help?

If code examples are possible, that is nice. I don’t want the entire thing coded out for me but I just like to see an example to get the point if you can.


Feel free to provide any resources if it can help me at least a bit with my question.

Well maybe something like this?
also if you want to calculate the lerp position
alpha value thingy
(RunTime / (NoteTime+NoteSpeed))

local RunService = game:GetService("RunService")
local map = {{Time=500};{Time=2000};{Time=5000};{Time=6666};}

function startGame()
local runTime = 0
local updateTime
updateTime = RunService.RenderStepped:Connect(function(deltaTime)
runTime = runTime + deltaTime
for i,v in pairs(map) do
if v.Time >= runTime then
--Spawn note
end
end
end)
end

That is a rough idea I had, but that is about only 5% of the process. The way the beatmap is formatted is similar to Robeats/osu so it isn’t wrong.

That is the way to detect when a note should be able to spawn, but yeah I got that down.

I calculate lerp for notes through this:
(currentTime - creationTime) / (timeForNoteToPress - creationTime)
(timeForNoteToPress is what v.Time would be in your code)
(creationTime is when the note is spawned in)
(clamp result between 0 and 1)

Even though I have that down and notes move correctly, the rest is just a bit difficult now.

I have made something like that before, you can take a look maybe you’ll know how
https://www.roblox.com/games/6765929777/rhythm-thing
i just made it uncopylocked
sorry messy scripts lol