# tab_to_piano_notes: read guitar tab as piano pitches

For AI agents: the site index is at https://clefdrills.com/llms.txt and the HTML version of this page is at https://clefdrills.com/docs/mcp/tools/tab-to-piano-notes.

Convert six-string ASCII guitar tab to sounding piano pitches, one event per tab column. Part of the [Clef Music Tools MCP server](https://clefdrills.com/docs/mcp). Endpoint: `https://clefdrills.com/mcp`, no account needed, read-only.

## What it does

`tab_to_piano_notes` reads six-string ASCII guitar tab in standard tuning and returns the sounding pitches as MIDI numbers, one event for each tab column that has notes. Each event lists the source string and fret of every note, so you can trace a pitch back to the tab.

Tab has no rhythm. Columns give order only, so no note durations are returned. Alternate tunings, seven-string guitars, Guitar Pro files and images of tab are not supported.

## Input schema

```
{
  "tab": string, 1 to 20000 characters, six string rows labelled e, B, G, D, A, E from top to bottom
  "capo": integer, 0 to 12, default 0
}
```

All fields are validated before the tool runs.

## Output

On success: `structuredContent` with `result.events` (each `{ index, block, column, midis, sources }`, where `sources` is a list of `{ string, fret, midi }` and string 1 is the high e), `result.warnings`, a top-level `warnings` list about rhythm, and `browserTool` (https://clefdrills.com/tools/guitar-tab-to-piano/).

## Example calls

### Two chords

Open strings and fretted notes in the same column become one event with several pitches.

```bash
curl -s https://clefdrills.com/mcp \
  -H 'content-type: application/json' \
  -H 'accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"tab_to_piano_notes","arguments":{"tab":"e|-0-3-|\nB|-1-0-|\nG|-0-0-|\nD|-2-0-|\nA|-3-2-|\nE|-----|"}}}'
```

Result:

```json
{ "result": { "events": [
    { "index": 0, "block": 0, "column": 1, "midis": [48, 52, 55, 60, 64],
      "sources": [ { "string": 1, "fret": 0, "midi": 64 }, { "string": 2, "fret": 1, "midi": 60 }, { "string": 3, "fret": 0, "midi": 55 }, { "string": 4, "fret": 2, "midi": 52 }, { "string": 5, "fret": 3, "midi": 48 } ] },
    { "index": 1, "block": 0, "column": 3, "midis": [47, 50, 55, 59, 67],
      "sources": [ { "string": 1, "fret": 3, "midi": 67 }, { "string": 2, "fret": 0, "midi": 59 }, { "string": 3, "fret": 0, "midi": 55 }, { "string": 4, "fret": 0, "midi": 50 }, { "string": 5, "fret": 2, "midi": 47 } ] }
  ],
  "warnings": ["Columns show order, not rhythm; no note durations are encoded."] },
  "warnings": ["Rhythm and note durations are not inferred from spacing. Standard six-string guitar tuning only."],
  "browserTool": "https://clefdrills.com/tools/guitar-tab-to-piano/" }
```

### Single notes with a capo on fret 2

With `capo` 2 the open high e string sounds F#4 (MIDI 66) instead of E4 (MIDI 64): fret numbers in the tab are counted from the capo.

```bash
curl -s https://clefdrills.com/mcp \
  -H 'content-type: application/json' \
  -H 'accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"tab_to_piano_notes","arguments":{"tab":"e|-0-----|\nB|---1---|\nG|-----0-|\nD|-------|\nA|-------|\nE|-------|","capo":2}}}'
```

Result:

```json
{ "result": { "events": [
    { "index": 0, "block": 0, "column": 1, "midis": [66], "sources": [ { "string": 1, "fret": 0, "midi": 66 } ] },
    { "index": 1, "block": 0, "column": 3, "midis": [62], "sources": [ { "string": 2, "fret": 1, "midi": 62 } ] },
    { "index": 2, "block": 0, "column": 5, "midis": [57], "sources": [ { "string": 3, "fret": 0, "midi": 57 } ] }
  ],
  "warnings": ["Columns show order, not rhythm; no note durations are encoded."] },
  "warnings": ["Rhythm and note durations are not inferred from spacing. Standard six-string guitar tuning only."],
  "browserTool": "https://clefdrills.com/tools/guitar-tab-to-piano/" }
```

## Edge cases and errors

- Events are ordered left to right. `index` counts events, `column` is the character position in the row and `block` numbers separate tab blocks in the same input.
- The warning "Columns show order, not rhythm; no note durations are encoded." is always present. Tell the user that durations are not included.
- Text that is not tab fails with the line number: `hello world` returns `Line 1: expected e| string row`.
- Tab with six rows and no fret numbers fails with `Tablature must contain at least one note.`
- `capo` above 12 is rejected by validation.

Errors come back as a normal tool result with `isError: true`, so the client can show the message. Real error results from the live server:

```
arguments: {"tab":"hello world"}

{ "isError": true, "content": [{ "type": "text", "text": "Line 1: expected e| string row" }] }
```

```
arguments: {"tab":"e|-----|\nB|-----|\nG|-----|\nD|-----|\nA|-----|\nE|-----|"}

{ "isError": true, "content": [{ "type": "text", "text": "Tablature must contain at least one note." }] }
```

```
arguments: {"tab":"e|-0-3-|\nB|-----|\nG|-----|\nD|-----|\nA|-----|\nE|-----|","capo":13}

{ "isError": true, "content": [{ "type": "text", "text": "MCP error -32602: Input validation error: Invalid arguments for tool tab_to_piano_notes: Number must be less than or equal to 12 at capo" }] }
```

## Related pages

- [Connect a client](https://clefdrills.com/docs/mcp/connect)
- [Limits and privacy](https://clefdrills.com/docs/mcp/limits-and-privacy)
- [All Clef Music Tools docs](https://clefdrills.com/docs/mcp)
