stdtabs / phptabs

A PHP library for reading, writing and rendering guitar tablatures and MIDI files
https://phptabs.readthedocs.io/
GNU Lesser General Public License v2.1
41 stars 8 forks source link

phptabs itterating tru partiture #1

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hi, Looking at the phptabs, lot's of work on this project, and well coded and done.

I am looking at the methods, and I cannot figure it out how do I walk trough a partiture, I am trying to generate guitar tabs, eventually vextab file to be played in vextab player. Thank you.

landrok commented 7 years ago

Hi,

If you want to have a better understanding of the internal data structure, you should use dump() method.

These feature is in the master branch:

composer require stdtabs/phptabs:dev-master

Below, an example with a test file and an XML dump:

include 'vendor/autoload.php';

use PhpTabs\PhpTabs;

$tabs = new PhpTabs('vendor/stdtabs/phptabs/test/PhpTabs/samples/testSimpleTab.gp3');

echo $tabs->dump('xml');

Other supported formats for dump method are readable here: https://github.com/stdtabs/phptabs/blob/master/src/PhpTabs/Component/Dumper.php#L35

Hope this helps.

ghost commented 7 years ago

Looks like members are mostly private. I figured that , but listing the XML for a decent file takes forever.

landrok commented 7 years ago

A VexTab renderer has been pushed into the master branch.

Below, a simple usage example:

include 'vendor/autoload.php';

use PhpTabs\PhpTabs;

$tabs = new PhpTabs('vendor/stdtabs/phptabs/test/PhpTabs/samples/testSimpleTab.gp3');

echo $tabs->getRenderer('vextab')->render(0); // 0 stands for first track

It renders something like:

options scale=1 space=16 width=520 tempo=66

tabstave notation=true time=12/8

notes =|: :q 5/2 5/2 5/2 5/2 5/2 5/2 |:q 5/2 5/2 (3/1.5/2.5/3.5/4.3/5.3/6) 5/2 5/2 5/2 

[...]

You can find a documentation for this renderer: https://stdtabs.github.io/render-as-vextab.html

This is a very fresh implementation. If you have any comments, please fill this issue.

Notes about your last comment

landrok commented 7 years ago

FYI a more advanced implementation of the vextab renderer is planned in the next PhpTabs release (0.5.0).

If needed, you can reopen this issue.