jazzElements

Documentation Status

The primary goal of this package is to help in the analysis of a chord progression and facilitate learning of jazz standards. It will also suggest alternative chords, progressions, scales etc For example, we can enter a progression as a string, ask to analyse then plot the results. Each cell shows the chord, its degree in the corresponding scale, and optionally the corresponding notes.

The full documentation can be found on ReadTheDocs

Hint

The best resource i found to learn about jazz and music theory, check it out:

Warning

I am coding this in parallel to trying to finally understand music theory. This is in active dev with surely a good amount of hacks and bugs. Feel free to contribute/submit issues or ideas.

A chord progression can be defined using a chord string (e.g. ‘|DbM7,E9|AM7,C9|FM7|Bm9,E9|AM7,C9|FM7,Ab9|’) or using a named progression (e.g. ‘Misty’) We can then annotate a chord progression:

>>> prg = Progression('Misty')
>>> prg.annotate()
>>> prg.plot('fn')
and plot the harmonic analysis
_images/MistyFn.png

or a keyboard representation of chords (top) and scales (bottom):

>>> prg.plot('kbd')
_images/MistyKbd.png

The analysis can be made for example using the major/minor chord progression from the book Tonal Harmony by Stefan Kostka

_images/seqMajKostka.png

Major Kostka Progression

_images/seqMinKostka.png

Minor Kostka Progression

Plot all Chords in a given Scale:

>>> Scale('C minor').plotChords()
_images/allChords.png

Plot m7 for all roots:

_images/allKeys.png

Plot implemented chords:

_images/implementedChords.png

Examples

Warning

Dev in progress, more coming soon

Scale

Printing the chords built from the modes of the C key:

>>> import pandas as pd
>>> key = 'C'
>>> lst = {}
>>> for mode in Scale.modesLst:
>>>     if mode is not 'Chr':
>>>         C = Scale(key, mode).chords()
>>>         lst[key + ' ' + mode] = [str(c.root) + c.type for c in C]
>>> print(pd.DataFrame(lst,index=range(1,len(lst)+1)).T)

Returns:

>>>            1     2     3    4     5     6     7
>>>   C Aeo  Cm7    Dø  D♯M7  Fm7   Gm7  G♯M7   A♯7
>>>   C Dor  Cm7   Dm7  D♯M7   F7   Gm7    Aø  A♯M7
>>>   C Ion  CM7   Dm7   Em7  FM7    G7   Am7    Bø
>>>   C Loc   Cø  C♯M7  D♯m7  Fm7  F♯M7   G♯7  A♯m7
>>>   C Lyd  CM7    D7   Em7  F♯ø   GM7   Am7   Bm7
>>>   C Mix   C7   Dm7    Eø  FM7   Gm7   Am7  A♯M7
>>>   C Phr  Cm7  C♯M7   D♯7  Fm7    Gø  G♯M7  A♯m7

Progressions

Training on major 2-5-1s

To train on 2-5-1 cadences, one can generate the progression then plot the analysis and the associated keyboards. We can then use the keyboard view to play the chords (upper keyboard) with the left hand, and the associated scale (lower keyboard) with the right hand.

>>> # Generating the 4 notes 2-5-1s for every root:
>>> seq=''.join(['|{},{}|{}'.format(
>>>     Scale(key,'ion').getDegree(2,nbNotes=4),
>>>     Scale(key,'ion').getDegree(5,nbNotes=4),
>>>     Scale(key,'ion').getDegree(1,nbNotes=4) ) for key in Note.chrFlat])
>>> prg=Progression(chr,name='Maj 2-5-1s')
>>> prg.annotate()
>>> prg.plot('fn') # Plot the analysis view
>>> prg.plot('kbd') # Plot the keyboard view
_images/maj251sFn.png _images/maj251sKbd.png

Training on minor 2-5-1s

Likewise, we can train on 4 notes chords in the harmonic minor 2-5-1s

>>> # Generating the 4 notes 2-5-1s for every root:
>>> seq=''.join(['|{},{}|{}'.format(
>>>     Scale(key,'hMin').getDegree(2,nbNotes=4),
>>>     Scale(key,'hMin').getDegree(5,nbNotes=4),
>>>     Scale(key,'hMin').getDegree(1,nbNotes=4) ) for key in Note.chrFlat])
>>> prg=Progression(chr,name='Min 2-5-1s')
>>> prg.annotate()
>>> prg.plot('fn') # Plot the analysis view
>>> prg.plot('kbd') # Plot the keyboard view
_images/min251sFn.png _images/min251sKbd.png

Annotation

Implemented cadence Graphs

Following are examples of detected cadences. They can be obtained using CadenceGraph().plot()

Kostka transitions (C Major):

_images/kostkaMaj.png

Kostka transitions (C Harmonic minor):

_images/kostkaMin.png

Allow all transitions (C Major):

_images/allTransMaj.png

Allow all transitions (C Harmonic Major):

_images/allTransMin.png

Only allow main cadences (C Major):

_images/mainCadMaj.png

Only allow main cadences (C Harmonic minor):

_images/mainCadMin.png

Notes

Notes are the most basic element, they can be defined as Note(‘E♯’),Note(‘Cb’), and perform simplification (e.g. Note(‘Gb♭#♯’)) or alteration (e.g. Note(‘C’,-2) in semitones).

Uses

  code output
Transposition Note(‘C’)+2 D♯
Note difference Note(‘A’)-Note(‘F#’) 3
Comparison Note(‘F##’)==Note(‘Abb’) True

Chords

Chords are built on notes, and can be instantiated from a string (e.g. c = Chord(‘Em7’) ) or from a list of notes strings (e.g. c = Chord([‘C’,’E’,’G’]) ) or Notes

Basic attributes

  code output
Chord notes Chord(‘Cdim’).notes [C, E♭, G♭]
Distances from root in semitones Chord(‘Cdim’).intArr [0, 3, 6]
Chord intervals Chord(‘Cdim’).intStr [‘1’, ‘♭3’, ‘♭5’]
Chord quality Chord(‘Cdim’).quality ‘dim’

Basic members

  code output
Guide Tones (3rd,7th) Chord(‘Cm7’).guideTones() [E♭, B♭]
Relative minor chord Chord(‘C’).relativeMinor() Chord(‘Am’) or ‘Am’ if asStr=True
Relative major chord Chord(‘Cm’).relativeMajor() Chord(‘D♯M’) or ‘D♯M’ if asStr=True
Plot a chord Chord(‘Cm’).plot() _images/Cm.png
Chord comparison Chord(‘Cm7’) == Chord(‘EbM6’) True as they have the same notes

Scales

Scales can be instantiated as s=Scale(root=’C’, mode=’ion’) or Scale(‘C hm’). Attributes ———-

  code output
Root Scale(‘D# min’).root Note(‘D♯’)
Mode Scale(‘D# min’).mode ‘Aeo’
Name Scale(‘D# min’).name ‘D♯ Aeo’

Hint

A good way to remember modes order is the mnemonic “(I) (D)on’t (P)articularly (L)ike (M)odes (A) (L)ot”

Basic operations

  code output
Notes Scale(‘C’).notes() [C, D, E, F, G, A, B]
Transposition (Scale(‘C’)+3).notes() [D♯, F, G, G♯, A♯, C, D]
Comparison Scale(‘C’)== Scale(‘D’) False
Diatonic Chords Scale(‘C’).chords() [CM7, Dm7, Em7…]
Roman Notation Scale(‘C’).chordsRoman() [‘IM7’, ‘iim7’, ‘iiim7’…]
Degrees Quality Scale(‘C’).degreesQuality() [‘maj’, ‘min’, ‘min’…]
Check if a chord is diatonic Scale(‘C’).hasChord(‘Cm’) False, or degree if in scale
Intervals Scale(‘C’).intervals() [2, 2, 1, 2, 2, 2, 1] in semitones
Intervals (strings) Scale(‘C’).intervals(asStr=True) ‘w-w-h-w-w-w-h’
Parallel minor Scale(‘C’).parallelMinor() C Aeo | C D D♯ F G G♯ A♯
Parallel modes Scale(‘C’).parallelModes() [C Dor, C Phr, C Lyd…]
RelativeMinor Scale(‘C’).relativeMinor() A Aeo | A B C D E F G
RelativeMajor Scale(‘C Aeo’).relativeMajor() D♯ Ion | D♯ F G G♯ A♯ C D
Plotting scale chords Scale(‘C min’).plotChords() _images/scaleCminChords.png
RelativeModes Scale(‘C’).relativeModes() [D Dor, E Phr, F Lyd…]
Plotting a chord Scale(‘C min’).plot() _images/scaleCmin.png

Progression

Progressions hold chords, and the analysis results. They are instantiated using a chord string as in ‘|Fm7,Bb7|EbM7|%|Bbm7,Eb7|’ or using a named progression e.g. ‘Misty’

Warning

Dev in progress, more coming soon

Annotate

Warning

Dev in progress, more coming soon

jazzElements

Documentation Status

The primary goal of this package is to help in the analysis of a chord progression and facilitate learning of jazz standards. It will also suggest alternative chords, progressions, scales etc For example, we can enter a progression as a string, ask to analyse then plot the results. Each cell shows the chord, its degree in the corresponding scale, and optionally the corresponding notes.

The full documentation can be found on ReadTheDocs

Hint

The best resource i found to learn about jazz and music theory, check it out:

Warning

I am coding this in parallel to trying to finally understand music theory. This is in active dev with surely a good amount of hacks and bugs. Feel free to contribute/submit issues or ideas.

A chord progression can be defined using a chord string (e.g. ‘|DbM7,E9|AM7,C9|FM7|Bm9,E9|AM7,C9|FM7,Ab9|’) or using a named progression (e.g. ‘Misty’) We can then annotate a chord progression:

>>> prg = Progression('Misty')
>>> prg.annotate()
>>> prg.plot('fn')
and plot the harmonic analysis
_images/MistyFn.png

or a keyboard representation of chords (top) and scales (bottom):

>>> prg.plot('kbd')
_images/MistyKbd.png

The analysis can be made for example using the major/minor chord progression from the book Tonal Harmony by Stefan Kostka

_images/seqMajKostka.png

Major Kostka Progression

_images/seqMinKostka.png

Minor Kostka Progression

Plot all Chords in a given Scale:

>>> Scale('C minor').plotChords()
_images/allChords.png

Plot m7 for all roots:

_images/allKeys.png

Plot implemented chords:

_images/implementedChords.png

Indices and tables