Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a tab from scratch #1

Closed
Perlence opened this issue Apr 3, 2016 · 3 comments
Closed

Creating a tab from scratch #1

Perlence opened this issue Apr 3, 2016 · 3 comments

Comments

@Perlence
Copy link
Owner

Perlence commented Apr 3, 2016

@matejkocevar wrote:

I'm kinda new to python and trying to write a code that writes some chords into a GP file. Is it possible to make a new file from zero? So far I'm only able to parse an existing GP file and then change the notes.

@Perlence
Copy link
Owner Author

Perlence commented Apr 3, 2016

Hello. Yes, I admit, creating a blank tab is not as easy as it should be. I've made some changes in the develop branch to make better default values.

So, pull the latest changes from develop and try this code to make a tab with one track and one blank measure:

import guitarpro

song = guitarpro.base.Song()
track = guitarpro.base.Track(name='Track 1')
track.strings = [guitarpro.base.GuitarString(n, v)
                 for n, v in enumerate([64, 59, 55, 50, 45, 40], start=1)]
measure = guitarpro.base.Measure()
measure.voices = [guitarpro.base.Voice(), guitarpro.base.Voice()]
for voice in measure.voices:
    voice.addBeat(guitarpro.base.Beat())
track.addMeasure(measure)
song.addTrack(track)

guitarpro.write(song, 'blank.gp5')

@matejkocevar
Copy link

Thanks!

@pasan9
Copy link

pasan9 commented Apr 19, 2019

Hi!
I'm trying to write a tab from scratch from a music21 stream and an array of finger positions for the relevant stream, could you update this code to match the latest version?
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants