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

Actions Documentation

Add(integer pitch)

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

Parameters

  • integer pitch: the pitch to add

Example

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

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

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Example

Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Copy()

Perform a deep copy of this object.

Return

Libraries.Language.Object: the new Chord

Example

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

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

Equals(Libraries.Language.Object object)

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

Parameters

Return

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

Example

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

GetConstantPitchBend()

Get the constant pitch bend of this event in cents.

Return

integer: the pitch bend

GetEventType()

Returns the event type for this event.

Return

integer: the event type.

Example

use Libraries.Sound.MusicEvent

MusicEvent event
output event:GetEventType()

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

GetLength()

Get the length of the note.

Return

number: the length

GetPitches()

Get all the pitches from this chord.

Return

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

Example

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()

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

  • integer constantBend

SetEventType(integer eventType)

Set the event type for this event.

Parameters

  • integer eventType: the event type for this event.

Example

use Libraries.Sound.MusicEvent

MusicEvent event
event:SetEventType(0)

SetLength(number len)

Set the length of the note.

Parameters

  • number len: the length of the note.

SetPrePitchBend(integer preBend)

Sets the pre pitch bend of this event in cents.

Parameters

  • integer preBend: the pre pitch bend in cents (-200 to +200).

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

  • integer preBendLength: the duration of the pre pitch bend.

SetStartTime(integer time)

Set the start time of the note.

Parameters

  • integer time: the start time.

SetVolume(number vol)

Set the volume of the note.

Parameters

  • number vol: the volume of the note. (0.0 to 1.0).