BPM to milliseconds
A quarter note in milliseconds is 60,000 divided by the tempo. At 128 BPM that is 468.75 ms, an eighth is 234.375 ms, and a sixteenth 117.19 ms. Going the other way, 60,000 divided by the millisecond length gives the tempo.
How to convert between tempo and milliseconds
Sample counts matter once you are trimming loops rather than setting effects. At 44.1 kHz, one millisecond is 44.1 samples, so a 500 ms beat is 22,050 samples exactly — which is why 120 BPM loops slice cleanly at that sample rate and awkward tempos do not. A loop cut a few samples short accumulates drift over repeats, audible as a gradual slide against a grid.
Questions
Divide 60,000 by the tempo for a quarter note; halve it for an eighth, and so on.
Divide 60,000 by the millisecond length of a quarter note.
At 44.1 kHz, the millisecond length times 44.1. A 500 ms beat is 22,050 samples.
It has been cut a few samples short or long. Over many repeats the error accumulates against the grid.
468.75 ms per quarter note, 234.375 per eighth.