Returns a FoscSelection.
Selection of items (components / or other selections).
| items |
| == | Is true when selection and expr are of the same type and when items of selection equals items of expr. Otherwise false. |
| != | Is true when selection does not equal expr. Otherwise false. |
| ++ | Concatenates object to selection. |
| asCompileString | |
| storeArgs |
| any | |
| areContiguousLogicalVoice | Is true when items in selection are contiguous components in the same logical voice. |
| areContiguousSameParent | Is true when items in selection are all contiguous components in the same parent. |
| areLeaves | Is true when items in selection are all leaves. |
| areLogicalVoice | Is true when items in selection are all components in the same logical voice. |
| at | Gets item identified by index. |
| atAll | Gets items identified by indices. |
| collect | Collects components by predicate function. |
| components | Select components. |
| copySeries | Gets slice of items identified by indices. |
| do | Iterates over items in selection. |
| doAdjacentPairs | Iterates over adjacent pairs of items in selection. |
| every | |
| first | Gets first items in selection. |
| flat | |
| format | |
| groupBy | (synonymous with separate) |
| groupByContiguity | Group items in selection by contiguity. |
| groupByPitch | Group items in selection by pitch. |
| groupByPitched | Group items in selection by pitched and non-pitched leaves. |
| hash | TODO: not yet implemented |
| illustrate | Attempts to illustrate selection. The illustration will usually work for simple selections that represent a contiguous snippet of a single voice of items. |
| includes | (abjad: contains) |
| indexOf | |
| insert | |
| isEmpty | |
| last | Gets last item in selection. |
| lastIndex | |
| leafAt | |
| leaves | Selects leaves. |
| logicalTies | Selects logical ties. |
| notEmpty | |
| reverseDo | Iterates over all components in selection in reverse. |
| partitionByDurations | Partitions selection by durations. |
| partitionByRatio | |
| partitionBySizes | TODO: overhang argument rather than isCyclic |
| put | |
| remove | |
| removeAt | |
| reverseDo | Reverse-iterates over items in selection. |
| runs | Select runs. |
| separate | Groups components by predicate function. |
| size | Gets number of components in selection. |
| timespan | Gets timespan of contiguous selection. |
| tuplets | Select tuplets. |
| isPlaying | |
| pause | |
| play | |
| resume | |
| stop |
Example
m = [FoscNote(60, 1/4), FoscNote(62, 1/4)];
a = FoscSelection(m);
a.items;[ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscNote(FoscPitch("D4"), FoscDuration(1, 4)) ]Example
FoscSelection.dumpInterfaceFoscSelectionExample
a = FoscSelection([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
a.items;[ FoscRest(FoscDuration(1, 4)), FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscNote(FoscPitch("D4"), FoscDuration(1, 4)) ]Is true when selection and expr are of the same type and when items of selection equals items of expr. Otherwise false.
Returns true or false.
Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4)]);
b = FoscSelection(a.items.copy);
c = FoscSelection([FoscNote(64, 1/4)]);
a == b;true
a == c;falseIs true when selection does not equal expr. Otherwise false.
Returns true or false.
Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4)]);
b = FoscSelection(a.items.copy);
c = FoscSelection([FoscNote(64, 1/4)]);
a != b;false
a != c;trueConcatenates object to selection.
Returns new selection.
Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4)]);
b = FoscSelection([FoscNote(64, 1/4)]);
c = a ++ b;
c.items.collect { |each| each.str };[ "c'4", "d'4", "e'4" ]Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4)]);
a.cs;FoscSelection([ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscNote(FoscPitch("D4"), FoscDuration(1, 4)) ])Example
a = FoscSelection([FoscNote(60, 1/4), FoscChord(#[60,66,67], 1/4)]);
a.any { |item| item.isKindOf(FoscNote) };true
a.any { |item| item.isKindOf(FoscChord) };true
a.any { |item| item.isKindOf(FoscRest) };falseIs true when items in selection are contiguous components in the same logical voice.
code:: a = FoscStaff(FoscLeafMaker().(#[60,62,64,65], [1/4])); a[0..].areContiguousLogicalVoice;
code:: b = FoscSelection([a.leafAt(1), a.leafAt(3)]); b[0..].areContiguousLogicalVoice;
Is true when items in selection are all contiguous components in the same parent.
Example
a = FoscStaff(FoscLeafMaker().(#[60,62,64,65], [1/4]));
a[0..].areContiguousSameParent;true
b = FoscSelection([a.leafAt(1), a.leafAt(3)]);
b[0..].areContiguousSameParent;falseIs true when items in selection are all leaves.
Example
a = FoscStaff(FoscLeafMaker().(#[60,62,64,65], [1/4]));
a[0..].areLeaves;trueIs true when items in selection are all components in the same logical voice.
Example
a = FoscStaff(FoscLeafMaker().(#[60,62,64,65], [1/4]));
a[0..].areLogicalVoice;true
b = FoscSelection([a.leafAt(1), a.leafAt(3)]);
b[0..].areLogicalVoice;trueGets item identified by index.
Returns component from selection.
Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4)]);
a[1].str;d'4Gets items identified by indices.
Returns components from selection.
Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4), FoscNote(64, 1/4)]);
a.atAll(#[0,2]).collect { |each| each.str };[ "c'4", "e'4" ]Collects components by predicate function.
Returns a new selection.
code:: a = FoscLeafMaker().(#[60, 61, 62, 63, 64], [1/8]); b = a.collect { |each| each.writtenPitch_(each.writtenPitch + 12) }; b.items.collect { |each| each.writtenPitch.pitchNumber };
Select components.
Return new selection.
All components
a = FoscStaff([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
b = FoscSelection(a).components;
b.items.collect { |each| each.str };[ "\\new Staff {
r4
c'4
d'4
}", "r4", "c'4", "d'4" ]Notes
a = FoscStaff([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
b = FoscSelection(a).components(prototype: FoscNote);
b.items.collect { |each| each.str };[ "c'4", "d'4" ]Notes and rests
a = FoscStaff([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
b = FoscSelection(a).components(prototype: [FoscNote, FoscRest]);
b.items.collect { |each| each.str };[ "r4", "c'4", "d'4" ]Notes and rests in reverse order
a = FoscStaff([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
b = FoscSelection(a).components(prototype: [FoscNote, FoscRest], reverse: true);
b.items.collect { |each| each.str };[ "d'4", "c'4", "r4" ]Gets slice of items identified by indices.
Returns a new selection.
Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4), FoscNote(64, 1/4)]);
b = a[1..];
b.items.collect { |each| each.str };[ "d'4", "e'4" ]Iterates over items in selection.
Example
a = FoscLeafMaker().(#[60,60,62,64,65,65], [1/4,1/24,1/12,1/8,1/4,1/4]);
a.show;
Does not recurse into containers:
FoscSelection(a).do { |each| each.postln };FoscSelection([ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscTuplet(FoscMultiplier(2, 3), [ ]), FoscNote(FoscPitch("E4"), FoscDuration(1, 8)), FoscNote(FoscPitch("F4"), FoscDuration(1, 4)), FoscNote(FoscPitch("F4"), FoscDuration(1, 4)) ])Recurses into containers:
FoscSelection(a).do({ |each| each.postln }, recurse: true);FoscSelection([ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscTuplet(FoscMultiplier(2, 3), [ ]), FoscNote(FoscPitch("E4"), FoscDuration(1, 8)), FoscNote(FoscPitch("F4"), FoscDuration(1, 4)), FoscNote(FoscPitch("F4"), FoscDuration(1, 4)) ])Iterates over adjacent pairs of items in selection.
Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4), FoscNote(64, 1/4)]);
a.doAdjacentPairs { |a, b| [a.str, b.str].postln };FoscSelection([ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscNote(FoscPitch("D4"), FoscDuration(1, 4)), FoscNote(FoscPitch("E4"), FoscDuration(1, 4)) ])Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4)]);
a.every { |item| item.isKindOf(FoscNote) };true
a = FoscSelection([FoscNote(60, 1/4), FoscChord(#[60,66,67], 1/4)]);
a.every { |item| item.isKindOf(FoscNote) };falseGets first items in selection.
Returns component.
Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4), FoscNote(64, 1/4)]);
a.first.str;c'4Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4)]);
b = FoscSelection([FoscRest(1/4), FoscChord(#[60,66,67], 1/4)]);
c = FoscSelection([a, b]);
c.items;[ FoscSelection([ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscNote(FoscPitch("D4"), FoscDuration(1, 4)) ]), FoscSelection([ FoscRest(FoscDuration(1, 4)), FoscChord(FoscPitchSegment([ FoscPitch("C4"), FoscPitch("F#4"), FoscPitch("G4") ]), FoscDuration(1, 4)) ]) ]
d = c.flat;
d.items;[ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscNote(FoscPitch("D4"), FoscDuration(1, 4)), FoscRest(FoscDuration(1, 4)), FoscChord(FoscPitchSegment([ FoscPitch("C4"), FoscPitch("F#4"), FoscPitch("G4") ]), FoscDuration(1, 4)) ](synonymous with separate)
Groups components by predicate function.
Returns a selection of selections.
Example
a = FoscLeafMaker().(#[nil, 60, 61, nil, 62, 63, 64], [1/8]);
b = a.leaves.groupBy { |a, b| a.isPitched != b.isPitched };
b.items.collect { |each| each.items };[ [ FoscRest(FoscDuration(1, 8)) ], [ FoscNote(FoscPitch("C4"), FoscDuration(1, 8)), FoscNote(FoscPitch("C#4"), FoscDuration(1, 8)) ], [ FoscRest(FoscDuration(1, 8)) ], [ FoscNote(FoscPitch("D4"), FoscDuration(1, 8)), FoscNote(FoscPitch("Eb4"), FoscDuration(1, 8)), FoscNote(FoscPitch("E4"), FoscDuration(1, 8)) ] ]Group items in selection by contiguity.
Example
a = FoscStaff(FoscLeafMaker().(#[60,60,62,nil,64,64], [1/4,1/24,1/12,1/8,1/4,1/4]));
m = a.selectLeaves;
tie(m[0..1]);
tie(m[4..]);
a.show;
Group pitched leaves by contiguity.
m = a.selectLeaves(pitched: true);
m = m.groupByContiguity;
m.items.collect { |each| each.items.collect { |item| item.str } };[ [ "c'4", "c'16", "d'8" ], [ "e'4", "e'4" ] ]
a.consistsCommands.add('Horizontal_bracket_engraver');
t = #[['bracket-flare', [0,0]], ['direction', 'up'], ['staff-padding', 3]];
m.do { |each| each.horizontalBracket(tweaks: t) };
a.show;
Group items in selection by pitch.
Example
a = FoscStaff(FoscLeafMaker().(#[60,[60,64,67],62,62,62,nil,[65,69],[65,69]], [1/8]));
m = a.selectLeaves;
m[2..3].tie;
m = a.selectLogicalTies.groupByPitch;
m.items.do { |each| each.items.collect { |item| item.str }.postln };
a.show;
Group items in selection by pitched and non-pitched leaves.
Example
a = FoscStaff(FoscLeafMaker().(#[60,[60,64,67],62,62,62,nil,[65,69],[65,69]], [1/8]));
m = a.selectLeaves;
m[2..3].tie;
m = a.selectLogicalTies.groupByPitched;
m.items.do { |each| each.items.collect { |item| item.str }.postln };
a.show;prFormatCodeString interpret initial failed: a DoesNotUnderstandError
a = FoscStaff(FoscLeafMaker().(#[60,[60,64,67],62,62,62,nil,[65,69],[65,69]], [1/8]));
m = a.selectLeaves;
m[2..3].tie;
m = a.selectLogicalTies.groupByPitched;
m.items.do { |each| each.items.collect { |item| item.str }.postln };
TODO: not yet implemented
Attempts to illustrate selection. The illustration will usually work for simple selections that represent a contiguous snippet of a single voice of items.
Returns LilyPond file.
Regular staff
a = FoscLeafMaker().(#[60,62,64,65,67,69,71,72], [1/8]);
a.show;
RhythmicStaff if all pitches = middle-c
a = FoscLeafMaker().(60 ! 8, [1/8]);
a.show;
(abjad: contains)
Is true when expr is in selection. Otherwise false.
Returns true or false.
Example
x = FoscNote(60, 1/4);
y = FoscNote(62, 1/4);
a = FoscSelection([x]);
a.includes(x);true
a.includes(y);falseExample
x = FoscNote(60, 1/4);
y = FoscNote(62, 1/4);
a = FoscSelection([x, y]);
a.indexOf(x);0
a.indexOf(y);1Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4)]);
a.items.collect { |each| each.str };[ "c'4", "d'4" ]
a.insert(1, FoscNote(72, 1/4));
a.items.collect { |each| each.str };[ "c'4", "c''4", "d'4" ]Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4)]);
a.isEmpty;false
a = FoscSelection([]);
a.isEmpty;trueGets last item in selection.
Returns component.
Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4), FoscNote(64, 1/4)]);
a.last.str;e'4Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4)]);
a.lastIndex;1Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4)]);
a.leafAt(1).str;d'4
a = FoscSelection([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
a.leafAt(0, pitched: true).str;c'4Selects leaves.
Returns new selection.
All leaves
a = FoscStaff([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
b = FoscSelection(a).leaves;
b.items.collect { |each| each.str };[ "r4", "c'4", "d'4" ]Pitched leaves
a = FoscStaff([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
b = FoscSelection(a).leaves(pitched: true);
b.items.collect { |each| each.str };[ "c'4", "d'4" ]Non-pitched leaves
a = FoscStaff([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
b = FoscSelection(a).leaves(pitched: false);
b.items.collect { |each| each.str };[ "r4" ]Leaves in reverse order
a = FoscStaff([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
b = FoscSelection(a).leaves(reverse: true);
b.items.collect { |each| each.str };[ "d'4", "c'4", "r4" ]Selects logical ties.
Returns new selection.
Example
a = FoscStaff(FoscLeafMaker().(#[60,60,62,nil,64,64], [1/4,1/24,1/12,1/8,1/4,1/4]));
m = a.selectLeaves;
tie(m[0..1]);
tie(m[4..]);
a.show;
Select all logicalTies
b = FoscSelection(a).logicalTies;
b.items.collect { |each| each.items.collect { |each| each.cs } };[ [ "FoscNote('C4', 1/4)", "FoscNote('C4', 1/16)" ], [ "FoscNote('D4', 1/8)" ], [ "FoscRest(1/8)" ], [ "FoscNote('E4', 1/4)", "FoscNote('E4', 1/4)" ] ]Select pitched logicalTies
b = FoscSelection(a).logicalTies(pitched: true);
b.items.collect { |each| each.items { |each| each.cs } };[ [ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscNote(FoscPitch("C4"), FoscDuration(1, 16)) ], [ FoscNote(FoscPitch("D4"), FoscDuration(1, 8)) ], [ FoscNote(FoscPitch("E4"), FoscDuration(1, 4)), FoscNote(FoscPitch("E4"), FoscDuration(1, 4)) ] ]Select non-pitched logicalTies
b = FoscSelection(a).logicalTies(pitched: false);
b.items.collect { |each| each.items.collect { |each| each.cs } };[ [ "FoscRest(1/8)" ] ]Select nontrivial logicalTies
b = FoscSelection(a).logicalTies(nontrivial: true);
b.items.collect { |each| each.items.collect { |each| each.cs } };[ [ "FoscNote('C4', 1/4)", "FoscNote('C4', 1/16)" ], [ "FoscNote('E4', 1/4)", "FoscNote('E4', 1/4)" ] ]Select trivial logicalTies
b = FoscSelection(a).logicalTies(nontrivial: false);
b.items.collect { |each| each.items.collect { |each| each.cs } };[ [ "FoscNote('D4', 1/8)" ], [ "FoscRest(1/8)" ] ]Select logicalTies in reverse order
b = FoscSelection(a).logicalTies(reverse: true);
b.items.collect { |each| each.items.collect { |each| each.cs } };[ [ "FoscNote('E4', 1/4)", "FoscNote('E4', 1/4)" ], [ "FoscRest(1/8)" ], [ "FoscNote('D4', 1/8)" ], [ "FoscNote('C4', 1/4)", "FoscNote('C4', 1/16)" ] ]Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4)]);
a.notEmpty;true
a = FoscSelection([]);
a.notEmpty;falseIterates over all components in selection in reverse.
Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4)]);
a.reverseDo { |each| each.str.postln };FoscSelection([ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscNote(FoscPitch("D4"), FoscDuration(1, 4)) ])Partitions selection by durations.
Parts must equal durations exactly when fill is exact.
Parts must be less than or equal to durations when fill is less.
Parts must be greater or equal to durations when fill is more.
Reads durations cyclically when isCylic is true.
Reads component durations in seconds when inSeconds is true.
Returns remaining components at end in final part when overhang is true.
Returns array of selections.
Cyclically partitions leaves into parts equal to exactly 3/8, with overhang returned at end.
a = FoscStaff(FoscLeafMaker().(#[60,62,64,65,67,69,71,72], [1/8]));
b = a[0..].partitionByDurations([3/8], isCyclic: true, overhang: true);
b.do { |sel| sel.items.collect { |each| each.str }.postln };
b.do { |sel| if (sel.size > 1) { sel.slur } };
a.show;
Partitions leaves into one part equal to exactly 3/8, truncating overhang.
a = FoscStaff(FoscLeafMaker().(#[60,62,64,65,67,69,71,72], [1/8]));
b = a[0..].partitionByDurations([3/8], isCyclic: false, overhang: false);
b.do { |sel| sel.items.collect { |each| each.str }.postln };
b.do { |sel| if (sel.size > 1) { sel.slur } };
a.show;
Cyclically partitions leaves into parts equal to (or just less than) 3/16 and 1/16, with overhang returned at end.
a = FoscStaff(FoscLeafMaker().(#[60,62,64,65,67,69,71,72], [1/8]));
b = a[0..].partitionByDurations([3/16,1/16], isCyclic: true, fill: 'more', overhang: true);
b.do { |sel| sel.items.collect { |each| each.str }.postln };
b.do { |sel| if (sel.size > 1) { sel.slur } };
a.show;
Cyclically partitions leaves into parts equal to (or just less than) 3/16, truncating overhang.
a = FoscStaff(FoscLeafMaker().(#[60,62,64,65,67,69,71,72], [1/8]));
b = a[0..].partitionByDurations([3/16], isCyclic: true, fill: 'less', overhang: false);
b.do { |sel| sel.items.collect { |each| each.str }.postln };
b.do { |sel| if (sel.size > 1) { sel.slur } };
a.show;
Partitions leaves into a single part equal to (or just less than) 3/16, truncating overhang.
a = FoscStaff(FoscLeafMaker().(#[60,62,64,65,67,69,71,72], [1/8]));
b = a[0..].partitionByDurations([3/16], isCyclic: false, fill: 'less', overhang: false);
b.do { |sel| sel.items.collect { |each| each.str }.postln };
b.do { |sel| if (sel.size > 1) { sel.slur } };
a.show;
Cyclically partitions exactly 1.5 seconds at a time.
Cyclically partitions exactly 1.5 seconds at a time with overhang returned at end.
Partitions exactly 1.5 seconds one time.
Cyclically partitions 0.75 seconds with part durations allowed to be just less than 0.75 seconds.
Partitions 0.75 seconds just once with part duration allowed to be just less than 0.75 seconds.
Example
a = FoscStaff(FoscLeafMaker().(#[60,62,64,65,67,69,71,72], [1/8,1/8,1/8,1/8]));
b = a[0..].partitionByRatio(#[5, 11, 4]);
b.do { |sel| sel.items.collect { |each| each.str }.postln };
b.do { |sel| if (sel.size > 1) { sel.slur } };
b.items.postln;
a.show;
TODO: overhang argument rather than isCyclic
Example
a = FoscLeafMaker().((60..72), [1/8]);
a = a.partitionBySizes([2,3,5,2,1]);
a.do { |each| if (each.size > 1) { each.attach(FoscSlur('below')) } };
a.show;
Example
a = FoscLeafMaker().((60..72), [1/8]);
a = a.partitionBySizes([2,3], isCyclic: true);
a.do { |each| if (each.size > 1) { each.attach(FoscSlur('below')) } };
a.show;
Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4)]);
a.items.collect { |each| each.str };[ "c'4", "d'4" ]Example
a.put(1, FoscNote(72, 1/4));
a.items.collect { |each| each.str };[ "c'4", "c''4" ]Example
x = FoscNote(60, 1/4);
y = FoscNote(62, 1/4);
a = FoscSelection([x, y]);
a.items.collect { |each| each.str };[ "c'4", "d'4" ]
a.remove(x);
a.items.collect { |each| each.str };[ "d'4" ]Example
x = FoscNote(60, 1/4);
y = FoscNote(62, 1/4);
a = FoscSelection([x, y]);
a.items.collect { |each| each.str };[ "c'4", "d'4" ]
a.removeAt(0);
a.items.collect { |each| each.str };[ "d'4" ]Reverse-iterates over items in selection.
Example
a = FoscLeafMaker().(#[60,60,62,64,65,65], [1/4,1/24,1/12,1/8,1/4,1/4]);
a.show;
Does not recurse into containers:
FoscSelection(a).reverseDo { |each| each.postln };FoscSelection([ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscTuplet(FoscMultiplier(2, 3), [ ]), FoscNote(FoscPitch("E4"), FoscDuration(1, 8)), FoscNote(FoscPitch("F4"), FoscDuration(1, 4)), FoscNote(FoscPitch("F4"), FoscDuration(1, 4)) ])Recurses into containers:
FoscSelection(a).reverseDo({ |each| each.postln }, recurse: true);FoscSelection([ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscTuplet(FoscMultiplier(2, 3), [ ]), FoscNote(FoscPitch("E4"), FoscDuration(1, 8)), FoscNote(FoscPitch("F4"), FoscDuration(1, 4)), FoscNote(FoscPitch("F4"), FoscDuration(1, 4)) ])Select runs.
Attach horizontal bracket to each run.
a = FoscStaff(FoscLeafMaker().(#[60,60,62,nil,64,64], [1/4,1/24,1/12,1/8,1/4,1/4]));
a.consistsCommands.add('Horizontal_bracket_engraver');
m = a.selectLeaves;
tie(m[0..1]);
tie(m[4..]);
m.runs.do { |each| each.horizontalBracket(tweaks: #[['direction', 'up']]) };
a.show;
Groups components by predicate function.
Returns a selection of selections.
Example
a = FoscLeafMaker().(#[nil, 60, 61, nil, 62, 63, 64], [1/8]);
b = a.leaves.separate { |a, b| a.isPitched != b.isPitched };
b.items.collect { |each| each.items };[ [ FoscRest(FoscDuration(1, 8)) ], [ FoscNote(FoscPitch("C4"), FoscDuration(1, 8)), FoscNote(FoscPitch("C#4"), FoscDuration(1, 8)) ], [ FoscRest(FoscDuration(1, 8)) ], [ FoscNote(FoscPitch("D4"), FoscDuration(1, 8)), FoscNote(FoscPitch("Eb4"), FoscDuration(1, 8)), FoscNote(FoscPitch("E4"), FoscDuration(1, 8)) ] ]Gets number of components in selection.
Returns integer.
Example
a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4)]);
a.size;2Gets timespan of contiguous selection.
Returns timespan.
FIXME ERROR: Message prGetTimespan not understood
a = FoscVoice({ FoscNote(60, [1, 8]) } ! 8);
b = a.select.byLeaf[1..6];
b.timespan;[b.timespan.startOffset.pair, b.timespan.stopOffset.pair].postln;FoscTimespan.superclass.dumpInterface;a = FoscMeasure([4, 4], [FoscNote(60, [1, 32]), FoscNote(62, [7, 8]), FoscNote(62, [1, 16]), FoscNote(64, [1, 32])]);
a[1..2].attach(FoscTie());
x = FoscStaff([FoscMeasure([2, 4], [FoscNote(60, [2, 4])]), a]);m = FoscMeterManager.iterateRewriteInputs(a).all;m.do { |logicalTie|
t = logicalTie.timespan;
[t.startOffset.pair, t.stopOffset.pair].postln
};
// lost when measure is added to staffa[0].prGetTimespan.startOffset.pair;a[1].prGetTimespan.startOffset.pair;a[2].prGetTimespan.startOffset.pair;a[0].timespan.startOffset.pair;a[1].timespan.startOffset.pair;a[2].timespan.startOffset.pair;Select tuplets.
Attach horizontal bracket to each tuplet.
a = FoscStaff(FoscLeafMaker().(#[60,60,62,nil,64,64], [1/4,1/24,1/12,1/8,1/4,1/4]));
a.consistsCommands.add('Horizontal_bracket_engraver');
m = a.selectLeaves;
tie(m[0..1]);
tie(m[4..]);
FoscSelection(a).tuplets.items.collect { |each| each.str };[ "\\times 2/3 {
c'16
d'8
}" ]Example
a = FoscLeafMaker().(#[60,62,nil].wrapExtend(12), [3/8,1/8,5/16,1/16]);
a.play;
a.isPlaying;true
a.stop;
a.isPlaying;falseExample
a = FoscLeafMaker().(#[60,62,nil].wrapExtend(12), [3/8,1/8,5/16,1/16]);
a.play;
a.pause;
a.resume;Example
a = FoscLeafMaker().(#[60,62,nil].wrapExtend(12), [3/8,1/8,5/16,1/16]);
a.play;
a.stop;Example
a = FoscLeafMaker().(#[60,62,nil].wrapExtend(12), [3/8,1/8,5/16,1/16]);
a.play;
a.pause;
a.resume;Example
a = FoscLeafMaker().(#[60,62,nil].wrapExtend(12), [3/8,1/8,5/16,1/16]);
a.play;
a.stop;