music21.tablature

Music21 representation of FretNote and FretBoard objects.

TODO: Chord from Figure Chord from FretBoard Object with tuning.

BassGuitarFretBoard

class music21.tablature.BassGuitarFretBoard(fretNotes=None, displayFrets=4)

BassGuitarFretBoard bases

BassGuitarFretBoard methods

Methods inherited from FretBoard:

ChordWithFretBoard

class music21.tablature.ChordWithFretBoard(figure=None, numStrings=6, fretNotes=None, displayFrets=4, **keywords)

Music21Object subclass that combines a ChordSymbol with a FretBoard. Tuning must be set!

>>> fn4 = tablature.FretNote(string=4, fret=0)
>>> fn3 = tablature.FretNote(string=3, fret=2, fingering=2)
>>> fn2 = tablature.FretNote(string=2, fret=3, fingering=3)
>>> fn1 = tablature.FretNote(string=1, fret=2, fingering=4)
>>> cwf = tablature.ChordWithFretBoard('Dm', fretNotes=[fn1, fn2, fn3, fn4])

ChordWithFretBoard bases

ChordWithFretBoard read-only properties

Read-only properties inherited from Chord:

Read-only properties inherited from Music21Object:

ChordWithFretBoard read/write properties

Read/write properties inherited from Harmony:

Read/write properties inherited from Chord:

Read/write properties inherited from NotRest:

Read/write properties inherited from GeneralNote:

Read/write properties inherited from Music21Object:

ChordWithFretBoard methods

ChordWithFretBoard.getFretNotesFromFigure()

TODO: Given a chord with fret Figure, getFretNotesFromFigure returns each FretNote object within it.

Methods inherited from ChordSymbol:

Methods inherited from Harmony:

Methods inherited from Chord:

Methods inherited from NotRest:

Methods inherited from GeneralNote:

Methods inherited from Music21Object:

Methods inherited from FretBoard:

ChordWithFretBoard instance variables

Instance variables inherited from Chord:

Instance variables inherited from NotRest:

Instance variables inherited from GeneralNote:

Instance variables inherited from Music21Object:

FirstFret

class music21.tablature.FirstFret(fretNum, location='right')

FirstFretInfo returns the information regarding the first fret utilized in a given chord position.

FretBoard

class music21.tablature.FretBoard(numStrings=6, fretNotes=None, displayFrets=4)

A FretBoard represents a displayed fretboard (i.e. used in chord symbols). To be displayed, a fretboard requires a tuning system, defined by the fretted instrument classes defined.

>>> fn1 = tablature.FretNote(string=3, fret=2, fingering=1)
>>> fn2 = tablature.FretNote(string=2, fret=3, fingering=3)
>>> fn3 = tablature.FretNote(string=1, fret=2, fingering=2)
>>> fb = tablature.FretBoard(6, fretNotes=[fn1, fn2, fn3], displayFrets=5)
>>> fb.numStrings
6
>>> fb
<music21.tablature.FretBoard 6 strings, 3 notes, 5 frets>
>>> len(fb.fretNotes)
3
>>> fb.fretNotes[0]
<music21.tablature.FretNote 3rd string, 2nd fret, 1st finger>
>>> fb.getFretNoteByString(2)
<music21.tablature.FretNote 2nd string, 3rd fret, 3rd finger>

FretBoard methods

FretBoard.fretNotesLowestFirst()

Returns a list of FretNotes in lowest to highest string order.

>>> firstNote = tablature.FretNote(string=2, fret=3, fingering=4)
>>> secondNote = tablature.FretNote(string=3, fret=3, fingering=3)
>>> thirdNote = tablature.FretNote(string=1, fret=3, fingering=3)
>>> myFretBoard = tablature.FretBoard(6, fretNotes=[firstNote, secondNote, thirdNote])
>>> for thisFretNote in myFretBoard.fretNotesLowestFirst():
...    print(thisFretNote)
<music21.tablature.FretNote 3rd string, 3rd fret, 3rd finger>
<music21.tablature.FretNote 2nd string, 3rd fret, 4th finger>
<music21.tablature.FretNote 1st string, 3rd fret, 3rd finger>
FretBoard.getFretNoteByString(requestedString)

Returns FretNote object on a given string or None if there are none.

>>> firstNote = tablature.FretNote(string=6, fret=3, fingering=4)
>>> secondNote = tablature.FretNote(string=2, fret=3, fingering=3)
>>> myFretBoard = tablature.FretBoard(6, fretNotes=[firstNote, secondNote])
>>> myFretBoard.getFretNoteByString(6)
<music21.tablature.FretNote 6th string, 3rd fret, 4th finger>
>>> myFretBoard.getFretNoteByString(2)
<music21.tablature.FretNote 2nd string, 3rd fret, 3rd finger>
>>> myFretBoard.getFretNoteByString(9) is None
True
FretBoard.getPitches()

Returns a list of all the pitches (or None for each) given the FretNote information. This requires a tuning to be set.

>>> firstNote = tablature.FretNote(string=4, fret=3, fingering=3)
>>> secondNote = tablature.FretNote(string=2, fret=1, fingering=1)
>>> gfb = tablature.GuitarFretBoard(fretNotes=[firstNote, secondNote])
>>> gfb.getPitches()
[None, None, <music21.pitch.Pitch F3>, None, <music21.pitch.Pitch C4>, None]

What if the User provides an empty FretBoard? >>> gfb2 = tablature.GuitarFretBoard(fretNotes=[]) >>> gfb2.getPitches() [None, None, None, None, None, None]

Works for other stringed instruments, as long as the tuning is included (see below).

>>> tablature.UkeleleFretBoard().numStrings
4
>>> uke = tablature.UkeleleFretBoard(fretNotes=[firstNote, secondNote])
>>> uke.getPitches()
[<music21.pitch.Pitch B-4>, None, <music21.pitch.Pitch F4>, None]

FretNote

class music21.tablature.FretNote(string=None, fret=None, fingering=None)

A FretNote represents a note on a Fretboard, where each string should be fingered (or not).

>>> fn = tablature.FretNote(3, 4, 1)
>>> fn
<music21.tablature.FretNote 3rd string, 4th fret, 1st finger>
>>> fn.string
3
>>> fn.fret
4
>>> fn.fingering
1
>>> fn.displayFingerNumber
True
>>> fnStupid = tablature.FretNote()
>>> fnStupid.string is None
True

GuitarFretBoard

class music21.tablature.GuitarFretBoard(fretNotes=None, displayFrets=4)

GuitarFretBoard bases

GuitarFretBoard methods

Methods inherited from FretBoard:

MandolinFretBoard

class music21.tablature.MandolinFretBoard(fretNotes=None, displayFrets=4)

MandolinFretBoard bases

MandolinFretBoard methods

Methods inherited from FretBoard:

UkeleleFretBoard

class music21.tablature.UkeleleFretBoard(fretNotes=None, displayFrets=4)

UkeleleFretBoard bases

UkeleleFretBoard methods

Methods inherited from FretBoard: