FoscPitchSet

Returns a FoscPitchSet.


Description

A pitch set.

NB: abjad.PitchSet subclasses from Set not TypedSet


Attributes Summary

Instance Methods

pitchNumbers
pitchNames
difference Set-theoretic difference of receiver and expr.
sect Set-theoretic intersection of receiver and expr.
isDisjoint Is true when typed receiver shares no elements with expr. Otherwise false.
isEmpty Is true when pitch class set is empty.
isSubsetOf Is true when receiver is a subset of expr. Otherwise false.
isSupersetOf Is true when receiver is a superset of expr. Otherwise false.
notEmpty Is true when set is not empty.
symmetricDifference Symmetric difference of receiver and expr.
union Union of receiver and expr.
invert
isEquivalentUnderTransposition True if receiver is equivalent to pitchSet under transposition.
register Registers pitchClasses by pitch set.
transpose Transposes all pitches in pitch set by semitones.
illustrate
play


Usage

  1. Example

    x = FoscPitchSet(#[60,61,62]);
    x.cs;
    FoscPitchSet([
        FoscPitch('C4'),
        FoscPitch('C#4'),
        FoscPitch('D4')
    ])
    x.size;
    3
    x.pitchNumbers;
    [ 60.0, 61.0, 62.0 ]
    x.pitchNames;
    [ "C4", "C#4", "D4" ]


Instance Methods


pitchNumbers


pitchNames


difference

Set-theoretic difference of receiver and expr.

Returns new pitch class set.

  1. Example

    a = FoscPitchSet(#[61,62,63]);
    b = FoscPitchSet(#[62,63,64]);
    a.difference(b).items.collect { |each| each.pitchNumber };
    [ 61.0 ]


sect

Set-theoretic intersection of receiver and expr.

Returns new pitch class set.

  1. Example

    a = FoscPitchSet(#[61,62,63]);
    b = FoscPitchSet(#[62,63,64]);
    a.sect(b).items.collect { |each| each.pitchNumber };
    [ 62.0, 63.0 ]


isDisjoint

Is true when typed receiver shares no elements with expr. Otherwise false.

Returns boolean.

  1. Example

    a = FoscPitchSet(#[60,61]);
    b = FoscPitchSet(#[61,62,63]);
    c = FoscPitchSet(#[64,65]);
    
    a.isDisjoint(a);
    false
    a.isDisjoint(b);
    false
    a.isDisjoint(c);
    true


isEmpty

Is true when pitch class set is empty.

Returns boolean.

  1. Example

    a = FoscPitchSet(#[61,62,63]);
    a.isEmpty;
    false
    a = FoscPitchSet([]);
    a.isEmpty;
    true


isSubsetOf

Is true when receiver is a subset of expr. Otherwise false.

Returns boolean.

  1. Example

    a = FoscPitchSet(#[61,62,63]);
    b = FoscPitchSet(#[62,63]);
    
    a.isSubsetOf(a);
    true
    a.isSubsetOf(b);
    false
    b.isSubsetOf(a);
    true


isSupersetOf

Is true when receiver is a superset of expr. Otherwise false.

Returns boolean.

  1. Example

    a = FoscPitchSet(#[61,62,63]);
    b = FoscPitchSet(#[62,63]);
    
    a.isSupersetOf(a);
    true
    a.isSupersetOf(b);
    true
    b.isSupersetOf(a);
    false


notEmpty

Is true when set is not empty.

Returns boolean.

  1. Example

    a = FoscPitchSet(#[61,62,63]);
    a.notEmpty;
    true
    a = FoscPitchSet([]);
    a.notEmpty;
    false


symmetricDifference

Symmetric difference of receiver and expr.

Returns new pitch class set.

  1. Example

    a = FoscPitchSet(#[61,62,63]);
    b = FoscPitchSet(#[62,63,64]);
    a.symmetricDifference(b).cs;
    FoscPitchSet([
        FoscPitch('C#4'),
        FoscPitch('E4')
    ])


union

Union of receiver and expr.

Returns new pitch class set.

  1. Example

    a = FoscPitchSet(#[61,62,63]);
    b = FoscPitchSet(#[62,63,64]);
    a.union(b).cs;
    FoscPitchSet([
        FoscPitch('C#4'),
        FoscPitch('D4'),
        FoscPitch('Eb4'),
        FoscPitch('E4')
    ])


invert

  1. Example

    a = FoscPitchSet(#[61,62,63]);
    b = a.invert(60);
    b.cs;
    FoscPitchSet([
        FoscPitch('A3'),
        FoscPitch('Bb3'),
        FoscPitch('B3')
    ])


isEquivalentUnderTransposition

True if receiver is equivalent to pitchSet under transposition.

Otherwise false.

  1. Example

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


register

Registers pitchClasses by pitch set.

Returns list of zero or more numbered pitches.


transpose

Transposes all pitches in pitch set by semitones.

Returns new pitch set.

  1. Example

    a = FoscPitchSet(#[61,62,63]);
    b = a.transpose(3);
    b.cs;
    FoscPitchSet([
        FoscPitch('E4'),
        FoscPitch('F4'),
        FoscPitch('F#4')
    ])


illustrate


play