FoscObject

Returns a FoscObject.


Description

This is the base class for all Fosc objects.


Attributes Summary

Instance Methods: Special Methods

== Is true when ID of object equals ID of Fosc object. Otherwise false.
!-
>
>=
>
>=
add (python: add)
asInteger
concat (python: add)
div (python: __div_)
dup (python: mult)
mul (python: mul)
sub (python: sub)
difference //!!! - must be an override at a lower point in the hierarchy
intersection
symmetricDifference
union
format Formats Fosc object.
ps
str

Instance Methods: Top Level

annotate Annotates receiver with annotation.
attach !!!TODO: attaches to FoscComponents and FoscSelections? can this method be moved lower in the tree?
detach
iterate
mutate
override Adds a LilyPond override to receiver.
setting
set
select
show Shows object.
tweak Attaches LilyPond tweak to receiver.
write
writeLY
writeMIDI
writePDF
writePNG

Instance Methods: FoscSelection / FoscComponent shared interface

doComponents
doLeaves
doLogicalTies FIXME find better way to display or capture post output in these examples
doRuns
doTimeline
doTimelineByLogicalTies
leafAt
selectComponents
selectLeaves
selectLogicalTies Selects logical ties.
selectRuns Select runs.
isPlaying
pause
play
resume
stop


Instance Methods: Special Methods


==

Is true when ID of object equals ID of Fosc object. Otherwise false.

Returns true or false.


!-


>


>=


>


>=


add

(python: add)


asInteger


concat

(python: add)


div

(python: __div_)


dup

(python: mult)


mul

(python: mul)


sub

(python: sub)


difference

//!!! - must be an override at a lower point in the hierarchy


intersection


symmetricDifference


union


format

Formats Fosc object.

Returns string.


ps


str


Instance Methods: Top Level


annotate

Annotates receiver with annotation.

  1. Annotates note with a clef.

    a = FoscNote(60, 1/4);
    a.annotate('foo', FoscClef('bass'));
    FoscInspection(a).annotation('foo').class.postln;
    FoscClef


attach

!!!TODO: attaches to FoscComponents and FoscSelections? can this method be moved lower in the tree? !!! if not, then add a test for a valid receiver type to the top of the method.

Attaches attachment to receiver.

First form attaches indicator to single leaf.

Second form attaches spanner to leaf selection.

Third form attaches grace container to leaf.

Fourth form attaches time signature to measure.

Fifth form attaches wrapper to unknown (?).

Returns nil.

  1. Attaches clef to first note in staff

    a = FoscStaff(FoscLeafMaker().(#[60,62,64,65], [1/4]));
    a[0].attach(FoscClef('bass'));
    a[0].wrappers;
    a.format;
    \new Staff {
        \clef "bass"
        c'4
        d'4
        e'4
        f'4
    }
  2. Attaches accent to last note in staff

    a = FoscStaff(FoscLeafMaker().(#[60,62,64,65], [1/4]));
    a[3].attach(FoscArticulation('>'));
    a.format;
    \new Staff {
        c'4
        d'4
        e'4
        f'4
        -\accent
    }


detach

  1. Detach by class

    a = FoscStaff(FoscLeafMaker().(#[60,62,64,65], [1/4]));
    a[0].attach(FoscArticulation('>'));
    a.format;
    \new Staff {
        c'4
        -\accent
        d'4
        e'4
        f'4
    }
    a[0].detach(FoscArticulation);
    a.format;
    \new Staff {
        c'4
        d'4
        e'4
        f'4
    }
  2. Detach by instance

    a = FoscStaff(FoscLeafMaker().(#[60,62,64,65], [1/4]));
    i = FoscArticulation('>');
    a[0].attach(i);
    a.format;
    \new Staff {
        c'4
        -\accent
        d'4
        e'4
        f'4
    }
    a[0].detach(i);
    a.format;
    \new Staff {
        c'4
        d'4
        e'4
        f'4
    }


iterate


mutate


override

Adds a LilyPond override to receiver.

  1. Example

    a = FoscNote(60, 1/4);
    override(a).noteHead.color = 'red';
    override(a).noteHead.size = 12;
    a.format;
    \once \override NoteHead.color = #red
    \once \override NoteHead.size = #12
    c'4


setting


set

  1. Example

    a = FoscStaff(FoscLeafMaker().(#[60,62,64,65], 1/8));
    set(a).instrumentName = FoscMarkup("Violin");
    a.show;


select


show

Shows object.

Makes LilyPond input files and output PDF.

Writes LilyPond input file and output PDF to Fosc output directory.

Opens output PDF.

  1. Example

    a = FoscNote(60, 1/4);
    a.show;


tweak

Attaches LilyPond tweak to receiver.

  1. Tweak markup

    a = FoscStaff(FoscLeafMaker().(#[60,62,64,65], [1/4]));
    m = FoscMarkup('Allegro assai', direction: 'above');
    tweak(m).color = 'red';
    m.format;
    - \tweak color #red
    ^\markup { "Allegro assai" }
    a[0].attach(m);
    a.format;
    \new Staff {
        c'4
        - \tweak color #red
        ^\markup { "Allegro assai" }
        d'4
        e'4
        f'4
    }
  2. Survives copy

    a = FoscStaff(FoscLeafMaker().(#[60,62,64,65], [1/4]));
    m = FoscMarkup('Allegro assai', direction: 'above');
    tweak(m).color = 'red';
    n = m.copy;
    a.leafAt(0).attach(n);
    a.format;
    \new Staff {
        c'4
        - \tweak color #red
        ^\markup { "Allegro assai" }
        d'4
        e'4
        f'4
    }
  3. Survives dot-chaining

    !!!TODO: DOES NOT SURVIVE DOT-CHAINING

    a = FoscStaff(FoscLeafMaker().(#[60,62,64,65], [1/4]));
    m = FoscMarkup('Allegro assai', direction: 'above');
    tweak(m).color = 'red';
    m = m.italic;
    a.leafAt(0).attach(m);
    a.format;
    \new Staff {
        c'4
        ^\markup {
            \italic
                "Allegro assai"
        }
        d'4
        e'4
        f'4
    }
  4. Works for opposite-directed coincident markup

    !!!TODO: DOES NOT WORK FOR OPPOSITE-DIRECTED COINCIDENT MARKUP

    a = FoscStaff(FoscLeafMaker().(#[60,62,64,65], [1/4]));
    m = FoscMarkup('Allegro assai', direction: 'above');
    tweak(m).color = 'red';
    a.leafAt(0).attach(m);
    n = FoscMarkup('... ma non troppo', direction: 'below');
    tweak(n).color = 'blue';
    tweak(n).staffPadding = 4;
    a.leafAt(0).attach(n);
    a.format;
    \new Staff {
        c'4
        - \tweak color #red
        ^\markup { "Allegro assai" }
        - \tweak color #blue
        - \tweak staff-padding #4
        _\markup { "... ma non troppo" }
        d'4
        e'4
        f'4
    }
  5. Ignored for same-directed coincident markup

    !!!TODO: NOT WORKING

    a = FoscStaff(FoscLeafMaker().(#[60,62,64,65], [1/4]));
    m = FoscMarkup('Allegro assai', direction: 'above');
    tweak(m).color = 'red';
    a.leafAt(0).attach(m);
    n = FoscMarkup('... ma non troppo', direction: 'above');
    tweak(n).color = 'blue';
    tweak(n).staffPadding = 4;
    a.leafAt(0).attach(n);
    a.format;
    \new Staff {
        c'4
        - \tweak color #red
        ^\markup { "Allegro assai" }
        - \tweak color #blue
        - \tweak staff-padding #4
        ^\markup { "... ma non troppo" }
        d'4
        e'4
        f'4
    }
  6. Tweaks note-head

    !!!TODO: NOT YET IMPLEMENTED FOR FoscComponents

    a = FoscStaff(FoscLeafMaker().(#[60,61,62,63], [1/4]));
    tweak(a[1].noteHead).color = 'red';
    a.format;
    \new Staff {
        c'4
        \tweak color #red
        cs'4
        d'4
        ef'4
    }
    a.show;

  7. Tweaks grob aggregated to note-head

    !!!TODO: NOT YET IMPLEMENTED FOR FoscComponents

    a = FoscStaff(FoscLeafMaker().(#[60,61,62,63], [1/4]));
    tweak(a[1].noteHead).accidental.color = 'red';
    a.format;
    \new Staff {
        c'4
        cs'4
        d'4
        ef'4
    }
    a.show;

  8. Returns LilyPond tweak manager

    m = FoscMarkup('Allegro assai', direction: 'above');
    tweak(m).postln;
    FoscLilypondTweakManager().prSetState(())
  9. Tweak object sessions work like this

    !!!TODO

  10. Example

    a = FoscHairpin('p < f'); // FIXME class not defined 
    b = FoscLilypondTweakManager();
    b.setTweaks(a, #[['dynamicLineSpanner', 5]]);
    a.tweaks;
    a.tweaks.prGetAttributePairs;
  11. Example

    a = FoscHorizontalBracket(); // FIXME class not defined 
    tweak(a).color = 'red';
    tweak(a).staffPadding = 5;
    a.tweaks.prGetAttributePairs;


write


writeLY


writeMIDI


writePDF


writePNG


Instance Methods: FoscSelection / FoscComponent shared interface


doComponents

  1. Iterate notes in a selection

    a = FoscLeafMaker().(#[60,62,64,65,67,69], [1/8]);
    a.doComponents({ |each, i| each.cs.postln }, FoscNote);
    FoscSelection([ FoscNote(FoscPitch("C4"), FoscDuration(1, 8)), FoscNote(FoscPitch("D4"), FoscDuration(1, 8)), FoscNote(FoscPitch("E4"), FoscDuration(1, 8)), FoscNote(FoscPitch("F4"), FoscDuration(1, 8)), FoscNote(FoscPitch("G4"), FoscDuration(1, 8)), FoscNote(FoscPitch("A4"), FoscDuration(1, 8)) ])
  2. Reverse iterate notes in a selection

    a = FoscLeafMaker().(#[60,62,64,65,67,69], [1/8]);
    a.doComponents({ |each, i| each.cs.postln }, FoscNote, reverse: true);
    FoscSelection([ FoscNote(FoscPitch("C4"), FoscDuration(1, 8)), FoscNote(FoscPitch("D4"), FoscDuration(1, 8)), FoscNote(FoscPitch("E4"), FoscDuration(1, 8)), FoscNote(FoscPitch("F4"), FoscDuration(1, 8)), FoscNote(FoscPitch("G4"), FoscDuration(1, 8)), FoscNote(FoscPitch("A4"), FoscDuration(1, 8)) ])
  3. Iterate notes in a staff

    a = FoscStaff(FoscLeafMaker().(#[60,62,64,65,67,69], [1/8]));
    a.doComponents({ |each, i| each.cs.postln }, FoscNote);
    FoscStaff([  ], 'Staff', false)
  4. Iterate all components in a staff

    a = FoscStaff(FoscLeafMaker().(#[60,62,64,65,67,69], [1/8]));
    a.doComponents({ |each, i| each.cs.postln });
    FoscStaff([  ], 'Staff', false)
  5. Iterate leaf

    a = FoscNote(60, 1/4);
    a.doComponents({ |each, i| each.cs.postln }, FoscNote);
    FoscNote('C4', 1/4)
  6. Throw error

    a = FoscDynamic('p'); 
    a.doComponents({ |each, i| each.cs.postln });
    ERROR: doComponents: receiver is not iterable: a FoscDynamic.


doLeaves

  1. Iterate all leaves

    a = FoscLeafMaker().(#[60,62,nil,65,67,nil], [1/8]);
    a.doLeaves { |each| each.cs.postln };
    FoscSelection([ FoscNote(FoscPitch("C4"), FoscDuration(1, 8)), FoscNote(FoscPitch("D4"), FoscDuration(1, 8)), FoscRest(FoscDuration(1, 8)), FoscNote(FoscPitch("F4"), FoscDuration(1, 8)), FoscNote(FoscPitch("G4"), FoscDuration(1, 8)), FoscRest(FoscDuration(1, 8)) ])
  2. Iterate pitched leaves

    a = FoscLeafMaker().(#[60,62,nil,65,67,nil], [1/8]);
    a.doLeaves({ |each| each.cs.postln }, pitched: true);
    FoscSelection([ FoscNote(FoscPitch("C4"), FoscDuration(1, 8)), FoscNote(FoscPitch("D4"), FoscDuration(1, 8)), FoscRest(FoscDuration(1, 8)), FoscNote(FoscPitch("F4"), FoscDuration(1, 8)), FoscNote(FoscPitch("G4"), FoscDuration(1, 8)), FoscRest(FoscDuration(1, 8)) ])
  3. Iterate non-pitched leaves

    a = FoscLeafMaker().(#[60,62,nil,65,67,nil], [1/8]);
    a.doLeaves({ |each| each.cs.postln }, pitched: false);
    FoscSelection([ FoscNote(FoscPitch("C4"), FoscDuration(1, 8)), FoscNote(FoscPitch("D4"), FoscDuration(1, 8)), FoscRest(FoscDuration(1, 8)), FoscNote(FoscPitch("F4"), FoscDuration(1, 8)), FoscNote(FoscPitch("G4"), FoscDuration(1, 8)), FoscRest(FoscDuration(1, 8)) ])


doLogicalTies

FIXME find better way to display or capture post output in these examples

  1. 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;

    a.selectLogicalTies.items.collect { |each| each.items.collect { |each| each.cs }}.postln;
    [ [ "FoscNote('C4', 1/4)", "FoscNote('C4', 1/16)" ], [ "FoscNote('D4', 1/8)" ], [ "FoscRest(1/8)" ], [ "FoscNote('E4', 1/4)", "FoscNote('E4', 1/4)" ] ]
  2. Iterate all logicalTies

    a.doLogicalTies { |each| each.items.collect { |each| each.postcs } };
    FoscStaff([  ], 'Staff', false)
  3. Iterate pitched logicalTies

    a.doLogicalTies({ |each| each.items.collect { |each| each.cs }.postln }, pitched: true);
    FoscStaff([  ], 'Staff', false)
  4. Iterate non-pitched logicalTies

    a.doLogicalTies({ |each| each.items.collect { |each| each.cs }.postln }, pitched: false);
    FoscStaff([  ], 'Staff', false)
  5. iterate nontrivial logicalTies

    a.doLogicalTies({ |each| each.items.collect { |each| each.cs }.postln }, nontrivial: true);
    FoscStaff([  ], 'Staff', false)
  6. Iterate trivial logicalTies

    a.doLogicalTies({ |each| each.items.collect { |each| each.cs }.postln }, nontrivial: false);
    FoscStaff([  ], 'Staff', false)
  7. Iterate logicalTies in reverse order

    a.doLogicalTies({ |each| each.items.collect { |each| each.cs }.postln }, reverse: true);
    FoscStaff([  ], 'Staff', false)


doRuns

  1. 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..]);
    t = #['bracket-flare', [0,0], 'color', 'red', 'direction', 'up', 'staff-padding', 5];
    a.doRuns { |each| each.horizontalBracket(tweaks: t) };
    a.show;


doTimeline

  1. Iterate all leaves

    a = FoscStaff(FoscLeafMaker().((60..67), [1/8]));
    b = FoscStaff(FoscLeafMaker().((60..63), [1/4]));
    c = FoscScore([a, b]);
    c.doTimeline { |each, i| each.attach(FoscMarkup(i.asString, 'above')) };
    c.show;

  2. Iterate all leaves in reverse

    a = FoscStaff(FoscLeafMaker().((60..67), [1/8]));
    b = FoscStaff(FoscLeafMaker().((60..63), [1/4]));
    c = FoscScore([a, b]);
    c.doTimeline({ |each, i| each.attach(FoscMarkup(i.asString, 'above')) }, reverse: true);
    c.show;

  3. Iterate pitched leaves

    a = FoscStaff(FoscLeafMaker().([60,61,nil,63,nil,nil,65], [1/8]));
    b = FoscStaff(FoscLeafMaker().((60..63), [1/4]));
    c = FoscScore([a, b]);
    c.doTimeline({ |each, i| each.attach(FoscMarkup(i, 'above')) }, pitched: true);
    c.show;

  4. Iterate non-pitched leaves

    a = FoscStaff(FoscLeafMaker().([60,61,nil,63,nil,nil,65], [1/8]));
    b = FoscStaff(FoscLeafMaker().((60..63), [1/4]));
    c = FoscScore([a, b]);
    c.doTimeline({ |each, i| each.attach(FoscMarkup(i, 'above')) }, pitched: false);
    c.show;


doTimelineByLogicalTies

  1. Iterate logical ties

    a = FoscStaff(FoscLeafMaker().((60..67), [5/32]));
    b = FoscStaff(FoscLeafMaker().((60..63), [5/16]));
    c = FoscScore([a, b]);
    c.doTimelineByLogicalTies({ |each, i| each.head.attach(FoscMarkup(i, 'above')) });
    c.show;

  2. Iterate pitched logical ties

    a = FoscStaff(FoscLeafMaker().(#[60,61,nil,63,nil,nil,65], [5/32]));
    b = FoscStaff(FoscLeafMaker().((60..63), [5/16]));
    c = FoscScore([a, b]);
    c.doTimelineByLogicalTies({ |each, i| each.head.attach(FoscMarkup(i, 'above')) }, pitched: true);
    c.show;


leafAt

  1. Selection

    a = FoscSelection([FoscNote(60, 1/4), FoscNote(62, 1/4)]);
    a.leafAt(1).str.postln;
    d'4
  2. Selection: pitched

    a = FoscSelection([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
    a.leafAt(0, pitched: true).str.postln;
    c'4
  3. Container

    a = FoscStaff([FoscNote(60, 1/4), FoscNote(62, 1/4)]);
    a.leafAt(1).str.postln;
    d'4
  4. Container: pitched

    a = FoscStaff([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
    a.leafAt(0, pitched: true).str.postln;
    c'4


selectComponents

  1. Select all components

    a = FoscStaff([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
    b = a.selectComponents;
    b.do { |each| each.str.postln };
    FoscSelection([ FoscStaff([  ], 'Staff', false), FoscRest(FoscDuration(1, 4)), FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscNote(FoscPitch("D4"), FoscDuration(1, 4)) ])
  2. Select notes

    a = FoscStaff([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
    b = a.selectComponents(prototype: FoscNote);
    b.do { |each| each.str.postln };
    FoscSelection([ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscNote(FoscPitch("D4"), FoscDuration(1, 4)) ])
  3. Select notes and rests

    a = FoscStaff([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
    b = a.selectComponents(prototype: [FoscNote, FoscRest]);
    b.do { |each| each.str.postln };
    FoscSelection([ FoscRest(FoscDuration(1, 4)), FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscNote(FoscPitch("D4"), FoscDuration(1, 4)) ])
  4. Select notes and rests in reverse order

    a = FoscStaff([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
    b = a.selectComponents(prototype: [FoscNote, FoscRest], reverse: true);
    b.do { |each| each.str.postln };
    FoscSelection([ FoscNote(FoscPitch("D4"), FoscDuration(1, 4)), FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscRest(FoscDuration(1, 4)) ])


selectLeaves

  1. Select all leaves

    a = FoscStaff([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
    b = a.selectLeaves;
    b.do { |each| each.str.postln };
    FoscSelection([ FoscRest(FoscDuration(1, 4)), FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscNote(FoscPitch("D4"), FoscDuration(1, 4)) ])
  2. Select pitched leaves

    a = FoscStaff([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
    b = a.selectLeaves(pitched: true);
    b.do { |each| each.str.postln };
    FoscSelection([ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscNote(FoscPitch("D4"), FoscDuration(1, 4)) ])
  3. Select non-pitched leaves

    a = FoscStaff([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
    b = a.selectLeaves(pitched: false);
    b.do { |each| each.str.postln };
    FoscSelection([ FoscRest(FoscDuration(1, 4)) ])
  4. Select leaves in reverse order

    a = FoscStaff([FoscRest(1/4), FoscNote(60, 1/4), FoscNote(62, 1/4)]);
    b = a.selectLeaves(reverse: true);
    b.do { |each| each.str.postln };
    FoscSelection([ FoscNote(FoscPitch("D4"), FoscDuration(1, 4)), FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscRest(FoscDuration(1, 4)) ])


selectLogicalTies

Selects logical ties.

Returns new selection.

  1. 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;

  2. Select all logicalTies

    b = a.selectLogicalTies;
    b.do { |each| each.items.collect { |each| each.cs }.postln };
    FoscSelection([ FoscLogicalTie([ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscNote(FoscPitch("C4"), FoscDuration(1, 16)) ]), FoscLogicalTie([ FoscNote(FoscPitch("D4"), FoscDuration(1, 8)) ]), FoscLogicalTie([ FoscRest(FoscDuration(1, 8)) ]), FoscLogicalTie([ FoscNote(FoscPitch("E4"), FoscDuration(1, 4)), FoscNote(FoscPitch("E4"), FoscDuration(1, 4)) ]) ])
  3. Select pitched logicalTies

    b = a.selectLogicalTies(pitched: true);
    b.do { |each| each.items.collect { |each| each.cs }.postln };
    FoscSelection([ FoscLogicalTie([ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscNote(FoscPitch("C4"), FoscDuration(1, 16)) ]), FoscLogicalTie([ FoscNote(FoscPitch("D4"), FoscDuration(1, 8)) ]), FoscLogicalTie([ FoscNote(FoscPitch("E4"), FoscDuration(1, 4)), FoscNote(FoscPitch("E4"), FoscDuration(1, 4)) ]) ])
  4. Select non-pitched logicalTies

    b = a.selectLogicalTies(pitched: false);
    b.do { |each| each.items.collect { |each| each.cs }.postln };
    FoscSelection([ FoscLogicalTie([ FoscRest(FoscDuration(1, 8)) ]) ])
  5. Select nontrivial logicalTies

    b = a.selectLogicalTies(nontrivial: true);
    b.do { |each| each.items.collect { |each| each.cs }.postln };
    FoscSelection([ FoscLogicalTie([ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscNote(FoscPitch("C4"), FoscDuration(1, 16)) ]), FoscLogicalTie([ FoscNote(FoscPitch("E4"), FoscDuration(1, 4)), FoscNote(FoscPitch("E4"), FoscDuration(1, 4)) ]) ])
  6. Select trivial logicalTies

    b = a.selectLogicalTies(nontrivial: false);
    b.do { |each| each.items.collect { |each| each.cs }.postln };
    FoscSelection([ FoscLogicalTie([ FoscNote(FoscPitch("D4"), FoscDuration(1, 8)) ]), FoscLogicalTie([ FoscRest(FoscDuration(1, 8)) ]) ])
  7. Select logicalTies in reverse order

    b = a.selectLogicalTies(reverse: true);
    b.do { |each| each.items.collect { |each| each.cs }.postln };
    FoscSelection([ FoscLogicalTie([ FoscNote(FoscPitch("E4"), FoscDuration(1, 4)), FoscNote(FoscPitch("E4"), FoscDuration(1, 4)) ]), FoscLogicalTie([ FoscRest(FoscDuration(1, 8)) ]), FoscLogicalTie([ FoscNote(FoscPitch("D4"), FoscDuration(1, 8)) ]), FoscLogicalTie([ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscNote(FoscPitch("C4"), FoscDuration(1, 16)) ]) ])


selectRuns

Select runs.

  1. 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..]);
    a.selectRuns.do { |each| each.horizontalBracket(tweaks: #[['direction', 'up']]) };
    a.show;


isPlaying


pause


play


resume


stop