{
	"$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": [
						{
							"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"
						},
						{
							"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"
						},
						{
							"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"
						},
						{
							"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"
						}
					]
				},
				{
					"auto-start": true,
					"loop": true,
					"segments": [
						{
							"duration": { "beats": 1 },
							"actions": [
								{
									"set-value": {
										"output": 4,
										"value": {
											"rand": {
												"lower": 1,
												"upper": 2
											},
											"calc": [
												{ "quantize": { "ref": "c-major-pentatonic" } }
											]
										}
									}
								},
								{
									"timing": "gate",
									"output": 5
								}
							]
						}
					]
				}
			]
		}
	],
	"component-pool": {
		"tunings": [
			{
				"id": "c-major-pentatonic",
				"notes": [ "c", "d", "e", "g", "a" ]
			}
		],
        "actions": [
            {
                "id": "arp-gate-action",
                "timing": "gate",
				"if": { "ref": "should-play-note" },
                "output": 3
            },
			{
				"id": "determine-chance",
				"timing": "start",
				"set-variable": {
					"name": "play-note",
					"value": {
						"rand": {
							"lower": 0,
							"upper": 10
						}
					}
				}
			}
        ],
		"ifs": [
			{
				"id": "should-play-note",
				"gt": [
					{ "variable": "play-note" },
					{
						"input": 1,
						"calc": [
							{ "div": 2 },
							{ "add": 2.5 }
						]
					}
				]
			}
		],
		"segment-blocks" : [
			{
				"id": "arp",
				"repeat": 4,
				"segments": [
					{
						"duration": { "beats": 0.5 },
						"actions": [
							{
								"timing": "start",
								"set-value": { "output": 1, "value": { "variable": "root-note" } }
							},
							{ "ref": "determine-chance" },
							{
								"timing": "start",
								"if": { "ref": "should-play-note" },
								"set-value": { "output": 2, "value": { "variable": "chord-note-1" } }
							},
					        {
            					"ref": "arp-gate-action"
        					}
						]
					},
					{
						"duration": { "beats": 0.5 },
						"actions": [
							{ "ref": "determine-chance" },
							{
								"timing": "start",
								"if": { "ref": "should-play-note" },
								"set-value": { "output": 2, "value": { "variable": "chord-note-2" } }
							},
					        {
            					"ref": "arp-gate-action"
        					}
						]
					},
					{
						"duration": { "beats": 0.5 },
						"actions": [
							{ "ref": "determine-chance" },
							{
								"timing": "start",
								"if": { "ref": "should-play-note" },
								"set-value": { "output": 2, "value": { "variable": "chord-note-3" } }
							},
					        {
            					"ref": "arp-gate-action"
        					}
						]
					},
					{
						"duration": { "beats": 0.5 },
						"actions": [
							{ "ref": "determine-chance" },
							{
								"timing": "start",
								"if": { "ref": "should-play-note" },
								"set-value": {
									"output": 2,
									"value": {
										"variable": "chord-note-1",
										"calc": [
											{ "add": 1 }
										]
									}
								}
							},
					        {
            					"ref": "arp-gate-action"
        					}
						]
					}
				]
			}
		]
	}
}
