rsc3/doc-schelp/HelpSource/Classes/SequenceableCollection.schelp

698 lines
23 KiB
Text
Raw Permalink Normal View History

2022-08-24 13:53:18 +00:00
CLASS::SequenceableCollection
summary::Abstract superclass of integer indexable collections
categories::Collections>Ordered
DESCRIPTION::
SequenceableCollection is a subclass of Collection whose elements can be indexed by an Integer. It has many useful subclasses; link::Classes/Array:: and link::Classes/List:: are amongst the most commonly used.
CLASSMETHODS::
copymethod:: Collection *fill
method::series
Fill a SequenceableCollection with an arithmetic series.
code::
Array.series(5, 10, 2);
::
method::geom
Fill a SequenceableCollection with a geometric series.
code::
Array.geom(5, 1, 3);
::
method::fib
Fill a SequenceableCollection with a fibonacci series.
code::
Array.fib(5);
Array.fib(5, 2, 32); // start from 32 with step 2.
::
argument::size
the number of values in the collection
argument::a
the starting step value
argument::b
the starting value
method::rand
Fill a SequenceableCollection with random values in the range strong::minVal:: to strong::maxVal::.
code::
Array.rand(8, 1, 100);
::
method::rand2
Fill a SequenceableCollection with random values in the range -strong::val:: to +strong::val::.
code::
Array.rand2(8, 100);
::
method::linrand
Fill a SequenceableCollection with random values in the range strong::minVal:: to strong::maxVal:: with a linear distribution.
code::
Array.linrand(8, 1, 100);
::
method::exprand
Fill a SequenceableCollection with random values in the range strong::minVal:: to strong::maxVal:: with exponential distribution.
code::
Array.exprand(8, 1, 100);
::
method::interpolation
Fill a SequenceableCollection with the interpolated values between the strong::start:: and strong::end:: values.
code::
Array.interpolation(5, 3.2, 20.5);
::
INSTANCEMETHODS::
method::|@|
synonym for link::Classes/ArrayedCollection#-clipAt::.
code::
[3, 4, 5]|@|6;
::
method::@@
synonym for link::Classes/ArrayedCollection#-wrapAt::.
code::
[3, 4, 5]@@6;
[3, 4, 5]@@ -1;
[3, 4, 5]@@[6, 8]
::
method::@|@
synonym for link::Classes/ArrayedCollection#-foldAt::.
code::
[3, 4, 5]@|@[6, 8];
::
method::first
Return the first element of the collection.
code::
[3, 4, 5].first;
::
method::last
Return the last element of the collection.
code::
[3, 4, 5].last;
::
method::putFirst, putLast
Place strong::item:: at the first / last index in the collection. Note that if the collection is empty (and therefore has no indexed slots) the item will not be added.
code::
[3, 4, 5].putFirst(100);
[3, 4, 5].putLast(100);
::
method::indexOf
Return the index of an strong::item:: in the collection, or nil if not found.
code::
[3, 4, 100, 5].indexOf(100);
[3, 4, \foo, \bar].indexOf(\foo);
::
method::indexOfEqual
Return the index of something in the collection that equals the strong::item::, or nil if not found.
code::
[3, 4, "foo", "bar"].indexOfEqual("foo");
::
method::indicesOfEqual
Return an array of indices of things in the collection that equal the strong::item::, or nil if not found.
code::
y = [7, 8, 7, 6, 5, 6, 7, 6, 7, 8, 9];
y.indicesOfEqual(7);
y.indicesOfEqual(5);
::
method::indexOfGreaterThan
Return the first index containing an strong::item:: which is greater than strong::item::.
code::
y = List[ 10, 5, 77, 55, 12, 123];
y.indexOfGreaterThan(70);
::
method::selectIndices
Return a new collection of same type as receiver which consists of all indices of those elements of the receiver for which function answers code::true::. The function is passed two arguments, the item and an integer index.
code::
#[a, b, c, g, h, h, j, h].selectIndices({|item, i| item === \h})
::
If you want to control what type of collection is returned, use link::#-selectIndicesAs::
method::selectIndicesAs
Return a new collection of type emphasis::class:: which consists of all indices of those elements of the receiver for which function answers code::true::. The function is passed two arguments, the item and an integer index.
code::
#[a, b, c, g, h, h, j, h].selectIndicesAs({|item, i| item === \h}, Set)
::
method::rejectIndices
Return a new collection of same type as receiver which consists of all indices of those elements of the receiver for which function answers code::false::. The function is passed two arguments, the item and an integer index.
code::
#[a, b, c, g, h, h, j, h].rejectIndices({|item, i| item === \h})
::
If you want to control what type of collection is returned, use link::#-rejectIndicesAs::
method::rejectIndicesAs
Return a new collection of type emphasis::class:: which consists of all indices of those elements of the receiver for which function answers code::false::. The function is passed two arguments, the item and an integer index.
code::
#[a, b, c, g, h, h, j, h].rejectIndicesAs({|item, i| item === \h}, Set)
::
copymethod:: Collection -maxIndex
copymethod:: Collection -minIndex
method::find
If the strong::sublist:: exists in the receiver (in the specified order), at an offset greater than or equal to the initial strong::offset::, then return the starting index.
code::
y = [7, 8, 7, 6, 5, 6, 7, 6, 7, 8, 9];
y.find([7, 6, 5]);
::
method::findAll
Similar to link::#-find:: but returns an array of all the indices at which the sequence is found.
code::
y = [7, 8, 7, 6, 5, 6, 7, 6, 7, 8, 9];
y.findAll([7, 6]);
::
method::indexIn
Returns the closest index of the value in the collection (collection must be sorted).
code::
[2, 3, 5, 6].indexIn(5.2);
::
method::indexInBetween
Returns a linearly interpolated float index for the value (collection must be sorted). Inverse operation is link::#-blendAt::.
code::
x = [2, 3, 5, 6].indexInBetween(5.2);
[2, 3, 5, 6].blendAt(x);
::
method::blendAt
Returns a linearly interpolated value between the two closest indices. Inverse operation is link::#-indexInBetween::.
code::
x = [2, 5, 6].blendAt(0.4);
::
method::copyRange
Return a new SequenceableCollection which is a copy of the indexed slots of the receiver from strong::start:: to strong::end::. If strong::end:: < strong::start::, an empty collection is returned.
code::
(
var y, z;
z = [1, 2, 3, 4, 5];
y = z.copyRange(1, 3);
z.postln;
y.postln;
)
::
warning:: code::x.copyRange(a, b):: is strong::not:: equivalent to code::x[a..b]::. The latter compiles to link::Classes/ArrayedCollection#-copySeries::, which has different behavior when strong::end:: < strong::start::. ::
method::copyToEnd
Return a new SequenceableCollection which is a copy of the indexed slots of the receiver from strong::start:: to the end of the collection.
code::x.copyToEnd(a):: can also be written as code::x[a..]::
method::copyFromStart
Return a new SequenceableCollection which is a copy of the indexed slots of the receiver from the start of the collection to strong::end::.
code::x.copyFromStart(a):: can also be written as code::x[..a]::
method::remove
Remove strong::item:: from collection.
method::take
Remove and return strong::item:: from collection. The last item in the collection will move to occupy the vacated slot (and the collection size decreases by one). See also takeAt, defined for link::Classes/ArrayedCollection#-takeAt::.
code::
a = [11, 12, 13, 14, 15];
a.take(12);
a;
::
method::obtain
Retrieve an element from a given index (like link::Classes/SequenceableCollection#-at::). This method is also implemented in link::Classes/Object::, so that you can use it in situations where you don't want to know if the receiver is a collection or not. See also: link::Classes/SequenceableCollection#-instill::
argument::index
The index at which to look for an element
argument::default
If index exceeds collection size, or receiver is nil, return this instead
code::
(
a = [10, 20, 30];
b = [10, 20];
c = 7;
);
// obtain third element, if outside bounds return 1
a.obtain(2, 1);
b.obtain(2, 1);
c.obtain(2, 1);
::
method::instill
Put an element at a given index (like link::Classes/SequenceableCollection#-put::). This method is also implemented in link::Classes/Object::, so that you can use it in situations where you don't want to know if the receiver is a collection or not. It will always return a new collection. See also: link::Classes/SequenceableCollection#-obtain::
argument::index
The index at which to put the item
argument::item
The object to put into the new collection
argument::default
If the index exceeds the current collection's size, extend the collection with this element
code::
(
a = [10, 20, 30, 40];
b = [10, 20];
c = 7;
);
a.instill(2, -1);
b.instill(2, -1);
c.instill(2, -1);
// providing a default value
c.instill(2, -1, 0);
::
method::keep
Keep the first strong::n:: items of the array. If strong::n:: is negative, keep the last -strong::n:: items.
code::
a = [1, 2, 3, 4, 5];
a.keep(3);
a.keep(-3);
::
method::drop
Drop the first strong::n:: items of the array. If strong::n:: is negative, drop the last -strong::n:: items.
code::
a = [1, 2, 3, 4, 5];
a.drop(3);
a.drop(-3);
::
method::join
Returns a link::Classes/String:: formed by connecting all the elements of the receiver, with strong::joiner:: inbetween. See also link::Classes/String#-split:: as the complementary operation.
code::
["m", "ss", "ss", "pp", ""].join("i").postcs;
"mississippi".split("i").postcs;
::
method::flat
Returns a collection from which all nesting has been flattened.
code::
[[1, 2, 3], [[4, 5], [[6]]]].flat; // [ 1, 2, 3, 4, 5, 6 ]
[1, 2, [3, 4, [5, 6, [7, 8, [9, 0]]]]].flat; // [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 ]
::
method::flatten
Returns a collection from which strong::numLevels:: of nesting has been flattened.
argument::numLevels
Specifies how many levels downward (inward) to flatten. Zero returns the original.
code::
a = [1, 2, [3, 4, [5, 6, [7, 8, [9, 0]]]]];
a.flatten(1); // [ 1, 2, [ 3, 4, [ 5, 6, [ 7, 8, [ 9, 0 ] ] ] ] ]
a.flatten(2); // [ 1, 2, 3, 4, 5, 6, [ 7, 8, [ 9, 0 ] ] ]
a.flatten(3); // [ 1, 2, 3, 4, 5, 6, 7, 8, [ 9, 0 ] ]
a.flatten(4); // [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 ]
::
method::flatten2
A symmetric version of link::#-flatten::. For a negative code::numLevels::, it flattens starting from the innermost arrays.
argument::numLevels
Specifies how many levels downward (inward) or upward (outward) to flatten.
code::
a = [1, 2, [3, 4, [5, 6, [7, 8, [9, 0]]]]];
a.flatten2(4); // [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 ]
a.flatten2(3); // [ 1, 2, 3, 4, 5, 6, 7, 8, [ 9, 0 ] ]
a.flatten2(2); // [ 1, 2, 3, 4, 5, 6, [ 7, 8, [ 9, 0 ] ] ]
a.flatten2(1); // [ 1, 2, 3, 4, [ 5, 6, [ 7, 8, [ 9, 0 ] ] ] ]
a.flatten2(0); // [ 1, 2, [ 3, 4, [ 5, 6, [ 7, 8, [ 9, 0 ] ] ] ] ]
a.flatten2(-1); // [ 1, 2, [ 3, 4, [ 5, 6, [ 7, 8, 9, 0 ] ] ] ]
a.flatten2(-2); // [ 1, 2, [ 3, 4, [ 5, 6, 7, 8, 9, 0 ] ] ]
a.flatten2(-3); // [ 1, 2, [ 3, 4, 5, 6, 7, 8, 9, 0 ] ]
a.flatten2(-4); // [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 ]
::
method::flatBelow
Flatten all subarrays deeper than strong::level::.
argument::level
Specifies from what level onward to flatten.
level 0 is outermost, so flatBelow(0) is like flat.
code::
a = [1, 2, [3, 4, [5, 6, [7, 8, [9, 0]]]]];
a.flatBelow(0); // [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 ]
a.flatBelow(1); // [ 1, 2, [ 3, 4, 5, 6, 7, 8, 9, 0 ] ]
a.flatBelow(2); // [ 1, 2, [ 3, 4, [ 5, 6, 7, 8, 9, 0 ] ] ]
// to set the level below which to flatten from the deepest level up,
// one can use coll.maxDepth. E.g. to flatten only the innermost level:
a.flatBelow( (a.maxDepth - 1) - 1);
// for lowest two levels:
a.flatBelow( (a.maxDepth - 1) - 2);
::
method::flop
Invert rows and columns in a two dimensional Collection (turn inside out). See also: link::Classes/Function::.
code::
[[1, 2, 3], [4, 5, 6]].flop;
[[1, 2, 3], [4, 5, 6], [7, 8]].flop; // shorter array wraps
[].flop; // result is always 2-d.
::
Note that the innermost arrays are not copied:
code::
a = [1, 2];
x = [[[a, 5], [a, 10]], [[a, 50, 60]]].flop;
a[0] = pi;
x // pi is everywhere
::
method::flopWith
Flop with a user defined function. Can be used to collect over several collections in parallel.
code::
[[1, 2, 3], [4, 5, 6]].flopWith(_+_);
[[1, 2, 3], 1, [7, 8]].flopWith{ |a,b,c| a+b+c }; // shorter array wraps
// typical use case (pseudocode)
[synths, buffers].flopWith{ |a,b| a.set(\buf, b) }
::
argument::func
A function taking as many arguments as elements in the array.
method::flopTogether
Invert rows and columns in a an array of dimensional Collections (turn inside out), so that they all match up in size, but remain separated.
code::
(
a = flopTogether(
[[1, 2, 3], [4, 5, 6, 7, 8]] * 100,
[[1, 2, 3], [4, 5, 6], [7, 8]],
[1000]
)
);
a.collect(_.size); // sizes are the same
a.collect(_.shape) // shapes can be different
::
method::flopDeep
Fold dimensions in a multi-dimensional Collection (turn inside out).
argument::rank
The depth (dimension) from which the array is inverted inside-out.
code::
[[1, 2, 3], [[41, 52], 5, 6]].flopDeep(2);
[[1, 2, 3], [[41, 52], 5, 6]].flopDeep(1);
[[1, 2, 3], [[41, 52], 5, 6]].flopDeep(0);
[[1, 2, 3], [[41, 52], 5, 6]].flopDeep; // without argument, flop from the deepest level
[[[10, 100, 1000], 2, 3], [[41, 52], 5, 6]].flopDeep(2); // shorter array wraps
[].flopDeep(1); // result is always one dimension higher.
[[]].flopDeep(4);
::
note::Note that, just like in flop, the innermost arrays (deeper than rank) are not copied.::
code::
a = [1, 2];
x = [[[a, 5], [a, 10]], [[a, 50, 60]]].flopDeep(1);
a[0] = pi;
x // pi is everywhere
::
method::maxSizeAtDepth
Returns the maximum size of all subarrays at a certain depth (dimension)
argument::rank
The depth at which the size of the arrays is measured
code::
[[1, 2, 3], [[41, 52], 5, 6], 1, 2, 3].maxSizeAtDepth(2);
[[1, 2, 3], [[41, 52], 5, 6], 1, 2, 3].maxSizeAtDepth(1);
[[1, 2, 3], [[41, 52], 5, 6], 1, 2, 3].maxSizeAtDepth(0);
[].maxSizeAtDepth(0);
[[]].maxSizeAtDepth(0);
[[]].maxSizeAtDepth(1);
::
method::maxDepth
Returns the maximum depth of all subarrays.
argument::max
Internally used only.
code::
[[1, 2, 3], [[41, 52], 5, 6], 1, 2, 3].maxDepth
::
method::isSeries
Returns true if the collection is an arithmetic series.
argument::step
Step size to look for. If none is given, any step size will match.
code::
[ 0, 1, 2, 3, 4, 5 ].isSeries; // true
[ 1.5, 2.5, 3.5, 4.5, 5.5, 6.5 ].isSeries; // true
[ 0, 1, 4, 5 ].isSeries; // false
[ 0, 3, 6, 9, 12, 15 ].isSeries; // true
[ 0, 3, 6, 9, 12, 15 ].isSeries(1); // false
[ 2 ] // true
[ ] // true (empty sequence)
::
method::resamp0
Returns a new Collection of the desired length, with values resampled evenly-spaced from the receiver without interpolation.
code::
[1, 2, 3, 4].resamp0(12);
[1, 2, 3, 4].resamp0(2);
::
method::resamp1
Returns a new Collection of the desired length, with values resampled evenly-spaced from the receiver with linear interpolation.
code::
[1, 2, 3, 4].resamp1(12);
[1, 2, 3, 4].resamp1(3);
::
method::choose
Choose an element from the collection at random.
code::
[1, 2, 3, 4].choose;
::
method::wchoose
Choose an element from the collection at random using a list of probabilities or weights. The weights must sum to 1.0.
code::
[1, 2, 3, 4].wchoose([0.1, 0.2, 0.3, 0.4]);
::
method::sort
Sort the contents of the collection using the comparison function argument. The function should take two elements as arguments and return true if the first argument should be sorted before the second argument. If the function is nil, the following default function is used. { arg a, b; a < b }
code::
[6, 2, 1, 7, 5].sort;
[6, 2, 1, 7, 5].sort({ arg a, b; a > b }); // reverse sort
::
method::sortBy
Sort the contents of the collection using the key strong::key::, which is assumed to be found inside each element of the receiver.
code::
(
a = [
Dictionary[\a->5, \b->1, \c->62],
Dictionary[\a->2, \b->9, \c->65],
Dictionary[\a->8, \b->5, \c->68],
Dictionary[\a->1, \b->3, \c->61],
Dictionary[\a->6, \b->7, \c->63]
]
)
a.sortBy(\b);
a.sortBy(\c);
::
method::order
Return an array of indices that would sort the collection into order. strong::function:: is treated the same way as for the link::#-sort:: method.
code::
[6, 2, 1, 7, 5].order;
::
method::swap
Swap two elements in the collection at indices strong::i:: and strong::j::.
method::pairsDo
Calls function for each subsequent pair of elements in the SequentialCollection. The function is passed the two elements and an index.
code::
[1, 2, 3, 4, 5].pairsDo({ arg a, b; [a, b].postln; });
::
method::doAdjacentPairs
Calls function for every adjacent pair of elements in the SequentialCollection. The function is passed the two adjacent elements and an index.
code::
[1, 2, 3, 4, 5].doAdjacentPairs({ arg a, b; [a, b].postln; });
::
method::separate
Separates the collection into sub-collections by calling the function for each adjacent pair of elements. If the function returns true, then a separation is made between the elements.
code::
[1, 2, 3, 5, 6, 8, 10].separate({ arg a, b; (b - a) > 1 }).postcs;
::
method::split
Separates the collection into sub-collections at the separator element or subarray. The separator is a link::Classes/Collection::, or anything that can be converted into the class this method is called on. It is strong::not:: included in the output array. The default separator is $/, for the common use in link::Classes/String::.
code::
[1, 2, 1, 2, 3, 1, 2, 1, 3].split([2, 1])
::
method::clump
Separates the collection into sub-collections by separating every groupSize elements.
code::
[1, 2, 3, 4, 5, 6, 7, 8].clump(3).postcs;
::
method::clumps
Separates the collection into sub-collections by separating elements into groupings whose size is given by integers in the groupSizeList.
code::
[1, 2, 3, 4, 5, 6, 7, 8].clumps([1, 2]).postcs;
::
method::curdle
Separates the collection into sub-collections by randomly separating elements according to the given probability.
code::
[1, 2, 3, 4, 5, 6, 7, 8].curdle(0.3).postcs;
::
method::integrate
Returns a collection with the incremental sums of all elements.
code::
[3, 4, 1, 1].integrate;
::
method::differentiate
Returns a collection with the pairwise difference between all elements.
code::
[3, 4, 1, 1].differentiate;
::
method::reduce
Applies the method named by operator to the first and second elements of the collection - then applies the method to the result and to the third element of the collection - then applies the method to the result and to the fourth element of the collection - and so on, until the end of the array.
code::
[3, 4, 5, 6].reduce('*'); // this is the same as [3, 4, 5, 6].product
[3, 4, 5, 6].reduce(\lcm); // Lowest common multiple of the whole set of numbers
["d", "e", (0..9), "h"].reduce('++'); // concatenation
[3, 4, 5, 6].reduce({ |a, b| sin(a) * sin(b) }); // product of sines
::
argument::operator
may be a link::Classes/Function:: or a link::Classes/Symbol::.
method::convertDigits
Returns an integer resulting from interpreting the elements as digits to a given base (default 10). See also asDigits in link::Classes/Integer#asDigits:: for the complementary method.
code::
[1, 0, 0, 0].convertDigits;
[1, 0, 0, 0].convertDigits(2);
[1, 0, 0, 0].convertDigits(3);
::
method::hammingDistance
Returns the count of array elements that are not equal in identical positions. http://en.wikipedia.org/wiki/Hamming_distance
The collections are not wrapped - if one array is shorter than the other, the difference in size should be included in the count.
code::
[0, 0, 0, 1, 1, 1, 0, 1, 0, 0].hammingDistance([0, 0, 1, 1, 0, 0, 0, 0, 1, 1]);
"SuperMan".hammingDistance("SuperCollider");
::
subsection::Math Support - Unary Messages
All of the following messages send the message link::#-performUnaryOp:: to the receiver with the unary message selector as an argument.
method::neg, reciprocal, bitNot, abs, asFloat, asInt, ceil, floor, frac, sign, squared, cubed, sqrt, exp, midicps, cpsmidi, midiratio, ratiomidi, ampdb, dbamp, octcps, cpsoct, log, log2, log10, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, rand, rand2, linrand, bilinrand, sum3rand, distort, softclip, coin, even, odd, isPositive, isNegative, isStrictlyPositive, real, imag, magnitude, magnitudeApx, phase, angle, rho, theta, asFloat, asInteger
method::performUnaryOp
Creates a new collection of the results of applying the selector to all elements in the receiver.
code::
[1, 2, 3, 4].neg;
[1, 2, 3, 4].reciprocal;
::
subsection::Math Support - Binary Messages
All of the following messages send the message link::#-performBinaryOp:: to the receiver with the binary message selector and the second operand as arguments.
method::+, -, *, /, div, %, **, min, max, <, <=, >, >=, &, |, bitXor, lcm, gcd, round, trunc, atan2, hypot, >>, +>>, ring1, ring2, ring3, ring4, difsqr, sumsqr, sqrdif, absdif, amclip, scaleneg, clip2, excess, <!, rrand, exprand
method::performBinaryOp
Creates a new collection of the results of applying the selector with the operand to all elements in the receiver. If the operand is a collection then elements of that collection are paired with elements of the receiver.
code::
([1, 2, 3, 4] * 10);
([1, 2, 3, 4] * [4, 5, 6, 7]);
::
subsection::Multichannel wrappers
All of the following messages are performed on the elements of this collection, using link::Classes/Object#-multiChannelPerform::.
The result depends on the objects in the collection, but the main use case is for link::Classes/UGen::s.
See also link::Guides/Multichannel-Expansion::
method::clip, wrap, fold, prune, linlin, linexp, explin, expexp, lincurve, curvelin, bilin, biexp, range, exprange, unipolar, bipolar, lag, lag2, lag3, lagud, lag2ud, lag3ud, varlag, slew, blend, checkBadValues
Calls code:: this.multiChannelPerform(selector, *args) :: where selector is the name of the message.
method::multichannelExpandRef
This method is called internally on inputs to UGens that take multidimensional arrays, like link::Classes/Klank:: and it allows proper multichannel expansion even in those cases. For SequenceableCollection, this returns the collection itself, assuming that it contains already a number of Refs. See link::Classes/Ref:: for the corresponding method implementation.
argument::rank
The depth at which the list is expanded. For instance the Klank spec has a rank of 2. For more examples, see link::Classes/SequenceableCollection#-flopDeep::
code::
`([[[100, 200], 500], nil, [[[0.01, 0.3], 0.8]]]).multichannelExpandRef(2);
[`[[100, 200], nil, [0.2, 0.8]], `[[130, 202], nil, [0.2, 0.5]]].multichannelExpandRef(2);
::
subsection:: Rhythm-lists
method:: convertRhythm
Convert a rhythm-list to durations.
discussion::
supports a variation of Mikael Laurson's rhythm list RTM-notation. footnote::
see Laurson and Kuuskankare's 2003, "From RTM-notation to ENP-score-notation"
http://jim2003.agglo-montbeliard.fr/articles/laurson.pdf
::
The method converts a collection of the form code:: [beat-count, [rtm-list], repeats] :: to a link::Classes/List:: of link::Classes/Float::s. A negative integer within the rtm-list equates to a value tied over to the duration following. The method is recursive in that any subdivision within the rtm-list can itself be a nested convertRhythm collection (see example below). The repeats integer has a default value of 1.
If the divisions in the rtm-list are events, the event durations are interpreted as relative durations, and a list of events is returned.
code::
// using numbers as score
[3, [1, 2, 1], 1].convertRhythm; // List[ 0.75, 1.5, 0.75 ]
[2, [1, 3, [1, [2, 1, 1, 1]], 1, 3], 1].convertRhythm;
[2, [1, [1, [2, 1, 1, 1]]], 1].convertRhythm;
[2, [1, [1, [2, 1, 1, 1]]], 2].convertRhythm; // repeat
[2, [1, [1, [2, 1, 1, -1]]], 2].convertRhythm; // negative value is tied over.
// sound example
Pbind(\degree, Pseries(0, 1, inf), \dur, Pseq([2, [1, [1, [2, 1, 1, -1]]], 2].convertRhythm)).play;
::