Returns a FoscPatternList.
Pattern list.
| getMatchingPattern | Gets pattern matching index. |
| getMatchingPayload | Gets payload attached to pattern matching index. |
Example
a = FoscPattern(#[0,1,7], period: 16);
b = FoscPattern(#[2,4,5], period: 15);
p = FoscPatternList([a, b]);
p.items;[ FoscPattern([ 0, 1, 7 ], 16), FoscPattern([ 2, 4, 5 ], 15) ]Gets pattern matching index.
Get patterns that match the first ten indices.
p = FoscPatternList([
FoscPattern(#[1], 2),
FoscPattern(#[-3,-2,-1]),
]);
10.collect { |i| [i, p.getMatchingPattern(i, 10).cs] }.join("\n");[ 0, nil ]
[ 1, FoscPattern([ 1 ], 2) ]
[ 2, nil ]
[ 3, FoscPattern([ 1 ], 2) ]
[ 4, nil ]
[ 5, FoscPattern([ 1 ], 2) ]
[ 6, nil ]
[ 7, FoscPattern([ -3, -2, -1 ]) ]
[ 8, FoscPattern([ -3, -2, -1 ]) ]
[ 9, FoscPattern([ -3, -2, -1 ]) ]Get patterns that match the next ten indices. Note that the last three indices no longer match the second pattern.
p = FoscPatternList([
FoscPattern(#[1], 2),
FoscPattern(#[-3,-2,-1]),
]);
(10..19).collect { |i| [i, p.getMatchingPattern(i, 10).cs] }.join("\n");[ 10, nil ]
[ 11, FoscPattern([ 1 ], 2) ]
[ 12, nil ]
[ 13, FoscPattern([ 1 ], 2) ]
[ 14, nil ]
[ 15, FoscPattern([ 1 ], 2) ]
[ 16, nil ]
[ 17, FoscPattern([ 1 ], 2) ]
[ 18, nil ]
[ 19, FoscPattern([ 1 ], 2) ]Get patterns that match the first ten indices with rotation set to 1.
p = FoscPatternList([
FoscPattern(#[1], 2),
FoscPattern(#[-3,-2,-1]),
]);
10.collect { |i| [i, p.getMatchingPattern(i, 10, rotation: 1).cs] }.join("\n");[ 0, FoscPattern([ 1 ], 2) ]
[ 1, nil ]
[ 2, FoscPattern([ 1 ], 2) ]
[ 3, nil ]
[ 4, FoscPattern([ 1 ], 2) ]
[ 5, nil ]
[ 6, FoscPattern([ 1 ], 2) ]
[ 7, FoscPattern([ -3, -2, -1 ]) ]
[ 8, FoscPattern([ -3, -2, -1 ]) ]
[ 9, FoscPattern([ -3, -2, -1 ]) ]FIXME Execution warning: Class FoscSegmentList not found
p = FoscPatternList([
FoscSilenceMask(FoscPattern(#[0,4,5])),
FoscSustainMask(FoscPattern(#[1,11,13]))
]);
20.collect { |i| [i, p.getMatchingPattern(i, 20)] }.join("\n");Gets payload attached to pattern matching index.
Get patterns that match the first ten indices.
p = FoscPatternList([
FoscPattern(#[0], period: 2, payload: 'staccato'),
FoscPattern(#[-3,-2,-1], payload: 'tenuto'),
]);
10.collect { |i| [i, p.getMatchingPattern(i, 10).cs] }.join("\n");[ 0, FoscPattern([ 0 ], 2, 'staccato') ]
[ 1, nil ]
[ 2, FoscPattern([ 0 ], 2, 'staccato') ]
[ 3, nil ]
[ 4, FoscPattern([ 0 ], 2, 'staccato') ]
[ 5, nil ]
[ 6, FoscPattern([ 0 ], 2, 'staccato') ]
[ 7, FoscPattern([ -3, -2, -1 ], nil, 'tenuto') ]
[ 8, FoscPattern([ -3, -2, -1 ], nil, 'tenuto') ]
[ 9, FoscPattern([ -3, -2, -1 ], nil, 'tenuto') ]FIXME Execution warning: Class FoscSegmentList not found
p = FoscPatternList([
FoscSilenceMask(FoscPattern(#[0,4,5])),
FoscSustainMask(FoscPattern(#[1,11,13]))
]);
20.collect { |i| [i, p.getMatchingPattern(i, 10).cs] }.join("\n");