GP4
application/x-guitar-pro
Magic Bytes
Offset: 1
46 49 43 48 49 45 52 20 47 55 49 54 41 52 45 20 50 52 4F 20
The GP4 file format is a proprietary musical tablature and scoring standard developed by Arobas Music for version 4 of the Guitar Pro software. It stores multitrack composition data, including guitar and bass tablature, standard musical notation, and MIDI-based instrument sequencing for playback and editing. Now considered a legacy format superseded by newer iterations like GP5 and GPX, it remains supported by modern tablature editors and open-source alternatives like TuxGuitar.
Validation Code
How to validate .gp4 files in Python
Python
def is_gp4(file_path: str) -> bool:
"""
Check if file is a valid GP4 by magic bytes.
Signature offset: 1 bytes
"""
signature = bytes([0x46, 0x49, 0x43, 0x48, 0x49, 0x45, 0x52, 0x20, 0x47, 0x55, 0x49, 0x54, 0x41, 0x52, 0x45, 0x20, 0x50, 0x52, 0x4F, 0x20])
with open(file_path, "rb") as f:
f.seek(1)
return f.read(20) == signature
How to validate .gp4 files in Node.js
Node.js
function isGP4(buffer: Buffer): boolean {
// Signature offset: 1 bytes
const signature = Buffer.from([0x46, 0x49, 0x43, 0x48, 0x49, 0x45, 0x52, 0x20, 0x47, 0x55, 0x49, 0x54, 0x41, 0x52, 0x45, 0x20, 0x50, 0x52, 0x4F, 0x20]);
if (buffer.length < 21) return false;
return buffer.subarray(1, 21).equals(signature);
}
Go
func IsGP4(data []byte) bool {
// Signature offset: 1 bytes
signature := []byte{0x46, 0x49, 0x43, 0x48, 0x49, 0x45, 0x52, 0x20, 0x47, 0x55, 0x49, 0x54, 0x41, 0x52, 0x45, 0x20, 0x50, 0x52, 0x4F, 0x20}
if len(data) < 21 {
return false
}
return bytes.Equal(data[1:21], signature)
}
API Endpoint
GET
/api/v1/gp4
curl https://filesignature.org/api/v1/gp4