get

Time# get

A collection of functions manipulates an input

Methods

# (static) beat(array) → {Array.<Number>}

Returns an array of arrays representing different sized beats coalescing with the pattern.

Parameters:
Name Type Description
array Array.<Number>

A beat pattern

Source:
Returns:

An ordered array showing as tuples [beat_size,number_of_alignments]

Type
Array.<Number>
Example
let time = new Time()
time.get.beat([2,4,4,4,4,4,4,4])
//returns
[
 [ 2, 8 ], //a beat of size 2 aligns with the pattern 8 times (every element in the pattern falls on a beat)
 [ 4, 7 ], //a beat of size 4 aligns with the pattern 7 times (in this case, all the elements align if the first element is seen as a pickup)
 [ 3, 3 ] //a beat of size 3 aligns with the pattern 3 times
]

# (static) counterpoint_cycle(patterns) → {Array.<Array.<Number>>}

Returns a binary representation of ONE complete cycle of all given beat patterns

Parameters:
Name Type Description
patterns ...Array.<Number> | Number

beat patterns as arrays or integers seperated by commas.

Source:
Returns:

Returns a binary representation of ONE complete cycle of all given beat patterns

Type
Array.<Array.<Number>>
Example
let time = new Time()
time.get.counterpoint_cycle([1,1,2],3)
//returns
[1,1,1,0,1,1,1,0,1,1,1,0]
[1,0,0,1,0,0,1,0,0,1,0,0]

time.get.counterpoint_cycle([1,2,1,3,1],[3,1])
//returns
[1,1,0,1,1,0,0,1]
[1,0,0,1,1,0,0,1]

# (static) explicit(arrays) → {Array.<String>}

Returns the position of every subdivision of a given beat(s).

Parameters:
Name Type Description
arrays Array.<Number>

Any number of beat patterns separated by commas.

Source:
Returns:

The flushing out of each pattern into its subdivisional representation.

Type
Array.<String>
Example
let time = new Time()
let sub = time.get.subdivisions(12) //get all subdivisions of 12 beats
let rhythms = time.get.explicit(...sub)
rhythms.forEach(r=>console.log(r))
//returns
 "2  .  2  .  2  .  2  .  2  .  2  . "
 "2  .  2  .  2  .  3  .  .  3  .  . "
 "2  .  2  .  3  .  .  2  .  3  .  . "
 "3  .  .  3  .  .  3  .  .  3  .  . "

# (static) fractal(base, iteration) → {Array.<Number>}

Multiplies each element in the basewith the entire base, iteration times.

Parameters:
Name Type Description
base Number

some rhythmic cell

iteration Number

The amount of times to apply the algorithms to the cell

Source:
Returns:

The fractal

Type
Array.<Number>
Example
let time = new Time()
time.get.fractal([2,4,3],1)
//returns [2, 4, 3]

time.get.fractal([2,4,3],2)
//returns [4, 8,  6, 8, 16, 12, 6, 12, 9]

time.get.fractal([2,4,3],3)
//returns
[8, 16, 12, 16, 32, 24, 12, 24,
 18, 16, 32, 24, 32, 64, 48, 24,
 48, 36, 12, 24, 18, 24, 48, 36,
 18, 36, 27]

# (static) motives(array, maximal_lengthopt, show_singularsopt) → {Array.<Object>}

Returns the rhythmic motives as they appear verbatim, from most common to least common.

Parameters:
Name Type Attributes Default Description
array Array.<Number>

A beat pattern

maximal_length Number <optional>
8

The maximal motive length to be searched

show_singulars Boolean <optional>
false

Whether to show "motives" that appear only once.

Source:
Returns:

motive:[an array with the motive], incidence: the number of times that motive appears in the input

Type
Array.<Object>
Example
let time = new Time()
time.get.motives([2,2,4,2,2,4,3,3,6,3])
//returns
[
   { motive: [ 2, 2, 4 ], incidence: 2 }
   { motive: [ 2, 2 ], incidence: 2 },
   { motive: [ 2, 4 ], incidence: 2 }
]

# (static) ratios(base_ratio, max_ratio) → {Object}

returns the ratios to a max_ratio from a given base_ratio.

Parameters:
Name Type Description
base_ratio Number

The number to be used as a baseline (=:1)

max_ratio Number

The maximal ratio to be returned

Source:
Returns:

A list of ratios given the base_ratio

Type
Object
Example
let time = new Time()
time.get.ratios(110,3)
//returns { '1': 110, '2': 220, '3': 330, '1/2': 55, '1/3': 36.666666666666664 }

# (static) relational_motives(array, maximal_lengthopt, show_singularsopt) → {Array.<Object>}

Returns the rhythmic motives in terms of relationships (rather than verbatim durations like in Time.get.motives ), from most common to least common.

Parameters:
Name Type Attributes Default Description
array Array.<Number>

A beat pattern

maximal_length Number <optional>
8

The maximal motive length to be searched

show_singulars Boolean <optional>
false

Whether to show "motives" that appear only once.

Source:
Returns:

motive:[an array with the motive], incidence: the number of times that motive appears in the input

Type
Array.<Object>
Example
let time = new Time()
time.get.relational_motives([2,2,4,2,2,4,3,3,6,3])
//returns
[
 { motive: [ 1, 2 ], incidence: 3, position: [ 0, 3, 6 ] }, //motive of duration=[same,double] appears 3 times, at positions 0, 3, and 6 of the original input
 { motive: [ 1, 2, 0.5 ], incidence: 2, position: [ 0, 6 ] }, //motive of duration=[same,double,half] appears 2 times, at positions 0, and 6 of the original input
 { motive: [ 2, 0.5 ], incidence: 2, position: [ 1, 7 ] } //motive of duration=[double,half] appears 2 times, at positions 1, and 7 of the original input
]

# (static) repeated(pattern, times)

Returns the rhythmic motives as they appear verbatim, from most common to least common.

Parameters:
Name Type Description
pattern Array.<Number>

The pattern to be repeated

times Number

The number of times to repeat

Source:
Returns:

The pattern repeating

Example
let time = new Time()
time.get.repeated([2,1,1],3) // returns  [2,1,1,2,1,1,2,1,1]

# (static) subdivisions(num_of_beats, minimal_subdivision, maximal_subdivision) → {Array.<Array.<Number>>}

Get all unique subdivisions of a given num_of_beats, without their rotations.

Parameters:
Name Type Description
num_of_beats Number

The amount of beats to subdivide

minimal_subdivision Number

The smallest allowed subdivision (the returned result will not include subdivisions smaller than this value)

maximal_subdivision Number

The largest allowed subdivision (the returned result will not include subdivisions larger than this value)

Source:
Returns:

All possible subdivisions.

Type
Array.<Array.<Number>>
Example
let time = new Time()
time.get.subdivisions(12,2,3)
//returns
[
 [ 2, 2, 2, 2, 2, 2 ],
 [ 2, 2, 2, 3, 3 ],
 [ 2, 2, 3, 2, 3 ],
 [ 3, 3, 3, 3 ]
]