Guitar Pro File Format

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 an 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, encoding, version=None, versionTuple=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.models.Marker and guitarpro.models.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(track, 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.models.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:

readBeatEffects(noteEffect)[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.models.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, noteEffect=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)[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.models.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, encoding, version=None, versionTuple=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(noteEffect)[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:

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.

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.models.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, encoding, version=None, versionTuple=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.

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.models.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

readMeasureHeaders(song, measureCount, directions)[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.

Measure header format in Guitar Pro 5 differs from one in 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(track, 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.

The 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.models.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.

  • Wah value: Signed byte. See guitarpro.models.WahEffect for value mapping.

readNote(note, guitarString, track)[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.models.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.models.Note.velocity.

  • Transition: Byte. See guitarpro.models.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: