Ellis - Swift music library


Ellis is named after Jazz Guitarrist Herb Ellis
Ellis is currently used on LetsComp
These examples are taken from a playground in the project
| Example |
Output |
Comment |
| Note.A.Name |
"A" |
|
| Note.A.frequency() |
440 |
Frequency defaults to OneLine Octave |
| Note.A.frequency(Octave.TwoLine) |
880 |
If required can pass octave for frequency |
| Note.A.flat() |
AFlat |
|
| Note.A.sharp() |
ASharp |
|
| Note.A == Note.A |
true |
|
| Note.A == Note.C |
false |
|
| Example |
Output |
| Note.A.intervalWithNote(Note.ASharp) |
MinorSecond |
| Note.A.intervalWithNote(Note.B) |
MajorSecond |
| Note.A.transpose(Interval.MinorSecond) |
ASharp |
| Note.A.transpose(Interval.MajorSecond) |
B |
| Note.A.measureAbsoluteSemitones(Note.C) |
3 |
| Interval.createIntervalFromDistance(1) |
MinorSecond |
| Example |
Output |
| Key.CMajor |
CMajor |
| Key.CMajor.keyNotes |
[C, D, E, F, G, A, B] |
| Key.CMajor.KeyNoteNames |
["C", "D", "E", "F", "G", "A", "B"] |
| Key.CMajor.quality |
Major |
| Key.AMinor.quality |
Minor |
| Key.CMajor.rootName |
"C" |
| Key.CMajor.degreeForNote(Note.A) |
6 |
| Key.CMajor.degreeForNote(Note.ASharp) |
Thows exception |
| Key.CMajor.relativeKey |
AMinor |
| Key.CMajor.i() |
C |
let cmaj = ChordBuilder(root: Note.C)
.addMajorThird()
.addPerfectFifth()
.build()
| Example |
Output |
| cmaj.name |
"CMaj" |
| cmaj.noteNames |
["C", "E", "G"] |
let cmaj7 = ChordBuilder(root: Note.C, chordFunction: ChordFunction.Major7)
.build()
| Example |
Output |
| cmaj7.name |
"CMaj7" |
| cmaj7.noteNames |
["C", "E", "G", "B"] |
| cmaj7.functions |
[Root, Third, Fifth, Seventh] |
| cmaj7.noteFunctionNames |
["R", "3", "5", "7"] |
| cmaj7.ChordNotes |
[{C, Root}, {E, Third}, {G, Fifth}, {B, Seventh}] |
| cmaj7.Inversion |
Root |
| cmaj7.bass |
C |
| cmaj7.lead |
B |
| cmaj7.Shape |
Closed |
| cmaj7.noteByFunction(NoteFunction.Fifth) |
G |
| cmaj7 == cmaj7 |
true |
| cmaj == cmaj7 |
false |
let gmaj7 = cmaj7.transpose(Note.G)
| Example |
Output |
| gmaj7.name |
"GMaj7" |
| gmaj7.notes |
[G, B, D, FSharp] |
let firstInversion = cmaj7.invert()
| Example |
Output |
| firstInversion.notes |
[E, G, B, C] |
| firstInversion.Inversion |
First |
let secondInversion = firstInversion.invert()
| Example |
Output |
| secondInversion.notes |
[G, B, C, E] |
| secondInversion.Inversion |
Second |
let thirdInversion = secondInversion.invert()
| Example |
Output |
| thirdInversion.notes |
[B, C, E, G] |
| thirdInversion.Inversion |
Third |
let drop2 = cmaj7.toDrop2()
| Example |
Output |
| drop2.notes |
[C, G, B, E] |
let drop3 = cmaj7.toDrop3()
| Example |
Output |
| drop3.notes |
[C, B, E, G] |
let inversionWithFunctionInLead = cmaj7.voiceForLead(NoteFunction.Third)
| Example |
Output |
| inversionWithFunctionInLead.notes |
[G, B, C, E] |
| inversionWithFunctionInLead.Inversion |
Second |
let inversionWithFunctionInBass = cmaj7.voiceForBass(NoteFunction.Third)
| Example |
Output |
| inversionWithFunctionInBass.notes |
[E, G, B, C] |
| inversionWithFunctionInBass.Inversion |
First |
let invertionWithLeadClosestToNote = cmaj7.invertionWithLeadClosestToNote(Note.F)
| Example |
Output |
| invertionWithLeadClosestToNote.notes |
[G, B, C, E] |
| invertionWithLeadClosestToNote.Inversion |
Second |
let invertionWithLeadClosestToNote1 = cmaj7.invertionWithLeadClosestToNote(Note.GSharp)
| Example |
Output |
| invertionWithLeadClosestToNote1.notes |
[B, C, E, G] |
| invertionWithLeadClosestToNote1.Inversion |
Third |
let triadHarmonizer = TriadsKeyHarmonizer(key: Key.CMajor)
| Example |
Output |
| triadHarmonizer.i().name |
"CMaj" |
| triadHarmonizer.ii().name |
"DMin" |
| triadHarmonizer.iii().name |
"EMin" |
| triadHarmonizer.iv().name |
"FMaj" |
| triadHarmonizer.v().name |
"GMaj" |
| triadHarmonizer.vi().name |
"AMin" |
| triadHarmonizer.vii().name |
"BDim" |
let seventhsHarmonizer = SeventhsKeyHarmonizer(key: Key.CMajor)
| Example |
Output |
| seventhsHarmonizer.i().name |
"CMaj7" |
| seventhsHarmonizer.ii().name |
"DMin7" |
| seventhsHarmonizer.iii().name |
"EMin7" |
| seventhsHarmonizer.iv().name |
"FMaj7" |
| seventhsHarmonizer.v().name |
"GDom7" |
| seventhsHarmonizer.vi().name |
"AMin7" |
| seventhsHarmonizer.vii().name |
"Bmin7b5" |
Scale is a melodic minor but when harmonizing its treated as a harmonic minor.
let seventhsHarmonizerMinor = SeventhsKeyHarmonizer(key: Key.AMinor)
| Example |
Output |
| seventhsHarmonizerMinor.i().name |
"AMinMaj7" |
| seventhsHarmonizerMinor.ii().name |
"BMin7b5" |
| seventhsHarmonizerMinor.iii().name |
"CAug7" |
| seventhsHarmonizerMinor.iv().name |
"DMin7" |
| seventhsHarmonizerMinor.v().name |
"EDom7" |
| seventhsHarmonizerMinor.vi().name |
"FMaj7" |
| seventhsHarmonizerMinor.vii().name |
"G#Dim7" |