FoscPitch

Returns a FoscPitch.


Description

Pitch


Attributes Summary

Instance Properties

accidentalName
alterationInSemitones
diatonicPitchClassName
diatonicPitchClassNumber
diatonicPitchName
diatonicPitchNumber
isDiatonic
isFlattened
isSharpened
lilypondPitchName
midicps
octaveName
octaveNumber
pitchClassName
pitchClassNumber
pitchName
pitchNumber

Instance Methods: Special Methods

== (abjad: eq)
!=
> Is true when arg can be coerced to a pitch and when this pitch is greater than arg. Otherwise false.
>= Is true when arg can be coerced to a pitch and when this pitch is greater than or equal to arg. Otherwise false.
< Is true when arg can be coerced to a pitch and when this pitch is less than arg. Otherwise false.
<= Is true when arg can be coerced to a pitch and when this pitch is less than or equal to arg. Otherwise false.
add (abjad: add)
asCompileString
asFloat (abjad: float)
asInteger (abjad: int)
neg Negates numbered pitch.
storeArgs
str (abjad: str)
pitchString
sub

Instance Methods: Transformations

applyAccidental
multiply Multiplies pitch-class of numbered pitch by n and maintains octave.
invert
respellWithFlats
respellWithSharps code::
toStaffPosition Changes named pitch to staff position.
transpose

Instance Methods: Display

show
play
inspect


Usage

  1. Quantize to 1/8th tones

    a = FoscPitch(60.25);
    a.pitchNumber;
    60.25
    a.str;
    cr'
    a = FoscPitch(60.75);
    a.pitchNumber;
    60.75
    a.str;
    csl'
  2. Example

    a = FoscPitch("C4", arrow: 'up');
    a.pitchNumber;
    60.25
    a.str;
    cr'
    a = FoscPitch("C#4", arrow: 'down');
    a.pitchNumber;
    60.75
    a.str;
    csl'


Instance Properties


accidentalName

  1. Example

    FoscPitch('Db5').accidentalName;
    f
  2. Example

    FoscPitch('Db5', arrow: 'up').accidentalName;
    fr


alterationInSemitones

  1. Example

    FoscPitch('Db5').alterationInSemitones;
    -1.0
  2. Example

    FoscPitch('Db5', arrow: 'down').alterationInSemitones;
    -1.25


diatonicPitchClassName

  1. Example

    FoscPitch('Db5').diatonicPitchClassName;
    D


diatonicPitchClassNumber

  1. Example

    FoscPitch('Db5').diatonicPitchClassNumber;
    2


diatonicPitchName

  1. Example

    FoscPitch('Db5').diatonicPitchName;
    D5


diatonicPitchNumber

  1. Example

    FoscPitch('Db5').diatonicPitchNumber;
    74


isDiatonic

  1. Example

    FoscPitch('Db5').isDiatonic;
    false


isFlattened

  1. Example

    FoscPitch('Db5').isFlattened;
    false


isSharpened

  1. Example

    FoscPitch('Db5').isSharpened;
    false


lilypondPitchName

  1. Example

    FoscPitch('Db5').lilypondPitchName;
    df''
  2. Example

    FoscPitch('Db5', arrow: 'up').lilypondPitchName;
    dfr''


midicps

  1. Example

    FoscPitch('A4').midicps;
    440.0


octaveName

  1. Example

    FoscPitch('Db5').octaveName;
    5


octaveNumber

  1. Example

    FoscPitch('Db5').octaveNumber;
    5


pitchClassName

  1. Example

    FoscPitch('Db5').pitchClassName;
    Db


pitchClassNumber

  1. Example

    FoscPitch('Db5').pitchClassNumber;
    1.0
  2. Example

    FoscPitch('Db5', arrow: 'up').pitchClassNumber;
    1.0


pitchName

  1. Example

    FoscPitch('Db5').pitchName;
    Db5


pitchNumber

  1. Example

    FoscPitch('Db~5').pitchNumber;
    72.5
    FoscPitch(61.5).pitchNumber;
    61.5
    FoscPitch('C4', arrow: 'up').pitchNumber;
    60.25


Instance Methods: Special Methods


==

(abjad: eq)

  1. Example

    a = FoscPitch('C#4');
    b = FoscPitch('Db4');
    c = FoscPitch('B3');
    a == a;
    true
    a == b; // Enharmonic equivalents are treated as equal
    true
    a == c;
    false


!=

  1. Example

    a = FoscPitch('C#4');
    b = FoscPitch('Db4');
    c = FoscPitch('B3');
    a != b; // Enharmonic equivalents are treated as equal
    false
    a != c;
    true
    a != a;
    false


>

Is true when arg can be coerced to a pitch and when this pitch is greater than arg. Otherwise false.

Returns true or false.

  1. Example

    a = FoscPitch('C#4');
    b = FoscPitch('D#4');
    c = FoscPitch('B3');
    a > b;
    false
    a > c;
    true
    a > a;
    false


>=

Is true when arg can be coerced to a pitch and when this pitch is greater than or equal to arg. Otherwise false.

Returns true or false.

  1. Example

    a = FoscPitch('C#4');
    b = FoscPitch('D#4');
    c = FoscPitch('B3');
    a >= a;
    true
    a >= b;
    false
    a >= c;
    true


<

Is true when arg can be coerced to a pitch and when this pitch is less than arg. Otherwise false.

Returns true or false.

  1. Example

    a = FoscPitch('C#4');
    b = FoscPitch('D#4');
    c = FoscPitch('B3');
    a < b;
    true
    a < c;
    false
    a < a;
    false


<=

Is true when arg can be coerced to a pitch and when this pitch is less than or equal to arg. Otherwise false.

Returns true or false.

  1. Example

    a = FoscPitch('C#4');
    b = FoscPitch('D#4');
    c = FoscPitch('B3');
    a <= a;
    true
    a <= b;
    true
    a <= c;
    false


add

(abjad: add)

Adds arg to numberd pitch.

Returns new numbered pitch.

  1. Example

    x = FoscPitch('C#4');
    x = x + 2;
    x.pitchName;
    Eb4
    x = FoscPitch('C#4') + FoscInterval(2);
    x.pitchName;
    Eb4


asCompileString


asFloat

(abjad: float)

Changes numbered pitch to float.

Returns float.

  1. Example

    x = FoscPitch('C+4');
    x.asFloat;
    60.5


asInteger

(abjad: int)

Changes numbered pitch to integer.

Returns integer.

  1. Example

    x = FoscPitch('C+4');
    x.asInt;
    60


neg

Negates numbered pitch.

Returns new numbered pitch.

  1. Example

    a = FoscPitch('C#4');
    b = a.neg;
    b.pitchNumber;
    -61.0


storeArgs


str

(abjad: str)

  1. Example

    a = FoscPitch('C#4');
    a.str;
    cs'
  2. •••••••••••••••••••• TODO

    a = FoscPitch('C#4', arrow: 'up');
    a.str;
    csr'


pitchString

  1. Example

    a = FoscPitch('C#4');
    a.pitchString;
    a.ps;
    "C#4"


sub


Instance Methods: Transformations


applyAccidental


multiply

Multiplies pitch-class of numbered pitch by n and maintains octave.

Returns new numbered pitch.

  1. Example

    a = FoscPitch(62);
    a = a.multiply(3);
    a.pitchNumber;
    66.0


invert

  1. Example

    x = FoscPitch('Eb4');
    x = x.invert(axis: 'D4');
    x.pitchName;
    C#4


respellWithFlats

  1. Example

    x = FoscPitch('C#4');
    x.pitchName;
    x = x.respellWithFlats;
    x.pitchName;
    Db4


respellWithSharps

code:: x = FoscPitch(Db4); x.pitchName; x = x.respellWithSharps; x.pitchName;

  1. • respellWithSharps

    x = FoscPitch('Db4');
    x.pitchName;
    x = x.respellWithSharps;
    x.pitchName;
    C#4


toStaffPosition

Changes named pitch to staff position.


transpose

  1. Example

    x = FoscPitch('A4');
    x = x.transpose(semitones: 6);
    x.pitchName;
    Eb5


Instance Methods: Display


show


play


inspect

  1. Example

    FoscPitch("C#5").inspect;
    FoscPitch('C#5')