Libraries.Sound.Chord Documentation

This class represents a chord. A chord is a collection of notes that are played together, at the same time.

Example Code

use Libraries.Sound.Music
    use Libraries.Sound.Chord

    // Play a C major chord.
    Music muse
    Chord c
    c:Add(60) // C
    c:Add(64) // E
    c:Add(67) // G
    muse:Play(c)

Inherits from: Libraries.Language.Object, Libraries.Sound.Playable, Libraries.Sound.MusicEvent

Summary

Actions Summary Table

ActionsDescription
Add(integer pitch)Add a new pitch to this chord.
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns a CompareResult.
Copy()Perform a deep copy of this object.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetConstantPitchBend()Get the constant pitch bend of this event in cents.
GetEventType()Returns the event type for this event.
GetHashCode()This action gets the hash code for an object.
GetLength()Get the length of the note.
GetPitches()Get all the pitches from this chord.
GetPrePitchBend()Get the pre pitch bend of this event in cents.
GetPrePitchBendLength()Get the duration of pre pitch bend.
GetStartTime()Get the start time of the note.
GetVolume()Get the volume of the note.
SetConstantPitchBend(integer constantBend)Sets the constant pitch bend of this event in cents.
SetEventType(integer eventType)Set the event type for this event.
SetLength(number len)Set the length of the note.
SetPrePitchBend(integer preBend)Sets the pre pitch bend of this event in cents.
SetPrePitchBendLength(integer preBendLength)Set the duration of the pre pitch bend.
SetStartTime(integer time)Set the start time of the note.
SetVolume(number vol)Set the volume of the note.

Actions Documentation

Add(integer pitch)

Add a new pitch to this chord. When the chord is played, all the pitches will sound at once.

Example Code

use Libraries.Sound.Music
        use Libraries.Sound.Chord

        Music muse
        Chord c
        c:Add(60) // C

Parameters

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

Example Code

use Libraries.Language.Support.CompareResult
        Object o
        Object t
        CompareResult result = o:Compare(t)

Parameters

Return

Libraries.Language.Support.CompareResult: The Compare result, Smaller, Equal, or Larger.

Copy()

Perform a deep copy of this object.

Example Code

use Libraries.Sound.Music
        use Libraries.Sound.Chord

        Music muse
        Chord c
        c:Add(60) // C
        Object newChord = c:Copy()

Return

Libraries.Language.Object: the new Chord

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

GetConstantPitchBend()

Get the constant pitch bend of this event in cents.

Return

integer: the pitch bend

GetEventType()

Returns the event type for this event.

Example Code

use Libraries.Sound.MusicEvent

        MusicEvent event
        output event:GetEventType()

Return

integer: the event type.

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

GetLength()

Get the length of the note.

Return

number: the length

GetPitches()

Get all the pitches from this chord.

Example Code

use Libraries.Sound.Music
        use Libraries.Sound.Chord
        use Libraries.Containers.Iterator

        Music muse
        Chord c
        c:Add(60) // C
        Iterator<integer> notes = c:GetPitches()

Return

Libraries.Containers.Iterator: an iterator of the pitches.

GetPrePitchBend()

Get the pre pitch bend of this event in cents.

Return

integer: the pre pitch bend in cents.

GetPrePitchBendLength()

Get the duration of pre pitch bend. The duration specifies how long it takes the bend to reach its target note.

Return

integer: the duration of the pre pitch bend.

GetStartTime()

Get the start time of the note.

Return

integer: the start time

GetVolume()

Get the volume of the note.

Return

number: the volume of the note.

SetConstantPitchBend(integer constantBend)

Sets the constant pitch bend of this event in cents.

Parameters

SetEventType(integer eventType)

Set the event type for this event.

Example Code

use Libraries.Sound.MusicEvent

        MusicEvent event
        event:SetEventType(0)

Parameters

SetLength(number len)

Set the length of the note.

Parameters

SetPrePitchBend(integer preBend)

Sets the pre pitch bend of this event in cents.

Parameters

SetPrePitchBendLength(integer preBendLength)

Set the duration of the pre pitch bend. The duration specifies how long it takes the bend to reach its target note.

Parameters

SetStartTime(integer time)

Set the start time of the note.

Parameters

SetVolume(number vol)

Set the volume of the note.

Parameters