FoscPitchSegment

Returns a FoscPitchSegment.


Description

Pitch segment


Attributes Summary

Instance Methods: Special Methods

asCompileString
==
!=
storeArgs
str

Instance Methods

pitches
pitchNumbers
pitchNames
pitchString
invert Inverts pitch segment about axis.
isEquivalentUnderTransposition True if pitch set is equivalent to expr under transposition.
makeNotes
multiply Multiplies pitch segment.
reverse Retrograde of pitch segment.
rotate Rotates pitch segment.
transpose Transposes pitch segment by expr.
hasDuplicates True if pitch segment has duplicate items. Otherwise false.
midicps (abjad: hertz)
inflectionPointCount Inflection point count of pitch segment.
localMaxima Local maxima of pitch segment.
localMinima Local minima of pitch segment.
maxItem
minItem code::

Instance Methods: Display

illustrate
inspect
play
show


Usage

  1. Example

    n = [60, 62, 64];
    FoscPitchSegment(n).cs;
    FoscPitchSegment([
        FoscPitch('C4'),
        FoscPitch('D4'),
        FoscPitch('E4')
    ])
  2. Example

    n = "Bb4 F#5 C4 Cb4 E+4 G4 D+5";
    FoscPitchSegment(n).cs;
    FoscPitchSegment([
        FoscPitch('Bb4'),
        FoscPitch('F#5'),
        FoscPitch('C4'),
        FoscPitch('Cb4'),
        FoscPitch('E+4'),
        FoscPitch('G4'),
        FoscPitch('D+5')
    ])
  3. FoscPitchSegment does not wrap FoscPitchSegments

    n = "Bb4 F#5 <C4 Cb4> E+4 G4 D+5";
    FoscPitchSegment(n).cs;
    ERROR: Meta_FoscPitchSegment:new: item a FoscPitchSegment is the wrong type: FoscPitchSegment.


Instance Methods: Special Methods


asCompileString

  1. Example

    FoscPitchSegment([60, 62, 64]).cs;
    FoscPitchSegment([
        FoscPitch('C4'),
        FoscPitch('D4'),
        FoscPitch('E4')
    ])


==


!=


storeArgs


str

  1. Example

    FoscPitchSegment([60, 62, 64]).str;
    <c' d' e'>


Instance Methods


pitches


pitchNumbers


pitchNames


pitchString


invert

Inverts pitch segment about axis.

Returns new pitch segment.

  1. Example

    a = FoscPitchSegment([60, 61, 62, 63]);
    b = a.invert(66);
    b.pitchNumbers;
    [ 72.0, 71.0, 70.0, 69.0 ]
    a = FoscPitchSegment([60, 61, 62, 63]);
    b = a.invert;
    b.pitchNumbers;
    [ 60.0, 59.0, 58.0, 57.0 ]


isEquivalentUnderTransposition

True if pitch set is equivalent to expr under transposition.

Otherwise false.

Returns true or false.

  1. Example

    a = FoscPitchSegment([60, 61, 62]);
    b = FoscPitchSegment([61, 62, 63]);
    c = FoscPitchSegment([60, 61, 63]);
    isEquivalentUnderTransposition(a, b);
    true
    isEquivalentUnderTransposition(a, c);
    false
    isEquivalentUnderTransposition(a, a);
    true


makeNotes


multiply

Multiplies pitch segment.

Returns new pitch segment.

code:: a = FoscPitchSegment([60, 61, 62]); b = a.multiply(3); b.pitchNumbers;


reverse

Retrograde of pitch segment.

Returns new pitch segment.

  1. Example

    a = FoscPitchSegment([60, 61, 62]);
    b = a.retrograde;
    b.pitchNumbers;
    prFormatCodeString interpret initial failed: a DoesNotUnderstandError
    
        a = FoscPitchSegment([60, 61, 62]);
        b = a.retrograde;
    


rotate

Rotates pitch segment.

Returns new pitch segment.

  1. Example

    a = FoscPitchSegment([60, 61, 62]);
    b = a.rotate(-1);
    b.pitchNumbers;
    [ 61.0, 62.0, 60.0 ]
    a = FoscPitchSegment([60, 61, 62]);
    b = a.rotate(-1, transpose: true);
    b.pitchNumbers;
    [ 60.0, 61.0, 59.0 ]


transpose

Transposes pitch segment by expr.

Returns new pitch segment.

  1. Example

    a = FoscPitchSegment([60, 61, 62]);
    b = a.transpose(1);
    b.pitchNumbers;
    [ 61.0, 62.0, 63.0 ]
    a = FoscPitchSegment([60, 61, 62]);
    b = a.transpose([12, 14, 16]);
    b.pitchNumbers;
    [ 72.0, 75.0, 78.0 ]


hasDuplicates

True if pitch segment has duplicate items. Otherwise false.

Returns true or false.

  1. Example

    a = FoscPitchSegment([60, 61, 62]);
    a.hasDuplicates;
    false
    a = FoscPitchSegment([60, 60, 61, 62]);
    a.hasDuplicates;
    true


midicps

(abjad: hertz)

Gets hertz of pitches in pitch segment.

Returns tuple.

  1. Example

    a = FoscPitchSegment([60, 61, 62]);
    a.midicps;
    [ 261.6255653006, 277.18263097687, 293.66476791741 ]


inflectionPointCount

Inflection point count of pitch segment.

Returns nonnegative integer.

  1. Example

    a = FoscPitchSegment([60, 61, 62, 63, 64, 65, 66, 68, 81, 65, 59, 63, 84, 60]);
    a.inflectionPointCount;
    3


localMaxima

Local maxima of pitch segment.

Returns array.

code:: a = FoscPitchSegment([60, 61, 62, 63, 64, 65, 66, 68, 81, 65, 59, 63, 84, 60]); a.localMaxima.collect { |each| each.pitchNumber };


localMinima

Local minima of pitch segment.

Returns array

  1. Example

    a = FoscPitchSegment([60, 61, 62, 63, 64, 65, 66, 68, 81, 65, 59, 63, 84, 60]);
    a.localMinima.collect { |each| each.pitchNumber };
    [ 59.0 ]


maxItem

  1. Example

    a = FoscPitchSegment([60, 61, 62, 63, 64, 65, 66, 68, 81, 65, 59, 63, 84, 60]);
    a.maxItem.pitchNumber;
    84.0


minItem

code:: a = FoscPitchSegment([60, 61, 62, 63, 64, 65, 66, 68, 81, 65, 59, 63, 84, 60]); a.minItem.pitchNumber;


Instance Methods: Display


illustrate

  1. Example

    a = FoscPitchSegment([60, 61, 62, 63, 64, 65, 66, 68, 81, 65, 59, 63, 84, 60]);
    a.illustrate.format;
    a.show;


inspect


play


show

  1. Example

    a = FoscPitchSegment([60, 61, 62, 63, 64, 65, 66, 68, 81, 65, 59, 63, 84, 60]);
    a.show;