mod

Parameters

Parameter label

I/O type

Data type

Mandatory parameter?

Default value

inputVec

input

vector

yes

N/A

N

input

scalar

no

1

wrap

input

boolean

no

True

circDist

input

boolean

no

False

outputVec

output

vector

N/A

N/A

Functionality

Module performs element-wise modulo-by-N operation on input vector inputVec. If wrap is true, only positive values between 0 and N-1 are returned. If circDist is set to True the input values are interpreted as differences (mod N) and results in calculating the minimal distance “on the circle” if this difference to 0, giving values between 0 and (N-1)/2. For instance, consider the pitch classes 0 and 11. The formal differences are [11-0] = [11] and [0-11] = [-11] = [1], but the minimal distance is [1].

Here is a simple example:

inputVec = [0, 3, 5, 7]
N = 2
...
outputVec = [0, 1, 1, 1]

inputVec = [0, -3, 5, 7]
N = 2
wrap = False
...
outputVec = [0, -1, 1, 1]

inputVec = [0, -3, 5, 7]
N = 12
circDist = True
...
outputVec = [0, 3, 5, 5]