Quantising is basically taking notes that have undesired timing variations, and aligning their timing with a particular ‘grid’. Not as important in this case, so ignore that concept here.
Anyway, there is an example that may be similar to what you are interested in, described in that topic, by Robin - with video and a link to code. Have a look and see if it’s closer to what you’re thinking.
See: