API Reference

General functions

guitarpro.__init__.parse(stream, format=None, encoding=None)[source]

Open a GP file and read its contents.

Parameters:
  • stream – path to a GP file or file-like object.
  • format – explicitly set format of GP file.
  • encoding – decode strings in tablature using this charset. Given encoding must be an 8-bit charset.
guitarpro.__init__.write(song, stream, format=None, encoding=None)[source]

Write a song into GP file.

Parameters:
  • song – a guitarpro.base.GPFileBase instance.
  • stream – path to save GP file or file-like object.
  • format – explicitly set format of saved GP file.
  • encoding – encode strings into given 8-bit charset.

Models

class guitarpro.base.GPObject(*args, **kwargs)[source]

GPObject is the base of all Guitar Pro objects.

GPObjects are able to compute hash and be compared one to other. To create new GPObject subclass all attribute names must specified in tuple GPObject.__attr__. The order of attributes is important as it is provides positional arguments for GPObject.__init__().

class guitarpro.base.RepeatGroup[source]

This class can store the information about a group of measures which are repeated.

class guitarpro.base.Song(*args, **kwargs)[source]

This is the top-level node of the song model.

It contains basic information about the stored song.

class guitarpro.base.LyricLine(*args, **kwargs)[source]

A lyrics line.

class guitarpro.base.Lyrics(*args, **kwargs)[source]

Represents a collection of lyrics lines for a track.

class guitarpro.base.Point(*args, **kwargs)[source]

A point construct using floating point coordinates.

class guitarpro.base.Padding(*args, **kwargs)[source]

A padding construct.

class guitarpro.base.HeaderFooterElements[source]

A list of the elements which can be shown in the header and footer of a rendered song sheet.

All values can be combined using bit-operators as they are flags.

class guitarpro.base.PageSetup(*args, **kwargs)[source]

The page setup describes how the document is rendered.

Page setup contains page size, margins, paddings, and how the title elements are rendered.

Following template vars are available for defining the page texts:

  • %title%: will be replaced with Song.title
  • %subtitle%: will be replaced with Song.subtitle
  • %artist%: will be replaced with Song.artist
  • %album%: will be replaced with Song.album
  • %words%: will be replaced with Song.words
  • %music%: will be replaced with Song.music
  • %WORDSANDMUSIC%: will be replaced with the according word and music values
  • %copyright%: will be replaced with Song.copyright
  • %N%: will be replaced with the current page number (if supported by layout)
  • %P%: will be replaced with the number of pages (if supported by layout)
class guitarpro.base.Tempo(*args, **kwargs)[source]

A song tempo in BPM.

class guitarpro.base.MidiChannel(*args, **kwargs)[source]

A MIDI channel describes playing data for a track.

class guitarpro.base.DirectionSign(*args, **kwargs)[source]

A navigation sign like Coda or Segno.

class guitarpro.base.MeasureHeader(*args, **kwargs)[source]

A measure header contains metadata for measures over multiple tracks.

class guitarpro.base.Color(*args, **kwargs)[source]

An RGB Color.

class guitarpro.base.Marker(*args, **kwargs)[source]

A marker annotation for beats.

class guitarpro.base.TrackSettings(*args, **kwargs)[source]

Settings of the track.

class guitarpro.base.Track(*args, **kwargs)[source]

A track contains multiple measures.

class guitarpro.base.GuitarString(*args, **kwargs)[source]

A guitar string with a special tuning.

class guitarpro.base.Tuplet(*args, **kwargs)[source]

Represents a n:m tuplet.

class guitarpro.base.Duration(*args, **kwargs)[source]

A duration.

class guitarpro.base.MeasureClef[source]

A list of available clefs.

class guitarpro.base.LineBreak[source]

A line break directive.

none = <LineBreak.none: 0>

No line break.

break_ = <LineBreak.break_: 1>

Break line.

protect = <LineBreak.protect: 2>

Protect the line from breaking.

class guitarpro.base.Measure(header, *args, **kwargs)[source]

A measure contains multiple voices of beats.

class guitarpro.base.VoiceDirection[source]

Voice directions indicating the direction of beams.

class guitarpro.base.Voice(*args, **kwargs)[source]

A voice contains multiple beats.

class guitarpro.base.BeatStrokeDirection[source]

All beat stroke directions.

class guitarpro.base.BeatStroke(*args, **kwargs)[source]

A stroke effect for beats.

class guitarpro.base.SlapEffect[source]

Characteristic of articulation.

none = <SlapEffect.none: 0>

No slap effect.

tapping = <SlapEffect.tapping: 1>

Tapping.

slapping = <SlapEffect.slapping: 2>

Slapping.

popping = <SlapEffect.popping: 3>

Popping.

class guitarpro.base.BeatEffect(*args, **kwargs)[source]

This class contains all beat effects.

class guitarpro.base.BeatDisplay(*args, **kwargs)[source]

Parameters of beat display.

class guitarpro.base.Octave[source]

Octave signs.

class guitarpro.base.Beat(*args, **kwargs)[source]

A beat contains multiple voices.

class guitarpro.base.HarmonicEffect(*args, **kwargs)[source]

A harmonic note effect.

class guitarpro.base.GraceEffectTransition[source]

All transition types for grace notes.

none = <GraceEffectTransition.none: 0>

No transition.

slide = <GraceEffectTransition.slide: 1>

Slide from the grace note to the real one.

bend = <GraceEffectTransition.bend: 2>

Perform a bend from the grace note to the real one.

hammer = <GraceEffectTransition.hammer: 3>

Perform a hammer on.

class guitarpro.base.GraceEffect(*args, **kwargs)[source]

A grace note effect.

durationTime

Get the duration of the effect.

class guitarpro.base.TrillEffect(*args, **kwargs)[source]

A trill effect.

class guitarpro.base.TremoloPickingEffect(*args, **kwargs)[source]

A tremolo picking effect.

class guitarpro.base.SlideType[source]

Lists all supported slide types.

class guitarpro.base.NoteEffect(*args, **kwargs)[source]

Contains all effects which can be applied to one note.

class guitarpro.base.Note(*args, **kwargs)[source]

Describes a single note.

class guitarpro.base.Chord(length, *args, **kwargs)[source]

A chord annotation for beats.

class guitarpro.base.ChordType[source]

Type of the chord.

major = <ChordType.major: 0>

Major chord.

seventh = <ChordType.seventh: 1>

Dominant seventh chord.

majorSeventh = <ChordType.majorSeventh: 2>

Major seventh chord.

sixth = <ChordType.sixth: 3>

Add sixth chord.

minor = <ChordType.minor: 4>

Minor chord.

minorSeventh = <ChordType.minorSeventh: 5>

Minor seventh chord.

minorMajor = <ChordType.minorMajor: 6>

Minor major seventh chord.

minorSixth = <ChordType.minorSixth: 7>

Minor add sixth chord.

suspendedSecond = <ChordType.suspendedSecond: 8>

Suspended second chord.

suspendedFourth = <ChordType.suspendedFourth: 9>

Suspended fourth chord.

seventhSuspendedSecond = <ChordType.seventhSuspendedSecond: 10>

Seventh suspended second chord.

seventhSuspendedFourth = <ChordType.seventhSuspendedFourth: 11>

Seventh suspended fourth chord.

diminished = <ChordType.diminished: 12>

Diminished chord.

augmented = <ChordType.augmented: 13>

Augmented chord.

power = <ChordType.power: 14>

Power chord.

class guitarpro.base.Barre(*args, **kwargs)[source]

A single barre.

Parameters:
  • start – first string from the bottom of the barre.
  • end – last string on the top of the barre.
class guitarpro.base.Fingering[source]

Left and right hand fingering used in tabs and chord diagram editor.

unknown = <Fingering.unknown: -2>

Unknown (used only in chord editor).

open = <Fingering.open: -1>

Open or muted.

thumb = <Fingering.thumb: 0>

Thumb.

index = <Fingering.index: 1>

Index finger.

middle = <Fingering.middle: 2>

Middle finger.

annular = <Fingering.annular: 3>

Annular finger.

little = <Fingering.little: 4>

Little finger.

class guitarpro.base.ChordAlteration[source]

Tonality of the chord.

perfect = <ChordAlteration.perfect: 0>

Perfect.

diminished = <ChordAlteration.diminished: 1>

Diminished.

augmented = <ChordAlteration.augmented: 2>

Augmented.

class guitarpro.base.ChordExtension[source]

Extension type of the chord.

none = <ChordExtension.none: 0>

No extension.

ninth = <ChordExtension.ninth: 1>

Ninth chord.

eleventh = <ChordExtension.eleventh: 2>

Eleventh chord.

thirteenth = <ChordExtension.thirteenth: 3>

Thirteenth chord.

class guitarpro.base.PitchClass(*args, **kwargs)[source]

A pitch class.

Constructor provides several overloads. Each overload provides keyword argument intonation that may be either “sharp” or “flat”.

First of overloads is (tone, accidental):

Parameters:
  • tone – integer of whole-tone.
  • accidental – flat (-1), none (0) or sharp (1).
>>> p = PitchClass(4, -1)
>>> vars(p)
{'accidental': -1, 'intonation': 'flat', 'just': 4, 'value': 3}
>>> print p
Eb
>>> p = PitchClass(4, -1, intonation='sharp')
>>> vars(p)
{'accidental': -1, 'intonation': 'flat', 'just': 4, 'value': 3}
>>> print p
D#

Second, semitone number can be directly passed to constructor:

Parameters:semitone – integer of semitone.
>>> p = PitchClass(3)
>>> print p
Eb
>>> p = PitchClass(3, intonation='sharp')
>>> print p
D#

And last, but not least, note name:

Parameters:name – string representing note.
>>> p = PitchClass('D#')
>>> print p
D#
class guitarpro.base.BeatText(*args, **kwargs)[source]

A text annotation for beats.

class guitarpro.base.MixTableItem(*args, **kwargs)[source]

A mix table change describes several track changes.

class guitarpro.base.WahState[source]

State of wah-wah pedal.

off = <WahState.off: -2>

Wah-wah is off.

none = <WahState.none: -1>

No wah-wah.

opened = <WahState.opened: 0>

Wah-wah is opened.

closed = <WahState.closed: 100>

Wah-wah is closed.

class guitarpro.base.MixTableChange(*args, **kwargs)[source]

A MixTableChange describes several track changes.

class guitarpro.base.BendType[source]

All Bend presets.

none = <BendType.none: 0>

No Preset.

bend = <BendType.bend: 1>

A simple bend.

bendRelease = <BendType.bendRelease: 2>

A bend and release afterwards.

bendReleaseBend = <BendType.bendReleaseBend: 3>

A bend, then release and rebend.

prebend = <BendType.prebend: 4>

Prebend.

prebendRelease = <BendType.prebendRelease: 5>

Prebend and then release.

dip = <BendType.dip: 6>

Dip the bar down and then back up.

dive = <BendType.dive: 7>

Dive the bar.

releaseUp = <BendType.releaseUp: 8>

Release the bar up.

invertedDip = <BendType.invertedDip: 9>

Dip the bar up and then back down.

return_ = <BendType.return_: 10>

Return the bar.

releaseDown = <BendType.releaseDown: 11>

Release the bar down.

class guitarpro.base.BendPoint(*args, **kwargs)[source]

A single point within the BendEffect.

getTime(duration)[source]

Gets the exact time when the point need to be played (MIDI).

Parameters:duration – the full duration of the effect.
class guitarpro.base.BendEffect(*args, **kwargs)[source]

This effect is used to describe string bends and tremolo bars.

semitoneLength = 1

The note offset per bend point offset.

maxPosition = 12

The max position of the bend points (x axis)

maxValue = 12

The max value of the bend points (y axis)

class guitarpro.base.TripletFeel[source]

A list of different triplet feels.

none = <TripletFeel.none: 0>

No triplet feel.

eighth = <TripletFeel.eighth: 1>

Eighth triplet feel.

sixteenth = <TripletFeel.sixteenth: 2>

Sixteenth triplet feel.

class guitarpro.base.TimeSignature(*args, **kwargs)[source]

A time signature.

class guitarpro.base.Velocities[source]

A list of velocities / dynamics.

class guitarpro.base.RSEMasterEffect(*args, **kwargs)[source]

Master effect as seen on “Score information”.

class guitarpro.base.RSEEqualizer(*args, **kwargs)[source]

Equalizer found in master effect and track effect.

Attribute RSEEqualizer.knobs is a list of values in range from -6.0 to 5.9. Master effect has 10 knobs, track effect has 3 knobs. Gain is a value in range from -6.0 to 5.9 which can be found in both master and track effects and is named as “PRE” in Guitar Pro 5.

class guitarpro.base.Accentuation[source]

Values of auto-accentuation on the beat found in track RSE settings.

none = <Accentuation.none: 0>

No auto-accentuation.

verySoft = <Accentuation.verySoft: 1>

Very soft accentuation.

soft = <Accentuation.soft: 2>

Soft accentuation.

medium = <Accentuation.medium: 3>

Medium accentuation.

strong = <Accentuation.strong: 4>

Strong accentuation.

veryStrong = <Accentuation.veryStrong: 5>

Very strong accentuation.

Basic Guitar Pro 3—5 types

Byte

Values of type Byte are stored in 1 byte.

Signed byte

Values of type Signed byte are stored in 1 byte.

Bool

Values of type Bool are stored in 1 byte.

Short

Values of type Short are stored in 2 little-endian bytes.

Int

Values of type Int are stored in 4 little-endian bytes.

Float

Values of type Float are stored in 4 little-endian bytes.

Double

Values of type Double are stored in 8 little-endian bytes.

ByteSizeString

Values of type ByteSizeString are represented by length of the string (1 Byte) followed by characters encoded in an 8-bit charset.

IntSizeString

Values of type IntSizeString are represented by length of the string (1 Int) followed by characters encoded in an 8-bit charset.

IntByteSizeString

Values of type IntByteSizeString are represented by Int holding length of the string increased by 1, a Byte holding length of the string and finally followed by characters encoded in an 8-bit charset.

Guitar Pro 3 format

class guitarpro.gp3.GP3File(data=None, encoding=None)[source]

A reader for GuitarPro 3 files.

readSong()[source]

Read the song.

A song consists of score information, triplet feel, tempo, song key, MIDI channels, measure and track count, measure headers, tracks, measures.

readInfo(song)[source]

Read score information.

Score information consists of sequence of IntByteSizeStrings:

  • title
  • subtitle
  • artist
  • album
  • words
  • copyright
  • tabbed by
  • instructions

The sequence if followed by notice. Notice starts with the number of notice lines stored in Int. Each line is encoded in IntByteSizeString.

readMidiChannels()[source]

Read MIDI channels.

Guitar Pro format provides 64 channels (4 MIDI ports by 16 channels), the channels are stored in this order:

  • port1/channel1
  • port1/channel2
  • ...
  • port1/channel16
  • port2/channel1
  • ...
  • port4/channel16

Each channel has the following form:

readMeasureHeaders(song, measureCount)[source]

Read measure headers.

The measures are written one after another, their number have been specified previously.

Parameters:measureCount – number of measures to expect.
readMeasureHeader(number, song, previous=None)[source]

Read measure header.

The first byte is the measure’s flags. It lists the data given in the current measure.

  • 0x01: numerator of the key signature
  • 0x02: denominator of the key signature
  • 0x04: beginning of repeat
  • 0x08: end of repeat
  • 0x10: number of alternate ending
  • 0x20: presence of a marker
  • 0x40: tonality of the measure
  • 0x80: presence of a double bar

Each of these elements is present only if the corresponding bit is a 1.

The different elements are written (if they are present) from lowest to highest bit.

Exceptions are made for the double bar and the beginning of repeat whose sole presence is enough, complementary data is not necessary.

  • Numerator of the key signature: Byte.
  • Denominator of the key signature: Byte.
  • End of repeat: Byte. Number of repeats until the previous beginning of repeat.
  • Number of alternate ending: Byte.
  • Marker: see GP3File.readMarker().
  • Tonality of the measure: 2 Bytes. These values encode a key signature change on the current piece. First byte is key signature root, second is key signature type.
readMarker(header)[source]

Read marker.

The markers are written in two steps. First is written an integer equal to the marker’s name length + 1, then a string containing the marker’s name. Finally the marker’s color is written.

readColor()[source]

Read color.

Colors are used by guitarpro.base.Marker and guitarpro.base.Track. They consist of 3 consecutive bytes and one blank byte.

readTracks(song, trackCount, channels)[source]

Read tracks.

The tracks are written one after another, their number having been specified previously in GP3File.readSong().

Parameters:trackCount – number of tracks to expect.
readTrack(number, channels)[source]

Read track.

The first byte is the track’s flags. It presides the track’s attributes:

  • 0x01: drums track
  • 0x02: 12 stringed guitar track
  • 0x04: banjo track
  • 0x08: blank
  • 0x10: blank
  • 0x20: blank
  • 0x40: blank
  • 0x80: blank

Flags are followed by:

  • Name: ByteSizeString. A 40 characters long string containing the track’s name.
  • Number of strings: Int. An integer equal to the number of strings of the track.
  • Tuning of the strings: List of 7 Ints. The tuning of the strings is stored as a 7-integers table, the “Number of strings” first integers being really used. The strings are stored from the highest to the lowest.
  • Port: Int. The number of the MIDI port used.
  • Channel. See GP3File.readChannel().
  • Number of frets: Int. The number of frets of the instrument.
  • Height of the capo: Int. The number of the fret on which a capo is set. If no capo is used, the value is 0.
  • Track’s color. The track’s displayed color in Guitar Pro.
readChannel(channels)[source]

Read MIDI channel.

MIDI channel in Guitar Pro is represented by two integers. First is zero-based number of channel, second is zero-based number of channel used for effects.

readMeasures(song)[source]

Read measures.

Measures are written in the following order:

  • measure 1/track 1
  • measure 1/track 2
  • ...
  • measure 1/track m
  • measure 2/track 1
  • measure 2/track 2
  • ...
  • measure 2/track m
  • ...
  • measure n/track 1
  • measure n/track 2
  • ...
  • measure n/track m
readMeasure(measure)[source]

Read measure.

The measure is written as number of beats followed by sequence of beats.

readBeat(start, voice)[source]

Read beat.

The first byte is the beat flags. It lists the data present in the current beat:

  • 0x01: dotted notes
  • 0x02: presence of a chord diagram
  • 0x04: presence of a text
  • 0x08: presence of effects
  • 0x10: presence of a mix table change event
  • 0x20: the beat is a n-tuplet
  • 0x40: status: True if the beat is empty of if it is a rest
  • 0x80: blank

Flags are followed by:

getBeat(voice, start)[source]

Get beat from measure by start time.

readDuration(flags)[source]

Read beat duration.

Duration is composed of byte signifying duration and an integer that maps to guitarpro.base.Tuplet.

The byte maps to following values:

  • -2: whole note
  • -1: half note
  • 0: quarter note
  • 1: eighth note
  • 2: sixteenth note
  • 3: thirty-second note

If flag at 0x20 is true, the tuplet is read.

readChord(stringCount)[source]

Read chord diagram.

First byte is chord header. If it’s set to 0, then following chord is written in default (GP3) format. If chord header is set to 1, then chord diagram in encoded in more advanced (GP4) format.

readOldChord(chord)[source]

Read chord diagram encoded in GP3 format.

Chord diagram is read as follows:

  • Name: IntByteSizeString. Name of the chord, e.g. Em.
  • First fret: Int. The fret from which the chord is displayed in chord editor.
  • List of frets: 6 Ints. Frets are listed in order: fret on the string 1, fret on the string 2, ..., fret on the string 6. If string is untouched then the values of fret is -1.
readNewChord(chord)[source]

Read new-style (GP4) chord diagram.

New-style chord diagram is read as follows:

readText()[source]

Read beat text.

Text is stored in IntByteSizeString.

readBeatEffects(effect)[source]

Read beat effects.

The first byte is effects flags:

  • 0x01: vibrato
  • 0x02: wide vibrato
  • 0x04: natural harmonic
  • 0x08: artificial harmonic
  • 0x10: fade in
  • 0x20: tremolo bar or slap effect
  • 0x40: beat stroke direction
  • 0x80: blank
  • Tremolo bar or slap effect: Byte. If it’s 0 then tremolo bar should be read (see readTremoloBar()). Else it’s tapping and values of the byte map to:
    • 1: tap
    • 2: slap
    • 3: pop
  • Beat stroke direction. See readBeatStroke().
readTremoloBar()[source]

Read tremolo bar beat effect.

The only type of tremolo bar effect Guitar Pro 3 supports is dip. The value of the effect is encoded in Int and shows how deep tremolo bar is pressed.

readBeatStroke()[source]

Read beat stroke.

Beat stroke consists of two Bytes which correspond to stroke up and stroke down speed. See guitarpro.base.BeatStrokeDirection for value mapping.

toStrokeValue(value)[source]

Unpack stroke value.

Stroke value maps to:

  • 1: hundred twenty-eighth
  • 2: sixty-fourth
  • 3: thirty-second
  • 4: sixteenth
  • 5: eighth
  • 6: quarter
readMixTableChange(measure)[source]

Read mix table change.

List of values is read first. See readMixTableChangeValues().

List of values is followed by the list of durations for parameters that have changed. See readMixTableChangeDurations().

readMixTableChangeValues(tableChange, measure)[source]

Read mix table change values.

Mix table change values consist of 7 SignedBytes and an Int, which correspond to:

  • instrument
  • volume
  • balance
  • chorus
  • reverb
  • phaser
  • tremolo
  • tempo

If signed byte is -1 then corresponding parameter hasn’t changed.

readMixTableChangeDurations(tableChange)[source]

Read mix table change durations.

Durations are read for each non-null MixTableItem. Durations are encoded in Signed byte.

readNotes(track, beat, duration, effect=None)[source]

Read notes.

First byte lists played strings:

  • 0x01: 7th string
  • 0x02: 6th string
  • 0x04: 5th string
  • 0x08: 4th string
  • 0x10: 3th string
  • 0x20: 2th string
  • 0x40: 1th string
  • 0x80: blank
readNote(note, guitarString, track, effect)[source]

Read note.

The first byte is note flags:

  • 0x01: time-independent duration
  • 0x02: heavy accentuated note
  • 0x04: ghost note
  • 0x08: presence of note effects
  • 0x10: dynamics
  • 0x20: fret
  • 0x40: accentuated note
  • 0x80: right hand or left hand fingering

Flags are followed by:

unpackVelocity(dyn)[source]

Convert Guitar Pro dynamic value to raw MIDI velocity.

getTiedNoteValue(stringIndex, track)[source]

Get note value of tied note.

readNoteEffects(note)[source]

Read note effects.

First byte is note effects flags:

  • 0x01: bend presence
  • 0x02: hammer-on/pull-off
  • 0x04: slide
  • 0x08: let-ring
  • 0x10: grace note presence

Flags are followed by:

readBend()[source]

Read bend.

Encoded as:

  • Bend type: Signed byte. See guitarpro.base.BendType.
  • Bend value: Int.
  • Number of bend points: Int.
  • List of points. Each point consists of:
    • Position: Int. Shows where point is set along x-axis.
    • Value: Int. Shows where point is set along y-axis.
    • Vibrato: Bool.
readGrace()[source]

Read grace note effect.

Guitar Pro 4 format

class guitarpro.gp4.GP4File(data=None, encoding=None)[source]

A reader for GuitarPro 4 files.

readSong()[source]

Read the song.

A song consists of score information, triplet feel, lyrics, tempo, song key, MIDI channels, measure and track count, measure headers, tracks, measures.

  • Version: ByteSizeString of size 30.
  • Score information. See readInfo().
  • Triplet feel: Bool. If value is true, then triplet feel is set to eigth.
  • Lyrics. See readLyrics().
  • Tempo: Int.
  • Key: Int. Key signature of the song.
  • Octave: Signed byte. Reserved for future uses.
  • MIDI channels. See readMidiChannels().
  • Number of measures: Int.
  • Number of tracks: Int.
  • Measure headers. See readMeasureHeaders().
  • Tracks. See readTracks().
  • Measures. See readMeasures().
readLyrics()[source]

Read lyrics.

First, read an Int that points to the track lyrics are bound to. Then it is followed by 5 lyric lines. Each one constists of number of starting measure encoded in Int and IntSizeString holding text of the lyric line.

readNewChord(chord)[source]

Read new-style (GP4) chord diagram.

New-style chord diagram is read as follows:

readBeatEffects(effect)[source]

Read beat effects.

Beat effects are read using two byte flags.

The first byte of flags is:

  • 0x01: blank
  • 0x02: wide vibrato
  • 0x04: blank
  • 0x08: blank
  • 0x10: fade in
  • 0x20: slap effect
  • 0x40: beat stroke
  • 0x80: blank

The second byte of flags is:

  • 0x01: rasgueado
  • 0x02: pick stroke
  • 0x04: tremolo bar
  • 0x08: blank
  • 0x10: blank
  • 0x20: blank
  • 0x40: blank
  • 0x80: blank

Flags are followed by:

readMixTableChange(measure)[source]

Read mix table change.

Mix table change in Guitar Pro 4 format extends Guitar Pro 3 format. It constists of values, durations, and, new to GP3, flags.

readMixTableChangeFlags(tableChange)[source]

Read mix table change flags.

The meaning of flags:

  • 0x01: change volume for all tracks
  • 0x02: change balance for all tracks
  • 0x04: change chorus for all tracks
  • 0x08: change reverb for all tracks
  • 0x10: change phaser for all tracks
  • 0x20: change tremolo for all tracks
readNoteEffects(note)[source]

Read note effects.

The effects presence for the current note is set by the 2 bytes of flags.

First set of flags:

  • 0x01: bend
  • 0x02: hammer-on/pull-off
  • 0x04: blank
  • 0x08: let-ring
  • 0x10: grace note
  • 0x20: blank
  • 0x40: blank
  • 0x80: blank

Second set of flags:

  • 0x01: staccato
  • 0x02: palm mute
  • 0x04: tremolo picking
  • 0x08: slide
  • 0x10: harmonic
  • 0x20: trill
  • 0x40: vibrato
  • 0x80: blank

Flags are followed by:

readTremoloPicking()[source]

Read tremolo picking.

Tremolo constists of picking speed encoded in Signed byte. For value mapping refer to fromTremoloValue().

fromTremoloValue(value)[source]

Convert tremolo picking speed to actual duration.

Values are:

  • 1: eighth
  • 2: sixteenth
  • 3: thirtySecond
readSlides()[source]

Read slides.

Slide is encoded in Signed byte. See guitarpro.base.SlideType for value mapping.

readHarmonic(note)[source]

Read harmonic.

Harmonic is encoded in Signed byte. Values correspond to:

  • 1: natural harmonic
  • 3: tapped harmonic
  • 4: pinch harmonic
  • 5: semi-harmonic
  • 15: artificial harmonic on (n + 5)th fret
  • 17: artificial harmonic on (n + 7)th fret
  • 22: artificial harmonic on (n + 12)th fret
readTrill()[source]

Read trill.

fromTrillPeriod(period)[source]

Convert trill period to actual duration.

Values are:

  • 1: sixteenth
  • 2: thirty-second
  • 3: sixty-fourth

Guitar Pro 5 format

class guitarpro.gp5.GP5File(data=None, encoding=None)[source]

A reader for GuitarPro 5 files.

readSong()[source]

Read the song.

A song consists of score information, triplet feel, lyrics, tempo, song key, MIDI channels, measure and track count, measure headers, tracks, measures.

  • Version: ByteSizeString of size 30.
  • Score information. See readInfo().
  • Lyrics. See readLyrics().
  • RSE master effect. See readRSEInstrument().
  • Tempo name: IntByteSizeString.
  • Tempo: Int.
  • Hide tempo: Bool. Don’t display tempo on the sheet if set.
  • Key: Int. Key signature of the song.
  • Octave: Int. Octave of the song.
  • MIDI channels. See readMidiChannels().
  • Directions. See readDirections().
  • Master reverb. See readMasterReverb().
  • Number of measures: Int.
  • Number of tracks: Int.
  • Measure headers. See readMeasureHeaders().
  • Tracks. See readTracks().
  • Measures. See readMeasures().
readInfo(song)[source]

Read score information.

Score information consists of sequence of IntByteSizeStrings:

  • title
  • subtitle
  • artist
  • album
  • words
  • music
  • copyright
  • tabbed by
  • instructions

The sequence if followed by notice. Notice starts with the number of notice lines stored in Int. Each line is encoded in IntByteSizeString.

readRSEMasterEffect()[source]

Read RSE master effect.

Persistence of RSE master effect was introduced in Guitar Pro 5.1. It is read as:

  • Master volume: Int. Values are in range from 0 to 200.
  • 10-band equalizer. See readEqualizer().
readEqualizer(knobsNumber)[source]

Read equalizer values.

Equalizers are used in RSE master effect and Track RSE. They consist of n SignedBytes for each n bands and one Signed byte for gain (PRE) fader.

Volume values are stored as opposite to actual value. See unpackVolumeValue().

unpackVolumeValue(value)[source]

Unpack equalizer volume value.

Equalizer volumes are float but stored as SignedBytes.

readPageSetup()[source]

Read page setup.

Page setup is read as follows:

  • Page size: 2 Ints. Width and height of the page.
  • Page padding: 4 Ints. Left, right, top, bottom padding of the page.
  • Score size proportion: Int.
  • Header and footer elements: Short. See guitarpro.base.HeaderFooterElements for value mapping.
  • List of placeholders:
    • title
    • subtitle
    • artist
    • album
    • words
    • music
    • wordsAndMusic
    • copyright1, e.g. “Copyright %copyright%”
    • copyright2, e.g. “All Rights Reserved - International Copyright” Secured
    • pageNumber
readDirections()[source]

Read directions.

Directions is a list of 19 ShortInts each pointing at the number of measure.

Directions are read in the following order.

  • Coda
  • Double Coda
  • Segno
  • Segno Segno
  • Fine
  • Da Capo
  • Da Capo al Coda
  • Da Capo al Double Coda
  • Da Capo al Fine
  • Da Segno
  • Da Segno al Coda
  • Da Segno al Double Coda
  • Da Segno al Fine
  • Da Segno Segno
  • Da Segno Segno al Coda
  • Da Segno Segno al Double Coda
  • Da Segno Segno al Fine
  • Da Coda
  • Da Double Coda
readMeasureHeader(number, song, previous=None)[source]

Read measure header.

Measure header format in Guitar Pro 5 differs from one if Guitar Pro 3.

First, there is a blank byte if measure is not first. Then measure header is read as in GP3’s guitarpro.gp3.readMeasureHeader(). Then measure header is read as follows:

readTracks(song, trackCount, channels)[source]

Read tracks.

Tracks in Guitar Pro 5 have almost the same format as in Guitar Pro 3. If it’s Guitar Pro 5.0 then 2 blank bytes are read after guitarpro.gp3.readTracks(). If format version is higher than 5.0, 1 blank byte is read.

readTrack(number, channels)[source]

Read track.

If it’s Guitar Pro 5.0 format and track is first then one blank byte is read.

Then go track’s flags. It presides the track’s attributes:

  • 0x01: drums track
  • 0x02: 12 stringed guitar track
  • 0x04: banjo track
  • 0x08: track visibility
  • 0x10: track is soloed
  • 0x20: track is muted
  • 0x40: RSE is enabled
  • 0x80: show tuning in the header of the sheet.

Flags are followed by:

  • Name: String. A 40 characters long string containing the track’s name.
  • Number of strings: Int. An integer equal to the number of strings of the track.
  • Tuning of the strings: Table of integers. The tuning of the strings is stored as a 7-integers table, the “Number of strings” first integers being really used. The strings are stored from the highest to the lowest.
  • Port: Int. The number of the MIDI port used.
  • Channel. See GP3File.readChannel().
  • Number of frets: Int. The number of frets of the instrument.
  • Height of the capo: Int. The number of the fret on which a capo is set. If no capo is used, the value is 0.
  • Track’s color. The track’s displayed color in Guitar Pro.

These properties are followed by second set of flags stored in a Short.

  • 0x0001: show tablature
  • 0x0002: show standard notation
  • 0x0004: chord diagrams are below standard notation
  • 0x0008: show rhythm with tab
  • 0x0010: force horizontal beams
  • 0x0020: force channels 11 to 16
  • 0x0040: diagram list on top of the score
  • 0x0080: diagrams in the score
  • 0x0200: auto let-ring
  • 0x0400: auto brush
  • 0x0800: extend rhythmic inside the tab

Then follow:

readTrackRSE(trackRSE)[source]

Read track RSE.

In GuitarPro 5.1 track RSE is read as follows:

readRSEInstrument()[source]

Read RSE instrument.

  • MIDI instrument number: Int.
  • Unknown Int.
  • Sound bank: Int.
  • Effect number: Int. Vestige of Guitar Pro 5.0 format.
readRSEInstrumentEffect(rseInstrument)[source]

Read RSE instrument effect name.

This feature was introduced in Guitar Pro 5.1.

readMeasure(measure)[source]

Read measure.

Guitar Pro 5 stores twice more measures compared to Guitar Pro 3. One measure consists of two sub-measures for each of two voices.

Sub-measures are followed by a LineBreak stored in Byte.

readBeat(start, voice)[source]

Read beat.

First, beat is read is in Guitar Pro 3 guitarpro.gp3.readBeat(). Then it is followed by set of flags stored in Short.

  • 0x0001: break beams
  • 0x0002: direct beams down
  • 0x0004: force beams
  • 0x0008: direct beams up
  • 0x0010: ottava (8va)
  • 0x0020: ottava bassa (8vb)
  • 0x0040: quindicesima (15ma)
  • 0x0100: quindicesima bassa (15mb)
  • 0x0200: start tuplet bracket here
  • 0x0400: end tuplet bracket here
  • 0x0800: break secondary beams
  • 0x1000: break secondary tuplet
  • 0x2000: force tuplet bracket
  • Break secondary beams: Byte. Appears if flag at 0x0800 is set. Signifies how much beams should be broken.
readBeatStroke()[source]

Read beat stroke.

Beat stroke consists of two Bytes which correspond to stroke down and stroke up speed. See guitarpro.base.BeatStroke for value mapping.

readMixTableChange(measure)[source]

Read mix table change.

Mix table change was modified to support RSE instruments. It is read as in Guitar Pro 3 and is followed by:

readMixTableChangeValues(tableChange, measure)[source]

Read mix table change values.

Mix table change values consist of:

If the value is -1 then corresponding parameter hasn’t changed.

readMixTableChangeDurations(tableChange)[source]

Read mix table change durations.

Durations are read for each non-null MixTableItem. Durations are encoded in Signed byte.

If tempo did change, then one Bool is read. If it’s true, then tempo change won’t be displayed on the score.

readMixTableChangeFlags(tableChange)[source]

Read mix table change flags.

Mix table change flags are read as in Guitar Pro 4 guitarpro.gp4.readMixTableChangeFlags(), with one additional flag:

  • 0x40: use RSE
  • 0x80: show wah-wah
readWahEffect(flags)[source]

Read wah-wah.

readNote(note, guitarString, track, effect)[source]

Read note.

The first byte is note flags:

  • 0x01: duration percent
  • 0x02: heavy accentuated note
  • 0x04: ghost note
  • 0x08: presence of note effects
  • 0x10: dynamics
  • 0x20: fret
  • 0x40: accentuated note
  • 0x80: right hand or left hand fingering

Flags are followed by:

  • Note type: Byte. Note is normal if values is 1, tied if value is 2, dead if value is 3.
  • Note dynamics: Signed byte. See unpackVelocity().
  • Fret number: Signed byte. If flag at 0x20 is set then read fret number.
  • Fingering: 2 SignedBytes. See guitarpro.base.Fingering.
  • Duration percent: Double.
  • Second set of flags: Byte.
    • 0x02: swap accidentals.
  • Note effects. See guitarpro.gp4.readNoteEffects().
readGrace()[source]

Read grace note effect.

  • Fret: Signed byte. Number of fret.
  • Dynamic: Byte. Dynamic of a grace note, as in guitarpro.base.Note.velocity.
  • Transition: Byte. See guitarpro.base.GraceEffectTransition.
  • Duration: Byte. Values are:
    • 1: Thirty-second note.
    • 2: Twenty-fourth note.
    • 3: Sixteenth note.
  • Flags: Byte.
    • 0x01: grace note is muted (dead)
    • 0x02: grace note is on beat
readSlides()[source]

Read slides.

First Byte stores slide types:

  • 0x01: shift slide
  • 0x02: legato slide
  • 0x04: slide out downwards
  • 0x08: slide out upwards
  • 0x10: slide into from below
  • 0x20: slide into from above
readHarmonic(note)[source]

Read harmonic.

First Byte is harmonic type:

  • 1: natural harmonic
  • 2: artificial harmonic
  • 3: tapped harmonic
  • 4: pinch harmonic
  • 5: semi-harmonic

In case harmonic types is artificial, following data is read:

If harmonic type is tapped: