### Install Latest Development Version Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/install.html Clone the repository and install the package in editable mode for the latest development version. ```bash git clone https://github.com/Perlence/PyGuitarPro cd pyguitarpro pip install -e . ``` -------------------------------- ### Install PyGuitarPro with Pip Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/install.html Use this command to install the stable version of PyGuitarPro from PyPI. ```bash pip install pyguitarpro ``` -------------------------------- ### readPageSetup() Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads the page setup configuration, including page size, padding, score size proportion, and header/footer elements. ```APIDOC ## readPageSetup() 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 ``` -------------------------------- ### Get BendPoint time Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Calculate the exact MIDI time for a BendPoint based on the total duration of the bend effect. ```python getTime(_duration_) ``` -------------------------------- ### getBeat Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Retrieves a specific beat from a measure based on its start time and voice. ```APIDOC ## getBeat(_voice_ , _start_) ### Description Get beat from measure by start time. ``` -------------------------------- ### readLyrics() Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads the lyrics associated with a track, including the track number and up to 5 lines of lyrics with their starting measures. ```APIDOC 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. ``` -------------------------------- ### PageSetup Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Describes how a song document is rendered, including page size, margins, and header/footer content. ```APIDOC class guitarpro.models.PageSetup(_pageSize : Point = Point(x=210, y=297)_, _pageMargin : Padding = Padding(right=10, top=15, left=10, bottom=10)_, _scoreSizeProportion : float = 1.0_, _headerAndFooter : HeaderFooterElements = HeaderFooterElements.all_, _title : str = '%title%'_, _subtitle : str = '%subtitle%'_, _artist : str = '%artist%'_, _album : str = '%album%'_, _words : str = 'Words by %words%'_, _music : str = 'Music by %music%'_, _wordsAndMusic : str = 'Words & Music by %WORDSMUSIC%'_, _copyright : str = 'Copyright %copyright%\nAll Rights Reserved - International Copyright Secured'_, _pageNumber : str = 'Page %N%/%P%'_)[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) ``` -------------------------------- ### LyricLine Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Represents a single line of lyrics, associated with a starting measure number. ```APIDOC class guitarpro.models.LyricLine(_startingMeasure : int = 1_, _lyrics : str = ''_)[source] A lyrics line. ``` -------------------------------- ### PitchClass Initialization and Representation Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Demonstrates how to create a PitchClass object with a tone and accidental, and how it is represented and printed. The constructor supports keyword arguments for intonation. ```python >>> p = PitchClass(4, -1) >>> p PitchClass(just=4, accidental=-1, value=3, intonation='flat') >>> print(p) Eb >>> p = PitchClass(4, -1, intonation='sharp') >>> p ``` -------------------------------- ### write() Method Source: https://pyguitarpro.readthedocs.io/en/latest/genindex.html Writes the guitarpro data to a file. ```APIDOC ## Method: write() ### Description Writes the current guitarpro data structure to a file. ### Module guitarpro ``` -------------------------------- ### RepeatGroup Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Represents a group of measures that are repeated within a song. It stores information about the start and end of these repeated sections. ```APIDOC class guitarpro.models.RepeatGroup(_measureHeaders : list[MeasureHeader] = NOTHING_, _closings : list[MeasureHeader] = NOTHING_, _openings : list[MeasureHeader] = NOTHING_, _isClosed : bool = False_)[source] This class can store the information about a group of measures which are repeated. ``` -------------------------------- ### guitarpro.parse() Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Opens a Guitar Pro file and reads its contents into a Song object. Supports file paths or file-like objects and allows specifying the character encoding for strings. ```APIDOC ## guitarpro.parse() ### Description Open a GP file and read its contents. ### Method `parse(stream, encoding='cp1252')` ### Parameters #### Path Parameters - **stream** (path or file-like object) - Required - Path to a GP file or file-like object. - **encoding** (str) - Optional - Character set to decode strings in tablature. Must be an 8-bit charset. ### Response #### Success Response (Song) - Returns a `Song` object representing the parsed Guitar Pro file. ``` -------------------------------- ### Create PitchClass from note name Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Instantiate a PitchClass object by providing the note name as a string. ```python p = PitchClass('D#') print(p) ``` -------------------------------- ### Write a Guitar Pro file Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/quickstart.html Use the `guitarpro.write()` function to save a Guitar Pro object to a file. Specify the desired filename and format. ```python guitarpro.write(demo, 'Demo v5 2.gp5') ``` -------------------------------- ### GPException Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Base exception class for guitarpro operations. ```APIDOC exception guitarpro.models.GPException[source] ``` -------------------------------- ### guitarpro.write() Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Writes a Song object to a Guitar Pro file. Allows specifying the file path or a file-like object, an optional version for the GP file, and the character encoding for strings. ```APIDOC ## guitarpro.write() ### Description Write a song into GP file. ### Method `write(song: Song, stream, version: tuple | None = None, encoding='cp1252')` ### Parameters #### Path Parameters - **song** (Song) - Required - The song object to write. - **stream** (path or file-like object) - Required - Path to save GP file or file-like object. - **version** (tuple or None) - Optional - Explicitly set version of GP file to save, e.g. `(5, 1, 0)`. - **encoding** (str) - Optional - Encode strings into the given 8-bit charset. ``` -------------------------------- ### unpackVolumeValue() Method Source: https://pyguitarpro.readthedocs.io/en/latest/genindex.html Unpacks volume information from the GP5 file format. ```APIDOC ## Method: unpackVolumeValue() ### Description Unpacks volume data from the GP5 file format. ### Class guitarpro.gp5.GP5File ``` -------------------------------- ### unpackVelocity Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Converts a Guitar Pro dynamic value into a raw MIDI velocity. ```APIDOC ## unpackVelocity(_dyn_) ### Description Convert Guitar Pro dynamic value to raw MIDI velocity. ``` -------------------------------- ### TrackSettings Model Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Contains settings for a guitar track, controlling various display and playback options. ```APIDOC ## class guitarpro.models.TrackSettings(_tablature : bool = True_, _notation : bool = True_, _diagramsAreBelow : bool = False_, _showRhythm : bool = False_, _forceHorizontal : bool = False_, _forceChannels : bool = False_, _diagramList : bool = True_, _diagramsInScore : bool = False_, _autoLetRing : bool = False_, _autoBrush : bool = False_, _extendRhythmic : bool = False_) ### Description Settings of the track. ### Parameters - **_tablature** (bool, optional) - Whether tablature is shown. Defaults to True. - **_notation** (bool, optional) - Whether standard notation is shown. Defaults to True. - **_diagramsAreBelow** (bool, optional) - Whether diagrams are displayed below the staff. Defaults to False. - **_showRhythm** (bool, optional) - Whether rhythm is shown. Defaults to False. - **_forceHorizontal** (bool, optional) - Force horizontal display. Defaults to False. - **_forceChannels** (bool, optional) - Force channels. Defaults to False. - **_diagramList** (bool, optional) - Whether a diagram list is shown. Defaults to True. - **_diagramsInScore** (bool, optional) - Whether diagrams are included in the score. Defaults to False. - **_autoLetRing** (bool, optional) - Enable auto 'let ring'. Defaults to False. - **_autoBrush** (bool, optional) - Enable auto 'brush' strokes. Defaults to False. - **_extendRhythmic** (bool, optional) - Extend rhythmic notation. Defaults to False. ``` -------------------------------- ### readNoteEffects() Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads note effects, including bends, hammer-ons/pull-offs, let-rings, grace notes, staccato, palm mutes, tremolo picking, slides, harmonics, trills, and vibrato. ```APIDOC 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: * Bend. See `readBend()`. * Grace note. See `readGrace()`. * Tremolo picking. See `readTremoloPicking()`. * Slide. See `readSlides()`. * Harmonic. See `readHarmonic()`. * Trill. See `readTrill()`. ``` -------------------------------- ### PitchClass Constructor Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html The PitchClass constructor can be initialized with a semitone number or a note name string. It also accepts an 'intonation' parameter for sharps and flats. ```APIDOC ## PitchClass Constructor ### Description Initializes a PitchClass object. ### Parameters #### Path Parameters - **semitone** (integer) - The semitone value. - **name** (string) - The note name (e.g., 'D#'). - **intonation** (string) - Optional. 'sharp' or 'flat'. ### Request Example ```python p = PitchClass(3) p = PitchClass(3, intonation='sharp') p = PitchClass('D#') ``` ``` -------------------------------- ### Parse a Guitar Pro file Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/quickstart.html Use the `guitarpro.parse()` function to read a Guitar Pro file into a Python object. Ensure the file path is correct. ```python import guitarpro demo = guitarpro.parse('Demo v5.gp5') ``` -------------------------------- ### readDirections() Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads the directions for measure navigation, such as Coda, Segno, Fine, and Da Capo variations. ```APIDOC ## readDirections() 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 ``` -------------------------------- ### GP5File Class Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Represents a reader for Guitar Pro 5 files, providing methods to parse various components of the song data. ```APIDOC ## class guitarpro.gp5.GP5File(_data_ , _encoding_ , _version =None_, _versionTuple =None_) A reader for GuitarPro 5 files. ``` -------------------------------- ### BendPoint.getTime Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Calculates the exact time a bend point needs to be played in MIDI. ```APIDOC ## BendPoint.getTime ### Description Gets the exact time when the point need to be played (MIDI). ### Parameters #### Path Parameters - **duration** (integer) - The full duration of the effect. ### Method `getTime(duration)` ``` -------------------------------- ### Convert Guitar Pro file format Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/quickstart.html To convert between Guitar Pro file formats (GP3, GP4, GP5), simply change the file extension when writing the file using `guitarpro.write()`. ```python guitarpro.write(demo, 'Demo v5.gp4') ``` -------------------------------- ### readTracks(_song_ , _trackCount_ , _channels_) Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads all tracks within the song, noting format differences between Guitar Pro 5.0 and later versions. ```APIDOC ## readTracks(_song_ , _trackCount_ , _channels_) 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. ``` -------------------------------- ### readRSEMasterEffect() Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads the RSE master effect settings, including master volume and equalizer. ```APIDOC ## readRSEMasterEffect() 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()`. ``` -------------------------------- ### unpackVelocity() Method Source: https://pyguitarpro.readthedocs.io/en/latest/genindex.html Unpacks velocity information from the GP3 file format. ```APIDOC ## Method: unpackVelocity() ### Description Unpacks velocity data from the GP3 file format. ### Class guitarpro.gp3.GP3File ``` -------------------------------- ### GP3File Class Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html The main class for reading Guitar Pro 3 files. It provides methods to parse various components of the song. ```APIDOC ## class guitarpro.gp3.GP3File(_data_ , _encoding_ , _version =None_, _versionTuple =None_) A reader for GuitarPro 3 files. ``` -------------------------------- ### Parse Guitar Pro file from a stream Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/quickstart.html The `guitarpro.parse()` function accepts file-like objects, allowing you to parse data from streams such as network requests. Ensure the stream is opened in binary mode if necessary. ```python from urllib.request import urlopen with urlopen('https://github.com/Perlence/PyGuitarPro/raw/master/tests/Demo%20v5.gp5') as stream: demo = guitarpro.parse(stream) ``` -------------------------------- ### readNewChord() Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads a new-style (GP4) chord diagram, including sharp/flat preference, root, type, extension, bass note, tonality, and fret/barre information. ```APIDOC readNewChord(_chord_)[source] Read new-style (GP4) chord diagram. New-style chord diagram is read as follows: * Sharp: Bool. If true, display all semitones as sharps, otherwise display as flats. * Blank space, 3 Bytes. * Root: Byte. Values are: * -1 for customized chords * 0: C * 1: C# * … * Type: Byte. Determines the chord type as followed. See `guitarpro.models.ChordType` for mapping. * Chord extension: Byte. See `guitarpro.models.ChordExtension` for mapping. * Bass note: Int. Lowest note of chord as in _C/Am_. * Tonality: Int. See `guitarpro.models.ChordAlteration` for mapping. * Add: Bool. Determines if an “add” (added note) is present in the chord. * Name: ByteSizeString. Max length is 22. * Fifth tonality: Byte. Maps to `guitarpro.models.ChordExtension`. * Ninth tonality: Byte. Maps to `guitarpro.models.ChordExtension`. * Eleventh tonality: Byte. Maps to `guitarpro.models.ChordExtension`. * List of frets: 6 Ints. Fret values are saved as in default format. * Count of barres: Byte. Maximum count is 5. * Barre frets: 5 Bytes. * Barre start strings: 5 Bytes. * Barre end string: 5 Bytes. * Omissions: 7 Bools. If the value is true then note is played in chord. * Blank space, 1 Byte. * Fingering: 7 SignedBytes. For value mapping, see `guitarpro.models.Fingering`. ``` -------------------------------- ### BeatDisplay Model Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Parameters related to the display of a beat, including beam and tuplet bracket settings. ```APIDOC ## class guitarpro.models.BeatDisplay(_breakBeam : bool = False_, _forceBeam : bool = False_, _beamDirection : VoiceDirection = VoiceDirection.none_, _tupletBracket : TupletBracket = TupletBracket.none_, _breakSecondary : int = 0_, _breakSecondaryTuplet : bool = False_, _forceBracket : bool = False_) ### Description Parameters of beat display. ### Parameters - **_breakBeam** (bool, optional) - Whether to break the beam. Defaults to False. - **_forceBeam** (bool, optional) - Whether to force the beam. Defaults to False. - **_beamDirection** (VoiceDirection, optional) - The direction of the beam. Defaults to VoiceDirection.none. - **_tupletBracket** (TupletBracket, optional) - The tuplet bracket type. Defaults to TupletBracket.none. - **_breakSecondary** (int, optional) - Secondary break value. Defaults to 0. - **_breakSecondaryTuplet** (bool, optional) - Whether to break secondary tuplet. Defaults to False. - **_forceBracket** (bool, optional) - Whether to force the bracket. Defaults to False. ``` -------------------------------- ### unpackVolumeValue(_value_) Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Unpacks an equalizer volume value that is stored as a SignedByte. ```APIDOC ## unpackVolumeValue(_value_) Unpack equalizer volume value. Equalizer volumes are float but stored as SignedBytes. ``` -------------------------------- ### BeatEffect Model Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Contains all effects that can be applied to a beat. ```APIDOC ## class guitarpro.models.BeatEffect(_stroke : BeatStroke = NOTHING_, _hasRasgueado : bool = False_, _pickStroke : BeatStrokeDirection = BeatStrokeDirection.none_, _chord : Chord | None = None_, _fadeIn : bool = False_, _tremoloBar : BendEffect | None = None_, _mixTableChange : MixTableChange | None = None_, _slapEffect : SlapEffect = SlapEffect.none_, _vibrato : bool = False_) ### Description This class contains all beat effects. ### Parameters - **_stroke** (BeatStroke, optional) - The stroke effect for the beat. Defaults to NOTHING. - **_hasRasgueado** (bool, optional) - Indicates if the beat has a rasgueado. Defaults to False. - **_pickStroke** (BeatStrokeDirection, optional) - The pick stroke direction. Defaults to BeatStrokeDirection.none. - **_chord** (Chord | None, optional) - The chord associated with the beat. Defaults to None. - **_fadeIn** (bool, optional) - Indicates if the beat has a fade-in effect. Defaults to False. - **_tremoloBar** (BendEffect | None, optional) - The tremolo bar effect. Defaults to None. - **_mixTableChange** (MixTableChange | None, optional) - The mix table change effect. Defaults to None. - **_slapEffect** (SlapEffect, optional) - The slap effect applied to the beat. Defaults to SlapEffect.none. - **_vibrato** (bool, optional) - Indicates if the beat has vibrato. Defaults to False. ``` -------------------------------- ### TrackSettings Class Source: https://pyguitarpro.readthedocs.io/en/latest/genindex.html Contains settings related to a specific track. ```APIDOC ## Class: TrackSettings ### Description Holds configuration and settings for a musical track. ### Module guitarpro.models ``` -------------------------------- ### GP4File Class Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Represents a reader for Guitar Pro 4 files, providing methods to parse various song components. ```APIDOC class guitarpro.gp4.GP4File(_data_ , _encoding_ , _version =None_, _versionTuple =None_)[source] A reader for GuitarPro 4 files. ``` -------------------------------- ### readNote Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads a single note, parsing its flags, type, duration, dynamics, fret number, fingering, and effects. ```APIDOC ## readNote(_note_ , _guitarString_ , _track_) ### Description 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: * Note type: Byte. Note is normal if values is 1, tied if value is 2, dead if value is 3. * Time-independent duration: 2 SignedBytes. Correspond to duration and tuplet. See `readDuration()` for reference. * 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`. * Note effects. See `readNoteEffects()`. ``` -------------------------------- ### Song Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html The top-level model representing a complete guitar tablature song. It contains metadata, lyrics, and tracks. ```APIDOC class guitarpro.models.Song(_versionTuple : tuple[int, int, int] | None = None_, _clipboard : Clipboard | None = None_, _title : str = ''_, _subtitle : str = ''_, _artist : str = ''_, _album : str = ''_, _words : str = ''_, _music : str = ''_, _copyright : str = ''_, _tab : str = ''_, _instructions : str = ''_, _notice : list[str] = NOTHING_, _lyrics : Lyrics = NOTHING_, _pageSetup : PageSetup = NOTHING_, _tempoName : str = 'Moderate'_, _tempo : int = 120_, _hideTempo : bool = False_, _key : KeySignature = KeySignature.CMajor_, _measureHeaders : list[MeasureHeader] = NOTHING_, _tracks : list[Track] = NOTHING_, _masterEffect : RSEMasterEffect = NOTHING_, _currentRepeatGroup : RepeatGroup = NOTHING_)[source] The top-level node of the song model. It contains basic information about the stored song. ``` -------------------------------- ### readMidiChannels() Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads the MIDI channel configurations for the song, covering 64 channels across 4 ports. ```APIDOC ## readMidiChannels() 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: * Instrument: Int. * Volume: Byte. * Balance: Byte. * Chorus: Byte. * Reverb: Byte. * Phaser: Byte. * Tremolo: Byte. * blank1: Byte. * blank2: Byte. ``` -------------------------------- ### readMeasureHeader(_number_ , _song_ , _previous =None_) Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads a single measure header, handling differences between Guitar Pro 5 and GP3 formats. ```APIDOC ## readMeasureHeader(_number_ , _song_ , _previous =None_) 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: * Time signature beams: 4 Bytes. Appears If time signature was set, i.e. flags _0x01_ and _0x02_ are both set. * Blank Byte if flag at _0x10_ is set. * Triplet feel: Byte. See `guitarpro.models.TripletFeel`. ``` -------------------------------- ### Note Effects Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html This section details the various effects that can be applied to a musical note within the pyguitarpro library. ```APIDOC ## NoteEffect ### Description Contains all effects which can be applied to one note. ### Parameters - **_accentuatedNote** (bool) - Whether the note is accentuated. - **_bend** (BendEffect | None) - Bend effect applied to the note. - **_ghostNote** (bool) - Whether the note is a ghost note. - **_grace** (GraceEffect | None) - Grace note effect applied to the note. - **_hammer** (bool) - Whether a hammer-on effect is applied. - **_harmonic** (HarmonicEffect | None) - Harmonic effect applied to the note. - **_heavyAccentuatedNote** (bool) - Whether the note is heavily accentuated. - **_leftHandFinger** (Fingering) - Fingering for the left hand. - **_letRing** (bool) - Whether the note should be let ring. - **_palmMute** (bool) - Whether palm muting is applied. - **_rightHandFinger** (Fingering) - Fingering for the right hand. - **_slides** (list[SlideType]) - List of slide types applied. - **_staccato** (bool) - Whether staccato is applied. - **_tremoloPicking** (TremoloPickingEffect | None) - Tremolo picking effect applied to the note. - **_trill** (TrillEffect | None) - Trill effect applied to the note. - **_vibrato** (bool) - Whether vibrato is applied. ``` -------------------------------- ### readTrack(_track_, _channels_) Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads the details of a single track, including its flags, name, strings, tuning, and MIDI port/channel. ```APIDOC ## readTrack(_track_, _channels_) 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. ``` -------------------------------- ### readTremoloPicking() Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads the tremolo picking effect. ```APIDOC readTremoloPicking()[source] Read tremolo picking. ``` -------------------------------- ### readSong() Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads the entire song structure, including score information, lyrics, tempo, key, MIDI channels, measures, and tracks. ```APIDOC ## readSong() 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()`. ``` -------------------------------- ### readSong() Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads the entire song structure, including score information, lyrics, tempo, key, MIDI channels, measures, and tracks. ```APIDOC 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()`. ``` -------------------------------- ### readNotes Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads the notes for a given track and beat, considering the duration and optional note effects. It first determines which strings are played. ```APIDOC ## readNotes(_track_ , _beat_ , _duration_ , _noteEffect =None_) ### Description 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_ ``` -------------------------------- ### MidiChannel Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Defines MIDI channel properties for track playback, including instrument, volume, and effects. ```APIDOC class guitarpro.models.MidiChannel(_channel : int = 0_, _effectChannel : int = 1_, _instrument : int = 25_, _volume : int = 104_, _balance : int = 64_, _chorus : int = 0_, _reverb : int = 0_, _phaser : int = 0_, _tremolo : int = 0_, _bank : int = 0_)[source] A MIDI channel describes playing data for a track. ``` -------------------------------- ### readInfo(_song_) Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads the score information, including title, subtitle, artist, album, words, music, copyright, tabbed by, instructions, and notices. ```APIDOC ## readInfo(_song_) 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. ``` -------------------------------- ### readMixTableChange() Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads mix table changes, which in Guitar Pro 4 format extend the GP3 format with values, durations, and flags. ```APIDOC 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`. ``` -------------------------------- ### readInfo(_song_) Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads the score information, including title, artist, album, and other textual details. ```APIDOC ## readInfo(_song_) 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. ``` -------------------------------- ### readTracks(_song_, _trackCount_, _channels_) Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads all tracks within the song. ```APIDOC ## readTracks(_song_, _trackCount_, _channels_) 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. ``` -------------------------------- ### Create PitchClass from semitone number Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Instantiate a PitchClass object using its semitone number. You can also specify the intonation as 'sharp' or 'flat'. ```python p = PitchClass(3) print(p) ``` ```python p = PitchClass(3, intonation='sharp') print(p) ``` -------------------------------- ### Chord Model Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Represents a chord annotation for beats, including its properties and structure. ```APIDOC ## Chord ### Description A chord annotation for beats. ### Parameters - **_length** (int) - The length of the chord. - **_sharp** (bool | None) - Indicates if the chord is sharp. - **_root** (PitchClass | None) - The root pitch class of the chord. - **_type** (ChordType | None) - The type of the chord. - **_extension** (ChordExtension | None) - The extension type of the chord. - **_bass** (PitchClass | None) - The bass pitch class of the chord. - **_tonality** (ChordAlteration | None) - The tonality of the chord. - **_add** (bool | None) - Indicates if an 'add' chord is used. - **_name** (str) - The name of the chord. - **_fifth** (ChordAlteration | None) - The fifth alteration of the chord. - **_ninth** (ChordAlteration | None) - The ninth alteration of the chord. - **_eleventh** (ChordAlteration | None) - The eleventh alteration of the chord. - **_firstFret** (int | None) - The first fret of the chord. - **_strings** (list[int]) - List of strings involved in the chord. - **_barres** (list[Barre]) - List of barres applied to the chord. - **_omissions** (list[bool]) - List indicating omitted strings. - **_fingerings** (list[Fingering]) - List of fingerings for the chord. - **_show** (bool | None) - Indicates if the chord should be shown. - **_newFormat** (bool | None) - Indicates if the chord uses the new format. ``` -------------------------------- ### readBeatEffects() Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads beat effects applied to a note, including vibrato, fade in, slap, beat stroke, rasgueado, pick stroke, and tremolo bar. ```APIDOC 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: * Slap effect: Signed byte. For value mapping see `guitarpro.models.SlapEffect`. * Tremolo bar. See `readTremoloBar()`. * Beat stroke. See `readBeatStroke()`. * Pick stroke: Signed byte. For value mapping see `guitarpro.models.BeatStrokeDirection`. ``` -------------------------------- ### Padding Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Defines padding values for top, bottom, left, and right sides. ```APIDOC class guitarpro.models.Padding(_right : int_, _top : int_, _left : int_, _bottom : int_)[source] A padding construct. ``` -------------------------------- ### KeySignature Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Represents the key signature of a musical piece. ```APIDOC class guitarpro.models.KeySignature(_* values_)[source] ``` -------------------------------- ### fromTremoloValue Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Converts a signed byte value representing tremolo picking speed into a human-readable duration. ```APIDOC ## fromTremoloValue(_value_) ### Description Convert tremolo picking speed to actual duration. ### Parameters #### Path Parameters - **_value_** (Signed byte) - Required - The encoded tremolo value. ### Returns - **string** - The duration (e.g., "eighth", "sixteenth", "thirtySecond"). ### Values - _1_ : eighth - _2_ : sixteenth - _3_ : thirtySecond ``` -------------------------------- ### readSong() Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads the entire song structure, including score information, tempo, key, measures, and tracks. ```APIDOC ## readSong() Read the song. A song consists of score information, triplet feel, 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. * Tempo: Int. * Key: Int. Key signature of the song. * MIDI channels. See `readMidiChannels()`. * Number of measures: Int. * Number of tracks: Int. * Measure headers. See `readMeasureHeaders()`. * Tracks. See `readTracks()`. * Measures. See `readMeasures()`. ``` -------------------------------- ### readChord Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/format.html Reads a chord diagram, differentiating between GP3 and GP4 formats. ```APIDOC ## readChord(_stringCount_) ### Description 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. ``` -------------------------------- ### Track Model Source: https://pyguitarpro.readthedocs.io/en/latest/pyguitarpro/api.html Represents a single track within a guitar tablature song, containing measures, strings, and settings. ```APIDOC ## class guitarpro.models.Track(_song : Song_, _number : int = 1_, _fretCount : int = 24_, _offset : int = 0_, _isPercussionTrack : bool = False_, _is12StringedGuitarTrack : bool = False_, _isBanjoTrack : bool = False_, _isVisible : bool = True_, _isSolo : bool = False_, _isMute : bool = False_, _indicateTuning : bool = False_, _name : str = 'Track 1'_, _measures : list[Measure] = NOTHING_, _strings : list[GuitarString] = NOTHING_, _port : int = 1_, _channel : MidiChannel = NOTHING_, _color : Color = Color(r=255, g=0, b=0)_, _settings : TrackSettings = NOTHING_, _useRSE : bool = False_, _rse : TrackRSE = NOTHING_, _clefTranspose : int | None = None_, _clefTransposeSecondary : int | None = None_) ### Description A track contains multiple measures. ### Parameters - **_song** (Song) - The song this track belongs to. - **_number** (int, optional) - The track number. Defaults to 1. - **_fretCount** (int, optional) - The number of frets on the instrument. Defaults to 24. - **_offset** (int, optional) - The fret offset. Defaults to 0. - **_isPercussionTrack** (bool, optional) - Indicates if this is a percussion track. Defaults to False. - **_is12StringedGuitarTrack** (bool, optional) - Indicates if this is a 12-string guitar track. Defaults to False. - **_isBanjoTrack** (bool, optional) - Indicates if this is a banjo track. Defaults to False. - **_isVisible** (bool, optional) - Whether the track is visible. Defaults to True. - **_isSolo** (bool, optional) - Whether the track is soloed. Defaults to False. - **_isMute** (bool, optional) - Whether the track is muted. Defaults to False. - **_indicateTuning** (bool, optional) - Whether to indicate tuning. Defaults to False. - **_name** (str, optional) - The name of the track. Defaults to 'Track 1'. - **_measures** (list[Measure], optional) - A list of measures in the track. Defaults to NOTHING. - **_strings** (list[GuitarString], optional) - A list of guitar strings for the track. Defaults to NOTHING. - **_port** (int, optional) - The MIDI port for the track. Defaults to 1. - **_channel** (MidiChannel, optional) - The MIDI channel for the track. Defaults to NOTHING. - **_color** (Color, optional) - The color of the track. Defaults to red. - **_settings** (TrackSettings, optional) - The track settings. Defaults to NOTHING. - **_useRSE** (bool, optional) - Whether to use RSE (Real Sound Engine). Defaults to False. - **_rse** (TrackRSE, optional) - RSE settings for the track. Defaults to NOTHING. - **_clefTranspose** (int | None, optional) - Signed clef-related transposition in steps. Defaults to None. - **_clefTransposeSecondary** (int | None, optional) - Secondary clef-related transposition. Defaults to None. ### Attributes - **clefTranspose**: Signed clef-related transposition in steps. The usual values are 0 (treble) and 12 (bass). - **clefTransposeSecondary**: Secondary clef-related transposition. ```