{
	"$schema": "https://not-things.com/schemas/timeseq-script-1.1.0.schema.json",
	"type": "not-things_timeseq_script",
	"version": "1.1.0",
	"timelines": [
		{
			"time-scale": {
				"bpm": 120,
				"bpb": 4
			},
			"lanes": [
				{
					"auto-start": true,
					"loop": true,
					"segments": [
						{
							"x-description": "Set the variables for the root note and chord notes for the C chord using segment-block start actions, and let the 'arp' segment block use those to play the actual notes.",
							"actions": [
								{
									"set-variable": {
										"name": "root-note",
										"value": "C3"
									}
								},
								{
									"set-variable": {
										"name": "chord-note-1",
										"value": "C4"
									}
								},
								{
									"set-variable": {
										"name": "chord-note-2",
										"value": "E4"
									}
								},
								{
									"set-variable": {
										"name": "chord-note-3",
										"value": "G4"
									}
								}
							],
							"segment-block": "arp"
						},
						{
							"x-description": "Do the same for the F chord, with the JSON written a bit more compact.",
							"actions": [
								{ "set-variable": { "name": "root-note", "value": "F3" } },
								{ "set-variable": { "name": "chord-note-1", "value": "C4" } },
								{ "set-variable": { "name": "chord-note-2", "value": "F4" } },
								{ "set-variable": { "name": "chord-note-3", "value": "A4" } }
							],
							"segment-block": "arp"
						},
						{
							"x-description": "The same as before, but for the D chord.",
							"actions": [
								{ "set-variable": { "name": "root-note", "value": "D3" } },
								{ "set-variable": { "name": "chord-note-1", "value": "D4" } },
								{ "set-variable": { "name": "chord-note-2", "value": "F4" } },
								{ "set-variable": { "name": "chord-note-3", "value": "A4" } }
							],
							"segment-block": "arp"
						},
						{
							"x-description": "The final G chord.",
							"actions": [
								{ "set-variable": { "name": "root-note", "value": "G3" } },
								{ "set-variable": { "name": "chord-note-1", "value": "D4" } },
								{ "set-variable": { "name": "chord-note-2", "value": "G4" } },
								{ "set-variable": { "name": "chord-note-3", "value": "B4" } }
							],
							"segment-block": "arp"
						}
					]
				}
			]
		}
	],
	"component-pool": {
        "actions": [
            {
                "id": "arp-gate-action",
				"x-description": "",
                "timing": "gate",
                "output": 3
            }
        ],
		"segment-blocks" : [
			{
				"x-description": "Instead of a segment-block for each chord, a single segment-block can handle all chords through the usage of variables.",
				"id": "arp",
				"repeat": 4,
				"segments": [
					{
						"duration": { "beats": 0.5 },
						"actions": [
							{
								"x-description": "The first action of the first segment will not only set the chord note, but also set the root/bass note of the chord.",
								"set-value": { "output": 1, "value": { "variable": "root-note" } }
							},
							{
								"set-value": { "output": 2, "value": { "variable": "chord-note-1" } }
							},
					        {
            					"ref": "arp-gate-action"
        					}
						]
					},
					{
						"duration": { "beats": 0.5 },
						"actions": [
							{
								"set-value": { "output": 2, "value": { "variable": "chord-note-2" } }
							},
					        {
            					"ref": "arp-gate-action"
        					}
						]
					},
					{
						"duration": { "beats": 0.5 },
						"actions": [
							{
								"set-value": { "output": 2, "value": { "variable": "chord-note-3" } }
							},
					        {
            					"ref": "arp-gate-action"
        					}
						]
					},
					{
						"duration": { "beats": 0.5 },
						"actions": [
							{
								"set-value": {
									"output": 2,
									"value": {
										"variable": "chord-note-1",
										"calc": [
											{ "add": 1 }
										]
									}
								}
							},
					        {
            					"ref": "arp-gate-action"
        					}
						]
					}
				]
			}
		]
	}
}
