Click here to Skip to main content
Licence GPL3
First Posted 26 Nov 2009
Views 5,877
Bookmarked 23 times

GpPlayer - A GuitarPro IO, Playing and Displaying Framework

By | 25 Feb 2010 | Article
An application for opening GuitarPro files, playing and displaying such.
  • Download GpPlayer_1_0_src.zip - 1.22 MB
  • Download GpPlayer_1_0_bin.zip - 497.76 KB

Introduction 

Screenshot

First of all I want to say that this is my first article on CodeProject. Therefore excuse if it has not the same quality as other articles have. Let’s answer some questions before we start.

Updates / Project Website

To keep in touch with the most current infos and releases head to our project repository on Google Code: 

http://code.google.com/p/gpplayer/ 

Background 

What is this project about?
"Guitar Pro is a multitrack tablature editor for guitar, banjo and bass. Besides writing scores, Guitar Pro is a useful resource for guitarists from beginner to experienced levels toprogress, compose, or simply accompany themselves." (http://www.guitar-pro.com/en/, 15.11.2009). The target of this Project is to develop an Application which can open these Tablature-Files, display the Tablature and give the possibility to play those through Midi.

What were my targets of this project?
I wanted to learn about the structure of this file format and improve my control development skills. In future I want to make a Java Swing Port of this Application to provide an online player to tablature-file hoster.

What was my main information source?
There is an open-source application (LGPL) called TuxGuitar (http://tuxguitar.herac.com.ar/) which is written in Java. My sources are based on this Java Code and are mainly only a C# port. (But how could it be another way if there is a strict file format?).

Under which license is this project published?
GPL v3 (http://www.gnu.org/licenses/gpl-3.0.html). In future I plan to switch to LGPL for some parts (especially the io and player parts).

Song Model

The Song Model describes the structure of a song, stored in a GuitarPro file. It is a quite simple hierarchy with the Song as root-node:
Song Model

File Format

Points of interest

The File-Read-Algorithms I used are based on the Java Source of TuxGuitar. One of the well known differences between Java and C# are the byte types. C# uses byte as an unsigned byte and sbyte as a signed one. Java uses byte as a signed byte and ubyte as an unsigned. Therefore I had to write an own Stream wrapper which uses sbyte as main type for reading and implement an own “SignedByteFileStream”.

The only special part in GuitarPro files is how strings are stored. First you have to read one ubyte or integer (depending on the string) which determines the length of the string which follows. After that you read the amount of bytes given by the first ubyte. These bytes can be used to decode a UTF-8 encoded text.

Guitar Pro File version 5

Not all bytes are determined to their usage but the most important for playing and displaying songs is known.
File Header
The file starts with a version identifier. The first byte 18Hex (24Decimal) indicates 24bytes for the text "FICHIER GUITAR PRO v5.10". 30 Bytes are reserved for this version identifier.
Song Info
The Song Information starts at byte 31: 9 "int-strings" containing title, subtitle, artist, album, author, music, copyright, tab writer, instructions. An integer (4Bytes) indicates how many int-strings have to be read as additional notes.

After the information we have to read lyrics, page setup, and 64 (midi) channel definitions.

Finally we can start to read our tracks and measures. I don’t explain all parts because this would make the article to long. But you can read all about it in the source code.

Special Thanks

First of all I want to give props to all developers of TuxGuitar who can be found here: http://tuxguitar.herac.com.ar/authors.html. You made it possible for me to understand how to read GuitarPro files and how to render the tablature.

Also thanks to Leslie Sanford who has developed the C# Midi Toolkit (MIDIToolkit.aspx) which allowed me to access the midi interface for playing the songs.

History

1.0 - Initial Release (Translated file reading algorithms from Java to C#, Song Player, Tablature and Fretboard Controls)

Future Plans / TODOs:

  • Java Applet Port
  • Identify missing bytes and complete song model
  • Styleguide Renaming and Documentation
  • Directly build midi sequence for sequencer (No temp-file export)
  • Analyze GuitarPro and FMOD Ex to build an own RSE (http://www.fmod.org/index.php/products/fmodex)
  • More Layouts for the tablature control
  • WPF Port (not sure)

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

About the Author

Danielku15



Austria Austria

Member

I'm Daniel from Austria.
I started Webdeveloping in 2001 with HTML/JS. 2004 I also started to develop PHP. Nowadays I'm into developing Web-Applications in PHP and Java(2007), GUI Controls in C#(since 2006).

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralDoesn't repeat sections of song Pinmemberkeggfyoid12:21 7 Jan '10  
GeneralRe: Doesn't repeat sections of song PinmemberDanielku1521:10 7 Jan '10  
AnswerRe: Doesn't repeat sections of song PinmemberDanielku1511:39 9 Jan '10  
GeneralRe: Doesn't repeat sections of song PinmemberDanielku1512:21 12 Jan '10  
GeneralMessage Removed PinmemberKK Adams16:45 22 Dec '09  
GeneralRe: Another Guitar Pro Player PinmemberDanielku1510:30 23 Dec '09  
GeneralPlease sort your images out PinmvpPete O'Hanlon10:06 26 Nov '09  
GeneralRe: Please sort your images out PinmemberDanielku1510:50 26 Nov '09  
GeneralRe: Please sort your images out Pinmemberaspdotnetdev15:07 26 Nov '09  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 25 Feb 2010
Article Copyright 2009 by Danielku15
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid