| fpunique | R Documentation |
Working with scales in continuous pitch space, many pitches and intervals
are irrationals represented as floating point numbers. This can cause
arithmetic and rounding errors, leading to it looking like there are
more distinct pitches/intervals in the set than there really are. Use
fpunique rather than base::unique() whenever you handle scales in continuous
pitch space.
fpunique(x, MARGIN = 0, rounder = 10)
x |
Numeric array whose unique elements are to be determined |
MARGIN |
Numeric |
rounder |
Numeric (expected integer), defaults to |
Sometimes you may need to adjust the tolerance (rounder) to get correct
results, especially if you have done several operations in a row which
may have introduced rounding errors.
Numeric array of unique elements (vector if MARGIN is 0;
matrix otherwise)
just_dia <- j(dia)
intervals_in_just_dia <- sort(as.vector(sim(just_dia)))
failed_unique_intervals <- unique(intervals_in_just_dia)
fpunique_intervals <- fpunique(intervals_in_just_dia)
length(failed_unique_intervals)
length(fpunique_intervals)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.