Sha256: 088e21f1bb6973579c1861583b93fffb8859690b2fc96ecf08c36565843942c9

Contents?: true

Size: 1.75 KB

Versions: 3

Compression:

Stored size: 1.75 KB

Contents

# GuitarProParser

It is a gem for Ruby that allows to read Guitar Pro files.
Now it supports Guitar Pro 4 and 5 files. Version 3 should work but is not tested at all.

## Installation

Add this line to your application's Gemfile:

    gem 'guitar_pro_parser'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install guitar_pro_parser

## Usage
  
  Require the library:

    require 'guitar_pro_parser'

  Read the file:

    song = GuitarProParser.read_file('path_to_file')

  Now you can access song's properties like that:

    # Get some attributes of the song
    puts song.title
    puts song.artist
    puts song.bpm

    # Or read notes
    song.tracks.each do |track|
      track.bars.each do |bar|
        puts "There are #{bar.voices[:lead].count} beats in lead voice"
        puts "There are #{bar.voices[:bass].count} beats in bass voice" unless bar.voices[:bass].nil?

        bar.voice[:lead] do |beat|
          beat.strings.each do |string, note|
            puts "Play #{string} string on the #{note.fret} fret."
            puts "Note's duration is #{note.duration}"
          end
        end
      end
    end

  If you don't need any information about beats, notes and other music stuff you can read headers only:

    song = GuitarProParser.read_headers('path_to_file')

    # You'll have title, subtitle, artist, etc.
    song.title # => 'Title'

    # But no notes
    song.tracks.first.bars # => []

  All available methods and attributes could be found in the source code. :)
  
  TODO: Write documentation.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
guitar_pro_parser-0.0.3 README.md
guitar_pro_parser-0.0.2 README.md
guitar_pro_parser-0.0.1 README.md