Section Chords
Chord class and other chords utility functions, like extracting chords from the chord line of a staff.
- See
- Chord for raw music theory
Class
Class | Summary |
---|---|
Chord | Chord building, accept more notations than builtin HA chords. |
Summary
Return type | Function and summary |
---|---|
table | GetChordsFromStaff(Score score, Staff staff, bool held) Get the chords of a staff from the chord line and return detailed informations. |
Function
GetChordsFromStaff(Score score, Staff staff, bool held)
Get the chords of a staff from the chord line and return detailed informations.
This is useful to build bass and chords accompaniments, perform analysis, or whatever you want. The returned structure is a table, indexed from 1 to number of chords. Each element is a
- Chord: a Chord object, able to understand more complex notations than HA. From this object, you can obtain the list of notes, chord octave, bass octave (2 octaves lower), inversion...
- BarNumber: the bar number where the chord is writed
- TimeBegin: time (in tick, from the beginning of the score), where the chord starts to play
- TimeEnd: time (in ticks, from the beginning of the score), where the chord ends, juste before next chord or an empty cell/bar.
- ArppegioDelay: by default,
staff.ChordArpeggioDelay
. May change if [Annn] command has been encountered in chord line.
Parameter | Type | Default | Description |
---|---|---|---|
score | Score | ||
staff | Staff | ||
held | bool | nil | Hold chord until next is encountered? If nil, use the chord line setup of the staff. HA needs underscore (_) to hold a chord, but this is unsightly for printing, and works randomly. |
- Return
- table:
- See
- Chord for more details about Chord object.
- Example
local chords = GetChordsFromStaff(FrontScore(), FrontScore().FirstStaff) for i=1,getn(chords) do print("Chord #" .. i .. ": "..chords[i].Chord:toASCIIName()) print("Bar #" .. chords[i].BarNumber) print(tdebug(chords[i].Chord:notes())) end