Functions for data cleaning. tmp_rectify
is a general function to
rectify a set of tempo harmonics in a sequence given some reference.
tmp_rectify_tsig
and tmp_smooth
are wrappers around the latter
to rectify a specific set of tempo harmonics given a time signature and to
smooth a sequence of tempi respectively. The function tmp_prevalent
is intended to find the most prevalent tempo in a sequence of tempi.
Usage
tmp_rectify(x, ref, harmonics, rtol, rtol2 = rtol, cond = any)
tmp_rectify_tsig(x, ref, tsig, rtol = 0.15, rtol2 = rtol)
tmp_smooth(x, ref, tsig, rtol = 0.1, rtol2 = rtol, ref2 = 1, nref = 3)
tmp_prevalent(x, breaks = 30)
Arguments
- x
a sequence of tempi.
- ref
tempo reference(s) for the harmonics.
- harmonics
set of tempo harmonics to rectify.
- rtol, rtol2
ratios of tolerance to compute the bounds and determine whether a given tempo is a harmonic of
ref
.rtol2
can be specified to implement asymmetric bounds; otherwise, they are symmetric.- cond
condition to apply the correction.
- tsig
time signature. Notably, this function distinguishes between binary time signatures (specified by
2
), time signatures with ternary subdivision (specified by0.3
).- ref2
additional tempo harmonic to consider.
- nref
number of previous samples to take into account.
- breaks
number of breaks to compute the histogram.