Skip to content

JSON

Structure

Musicline files stored as JSON should be structured as follows:

ts
// Pseudo TypeScript to illustrate structure.

interface Line {
    | point: number, voice: string, type: 'marker', data: string,
    | point: number, voice: string, type: 'muted',  data: string,
    | point: number, voice: string, type: 'note',   data: string,
    | point: number, voice: string, type: 'rest',
    | point: number, voice: string, type: 'tail',
    | point: number, voice: string, type: 'tempo',  data: number,
}

interface JSON {
    line: Array<Line>
}

WARNING

There is no event short-form for JSON files.

Example

Musicline

musicline
    # Bach
0 1 tempo 60
0 1 note B♭
1 1 note A
2 1 note C
3 1 note B♮
4 1 tail

JSON

json
{
    "line": [
        { "point": 0, "voice": "1", "type": "tempo", "data": 60   },
        { "point": 0, "voice": "1", "type": "note",  "data": "B♭" },
        { "point": 1, "voice": "1", "type": "note",  "data": "A"  },
        { "point": 2, "voice": "1", "type": "note",  "data": "C"  },
        { "point": 3, "voice": "1", "type": "note",  "data": "B♮" },
        { "point": 4, "voice": "1", "type": "tail"                }
    ]
}