toFret API

Chords and scales API

Get matching chords and scales for any combination of notes. If you are comfortable using cURL, you might want to try our reverse chords and scales API . This API returns plain old JSON, so don't be afraid.

Tablature API

If you have a web site with guitar tablature, you should consider using our integration tools to bring the functionality of toFret to your web site. It comes in the form of a web service.

The example on the right is created using the toFret tablature API web service. You can either click the blue text or the guitar tab itself to toggle the fretboard notes.

Example without player

Toggle fretboard
					
e|-----------------------------|
B|-5-5-4-4-2-2-2-2-------------|
G|-----------------4-4-2-1-----|
D|-------------------------4-2-|
A|-----------------------------|
E|-----------------------------|
				
				

What it does

First of all, let me tell you what the guitar tab API does.

The toFret guitar tab API converts plain text tablature music notation to actual positions of notes on the fretboard for a range of instruments. The output is plain text, and can be easily made more attractive by styling it with CSS.

Let's say you have a website with guitar tabs. You can trigger the toFret API to visualise the positions of the notes.

Tablature API

tablature examples

Suppose you have this tab on your site:
G-------------------------------|
D-3-33-0-------0----------------|
A--------2-2-3------------------|
E-------------------------------|
To make use of the toFret integration you do the following:

- Include tofret-embedded.js
- Put the tab into a div with a unique id.
- Add a trigger function to an element on the page

To integrate the toFret functionality into your web site, you will need to add a few bits of HTML to you texts and templates to call the API.

Here is a full example with the player enabled

API example for bass tablature

Consider the following bass tablature example. Click on it to toggle the fretboard visualisation on and off. This example uses the tablature player. It doesn't make sound but shows the positions of the notes in the tablature.

show tablature player
		
G-------------------------------|
D-3-33-0-------0----------------|
A--------2-2-3------------------|
E-------------------------------|

	
	

Explanation of example

Add the following anywhere, but preferably in your head element. It links to a javascript file hosted on our servers. Include the javascript file only once per page.

If you would rather have the code on your own servers, you can just copy the code in the toFret javascript source. It is only one function and by hosting it yourself you can tweak it.

Now, once you have the javascript function installed and working somewhere, you can define blocks of tabs by using html SPAN tags. Make sure to give every block a unique id.

Lastly, you need to add a trigger element to convert your tabs toFret. You can also add the trigger to the tab itself as in the full example above.

Other instruments

The toFret tab API supports several additional tunings like electric bass, banjo, ukulele and mandolin. Standard tuning is for a six string guitar. You change the tuning by setting the second parameter to your preferred tuning.

Instrument options
guitar
bass
banjo
ukulele
mandolin



toFretIntegration( elementId, tuning, numFrets );

So,
to get 14 frets of a bass guitar fretboard you would do this:
toFretIntegration( 'myClassId', 'bass', 14 );

But you could also do:
toFretIntegration( 'myClassId', 'ukulele', 8 );
to get 8 frets of G C E A tuned ukulele.

Guitar is obviously available:
toFretIntegration( 'myClassId', 'guitar', 24 );
this will give you 24 frets of E A D G B e tuned guitar. I hope it fits your monitor.

For TAB sites

You have a web site that offers plain text TAB. We can provide your with a few pieces of HTML code to offer conversion to fretboard right on your website.

for Music lesson sites

You offer music lessons, so a quick lookup to see each occurence of a note on the fretboard of an instrument could be handy.





2015 toFret | About | API | Contact