Measuring "regularity" of musical timing Apologies if the term regularity is improper, I cannot find what the actual term I am looking for is.
I'm looking for a method for calculating how "regular" rhythms are for musical notes.
Although, more generally, I'm looking for a method for calculating how "regular" the gaps are between numerical values.
I have data in the form of an array, which contains the milisecond occurences of the notes, i.e.
[1000, 2000, 3000, 4000, 4500, 5000]

I have tried (unsuccessfully) methods such as getting the difference in time between a note and the next note, then calculating the standard deviation of that data.
However, this produces nonsense answers, especially in cases where there are breaks, for example.
[1000, 10000, 11000, 12000] // 2178.013025842761
[1000, 1333, 1500, 1666, 2000] // 73.030815413769

So this is definitely not the way about it.
In the top example, all of the deltas share common multiples. However, in the bottom example, significantly less do.
I'm asking as I'm wondering if there is some statistical term for the measurement I am looking for, and also if there are any solutions to this problem (perhaps involving common multiples).
I do not have a very advanced background in statistics, and what I'm asking for could be completely incoherent. Apologies, and thanks in advance.
 A: You can compute the differences of time between all your notes, then your problem is to see whether your data is very spread out or not while ignoring the very big time intervals (outliers) caused by pauses. Then, what you want is to compute a robust estimator of spread and for example, to do that, an easy way is to use a trimmed standard deviation : you take out the extremal 5% (or more) of the data (that will correspond to the pauses) and then you compute the standard deviation of the rest. This way you threshold your data but in an adaptive manner.
EDIT : you can also look toward the  discrepency of a sequence, see also low discrepancy sequence, this is a completely deterministic measure of regularity and maybe this is more adequate for what you want.
A: To be frank I am still not very clear about your data but here are some points that you may find helpful:
Your data is a time series, call it $X_t$.

*

*First identify the random variable(s) of interest. Your question seems to suggest that the time lapse between notes has some randomness and you probably want get some sense of measure of the spread of this/these random variable(s).


*So the variable of interest is $\Delta X_t := X_t-X_{t-1}$. At this point, knowing your data you should think whether you from theory expect $\Delta X_t$ to be independent and identically distributed random variables, or distinct RVs correlated to each other in some way. For example, you may be expecting a pattern that after every 4 time lapses the fifth time lapse should be more or less same as the first one or uou may not expecting a pattern at all and expect that each of the time interval should be more or less same (i.e. independent).


*Strictly speaking you can skip the above step and simple model the time series, $Z_t=\Delta X_t$. For example ARIMA modeling or spectrum estimation. But step 2 can help you save time.
Measuring regularity:
If $Z_t$ is indeed i.i.d., then sd is a good measure. Smaller the sd, more closer (amd thus regular) are the time elapses between notes.
If not, then the autocovariance function plots or the periodogram may be more insightful for checking regularity.
Hope this helps.  If not better to paste the plot of $Z_t$ here for our understanding.
