"use strict";

/* --------------------------------------------------- */
/* SkyDragon Story track 27                            */
/* Ready - Pet - Go!                                   */
/* (Ultimate Arena Challenge)                          */
/* (c) Sean Kelly, 2022                                */
/* --------------------------------------------------- */
DATA_CHIPTUNES["Ready - Pet - Go!"] = {
		"chip": "oneofeach"
	,	"bpm": 320 // beats per minute; 160 in 8ths
	,	"priority": 1 // baseline nonzero for BGM
	,	"songdata" : {
			"st":	// name of a channel on the chip	
				[
					{"command": "env", // set linear ramp envelope applied to every note; dur is measured in seconds, 0 means length of current note
						"data": {"start": 1.0, "end": 0.0, "dur": 0.375}
					}
				,	{"command": "sweep", // set linear frequency sweep applied to every note (start and end multiply base note frequency)
						"data": {"start": 1.0, "end": 1.0, "dur": 0}
					}
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.0675}
					}
				//,	{"command": "tempo", // change tempo mid-tune
				//		"data": {"bpm": 320}
				//	}
				,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": 0}
					}

				// A

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {
								"position": 0.125, // float 0-1; 0.0=left, 1.0=right
								"travel": 0.75, // float; offset from position for auto-panning; optional (no auto-pan if omitted)
								"dur": 3.0, // float, seconds; optional (no auto-pan if omitted)
								"alternate": true // bool; false = always pan from position to position+travel, true = pan from position to position+travel and back; optional (false if omitted)
							}
					}

				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"


						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"An1 1"
						,	"Bf1 1"
						,	"Bn1 1"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -1, "times": 3}
					}

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {
								"position": 0.125, // float 0-1; 0.0=left, 1.0=right
								"travel": 0.75, // float; offset from position for auto-panning; optional (no auto-pan if omitted)
								"dur": 1.5, // float, seconds; optional (no auto-pan if omitted)
								"alternate": true // bool; false = always pan from position to position+travel, true = pan from position to position+travel and back; optional (false if omitted)
							}
					}

				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"


						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"An1 1"
						,	"Bf1 1"
						,	"Bn1 1"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -1, "times": 1}
					}

				// B

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.375}
					}
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.05}
					}

				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"


						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Gn1 1"
						,	"An1 1"
						,	"Bn1 1"
						]
					}
					,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"


						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"An1 1"
						,	"Bf1 1"
						,	"Bn1 1"
						]
					}
					,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"


						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"An1 1"
						,	"Bf1 1"
						,	"Bn1 1"
						]
					}
					,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"


						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"An1 1"
						,	"Bf1 1"
						,	"Bn1 1"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -4, "times": 1}
					}

				// C

				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						]
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						]
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						]
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"An1 1"
						,	"Bf1 1"
						,	"An1 1"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -4, "times": 1}
					}

				// D

				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						]
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Cn2 1"
						,	"Bf1 1"
						,	"Bn1 1"
						,	"An1 1"
						]
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Dn2 1"
						,	"Dn2 1"
						,	"Dn2 1"
						,	"Dn2 1"
						,	"Dn2 1"
						,	"Dn2 1"
						,	"Dn2 1"
						,	"Dn2 1"
						]
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Dn2 1"
						,	"Dn2 1"
						,	"Dn2 1"
						,	"Dn2 1"
						,	"Dn2 1"
						,	"Dn2 1"
						,	"Dn2 1"
						,	"Dn2 1"
						]
					}

				//,	{"command": "jump", // reset the loop counter
				//		"data": {"reset": true}
				//	}
				//,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
				//		"data": {"delta": -4, "times": 1}
				//	}
				]
		,	"sq":	// name of a channel on the chip	
				[
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.0, "dur": 0.5}
					}
				,	{"command": "sweep", // set linear frequency sweep applied to every note (start and end multiply base note frequency)
						"data": {"start": 1.0, "end": 1.0, "dur": 0}
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.05}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.625}
					}
				,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": 2}
					}

				// A

				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn5 1"
						,	"Cn4 1"
						,	"Rst 1"
						,	"Cn4 1"
						,	"Rst 1"
						,	"Cn4 1"
						,	"Rst 1"
						,	"Cn4 1"


						,	"Rst 1"
						,	"Cn4 1"
						,	"Rst 1"
						,	"Cn4 1"
						,	"Rst 1"
						,	"Cn4 1"
						,	"Rst 1"
						,	"Cn4 1"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -1, "times": 5}
					}

				// B
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.0375}
					}

				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn5 1"
						,	"Cn4 1"
						,	"Rst 1"
						,	"Cn4 1"
						,	"Rst 1"
						,	"Cn4 1"
						,	"Rst 1"
						,	"Cn4 1"


						,	"Rst 1"
						,	"Cn4 1"
						,	"Rst 1"
						,	"Cn4 1"
						,	"Rst 1"
						,	"Cn4 1"
						,	"Rst 1"
						,	"Cn4 1"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -1, "times": 7}
					}

				// C

				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.025}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Ef4 1"
						,	"Bf4 1"
						,	"Ef4 1"
						,	"Bf4 1"
						,	"Ef4 1"
						,	"Bf4 1"
						,	"Ef4 1"
						,	"Bf4 1"


						,	"Ef4 1"
						,	"Bf4 1"
						,	"Ef4 1"
						,	"Bf4 1"
						,	"Ef4 1"
						,	"Bf4 1"
						,	"Ef4 1"
						,	"Bf4 1"
						]
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.0375}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Fn4 1"
						,	"Cn5 1"
						,	"Fn4 1"
						,	"Cn5 1"
						,	"Fn4 1"
						,	"Cn5 1"
						,	"Fn4 1"
						,	"Cn5 1"


						,	"Fn4 1"
						,	"Cn5 1"
						,	"Fn4 1"
						,	"Cn5 1"
						,	"Fn4 1"
						,	"Cn5 1"
						,	"Fn4 1"
						,	"Cn5 1"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -4, "times": 1}
					}

				// D

				
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.05}
					}
				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Gn4 1"
						,	"Dn5 1"
						,	"Gn4 1"
						,	"Dn5 1"
						,	"Gn4 1"
						,	"Dn5 1"
						,	"Gn4 1"
						,	"Dn5 1"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -1, "times": 3}
					}
				]
		,	"tri":	// name of a channel on the chip	
				[
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 0.75, "end": 1.0, "dur": 0.125}
					}
				,	{"command": "sweep", // set linear frequency sweep applied to every note (start and end multiply base note frequency)
						"data": {"start": 1.0625, "end": 1.0, "dur": 0.125}
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.1}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.25}
					}
				,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": 0}
					}

				// A

				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn4 16"

						,	"En4 16"

						,	"En4 16"

						,	"Bf4 16"

						,	"Bf4 2"
						,	"Bf4 2"
						,	"Bf4 2"
						,	"Bf4 2"
						,	"Bf4 2"
						,	"Bf4 2"
						,	"Bf4 2"
						,	"Bf4 2"

						,	"Bf4 12"
						]
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.5, "dur": 0}
					}
				,	{"command": "sweep", // set linear frequency sweep applied to every note (start and end multiply base note frequency)
						"data": {"start": 1.0, "end": 0.5, "dur": 0}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Bf4 4"
						]
					}

				// B

				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.125, "end": 1.0, "dur": 0.125}
					}
				,	{"command": "sweep", // set linear frequency sweep applied to every note (start and end multiply base note frequency)
						"data": {"start": 1.0, "end": 1.0, "dur": 0}
					}

				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn5 3"
						,	"Bn4 3"
						,	"An4 3"
						,	"Gn4 3"

						,	"An4 2"
						,	"Bn4 2"
						]
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn5 3"
						,	"Bf4 3"
						,	"An4 3"
						,	"Gn4 3"

						,	"An4 2"
						,	"Bf4 2"
						]
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Bf4 3"
						,	"An4 3"
						,	"Gn4 3"
						,	"Fn4 3"

						,	"Gn4 2"
						,	"An4 2"
						]
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Bf4 3"
						,	"Af4 3"
						,	"Gn4 3"
						,	"Fn4 3"

						,	"Gn4 2"
						,	"Af4 2"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -4, "times": 1}
					}

				// C


				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 640} // 16ths
					}

				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.5}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Bf4 6"
						,	"An4 6"
						,	"Gn4 6"
						,	"Fn4 6"

						,	"Gn4 4"
						,	"An4 4"
						]
					}

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {
								"position": 0.875, // float 0-1; 0.0=left, 1.0=right
								"travel": -0.75, // float; offset from position for auto-panning; optional (no auto-pan if omitted)
								"dur": 0.75, // float, seconds; optional (no auto-pan if omitted)
								"alternate": true // bool; false = always pan from position to position+travel, true = pan from position to position+travel and back; optional (false if omitted)
							}
					}
				//,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
				//		"data": {"position": 0.875}
				//	}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn5 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"An4 1"
						,	"Af4 1"
						,	"An4 1"
						,	"Bf4 1"
						,	"Bn4 1"
						]
					}
				//,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
				//		"data": {"position": 0.125}
				//	}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn5 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"An4 1"
						,	"Af4 1"
						,	"An4 1"
						,	"Bf4 1"
						,	"Bn4 1"
						]
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.5}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn5 16"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -7, "times": 1}
					}

				// D

				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.1125}
					}
				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {
								"position": 0.875, // float 0-1; 0.0=left, 1.0=right
								"travel": -0.75, // float; offset from position for auto-panning; optional (no auto-pan if omitted)
								"dur": 0.75, // float, seconds; optional (no auto-pan if omitted)
								"alternate": true // bool; false = always pan from position to position+travel, true = pan from position to position+travel and back; optional (false if omitted)
							}
					}
				//,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
				//		"data": {"position": 0.875}
				//	}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Dn5 1"
						,	"Df5 1"
						,	"Cn5 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"Bn4 1"
						,	"Cn5 1"
						,	"Df5 1"
						]
					}
				//,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
				//		"data": {"position": 0.125}
				//	}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Dn5 1"
						,	"Df5 1"
						,	"Cn5 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"Bn4 1"
						,	"Cn5 1"
						,	"Df5 1"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -3, "times": 1}
					}

				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 320} // 8ths
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.5}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Dn5 16"
						]
					}
				
				]
		,	"sin":	// name of a channel on the chip	
				[
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 0.75, "end": 1.0, "dur": 0.125}
					}
				,	{"command": "sweep", // set linear frequency sweep applied to every note (start and end multiply base note frequency)
						"data": {"start": 1.0625, "end": 1.0, "dur": 0.125}
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.1}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.75}
					}
				,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": 0}
					}

				// A

				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Cn4 16"

						,	"Cn4 16"

						,	"Gn4 16"

						,	"Gn4 16"

						,	"Dn5 2"
						,	"Dn5 2"
						,	"Dn5 2"
						,	"Dn5 2"
						,	"Dn5 2"
						,	"Dn5 2"
						,	"Dn5 2"
						,	"Dn5 2"

						,	"Dn5 12"
						]
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.5, "dur": 0}
					}
				,	{"command": "sweep", // set linear frequency sweep applied to every note (start and end multiply base note frequency)
						"data": {"start": 1.0, "end": 0.5, "dur": 0}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Dn5 4"
						]
					}

				// B

				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.125, "end": 1.0, "dur": 0.125}
					}
				,	{"command": "sweep", // set linear frequency sweep applied to every note (start and end multiply base note frequency)
						"data": {"start": 1.0, "end": 1.0, "dur": 0}
					}

				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Gn4 3"
						,	"Gn4 3"
						,	"Fn4 3"
						,	"En4 3"

						,	"Fn4 2"
						,	"Gn4 2"
						]
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Gn4 3"
						,	"Gn4 3"
						,	"Fn4 3"
						,	"En4 3"

						,	"Fn4 2"
						,	"Gn4 2"
						]
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Ef4 3"
						,	"Ef4 3"
						,	"Ef4 3"
						,	"Dn4 3"

						,	"Ef4 2"
						,	"Ef4 2"
						]
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Ef4 3"
						,	"Ef4 3"
						,	"Ef4 3"
						,	"Dn4 3"

						,	"Ef4 2"
						,	"Ef4 2"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -4, "times": 1}
					}

				// C

				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.5}
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.125, "end": 1.0, "dur": 0.125}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Gn4 3"
						,	"Gn4 3"
						,	"Gn4 3"
						,	"Gn4 3"

						,	"Gn4 2"
						,	"Gn4 2"
						]
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 1.0, "dur": 0}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.125}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Ef4 4"
						]
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.875}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Ef4 4"
						]
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.125}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Ef4 4"
						]
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.875}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Ef4 4"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -12, "times": 1}
					}

				// D

				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.1125}
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.125, "end": 1.0, "dur": 0.125}
					}

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.5}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Fn4 2"
						,	"Fn4 2"
						,	"Fn4 2"
						,	"Fn4 2"

						,	"Fn4 2"
						,	"Fn4 2"
						,	"Fn4 2"
						,	"Fn4 2"
						]
					}

				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.1}
					}
				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 640} // 16ths
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {
								"position": 0.875, // float 0-1; 0.0=left, 1.0=right
								"travel": -0.75, // float; offset from position for auto-panning; optional (no auto-pan if omitted)
								"dur": 0.75, // float, seconds; optional (no auto-pan if omitted)
								"alternate": true // bool; false = always pan from position to position+travel, true = pan from position to position+travel and back; optional (false if omitted)
							}
					}
				//,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
				//		"data": {"position": 0.875}
				//	}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Bn4 1"
						,	"Bf4 1"
						,	"An4 1"
						,	"Af4 1"
						,	"Gn4 1"
						,	"Af4 1"
						,	"An4 1"
						,	"Bf4 1"
						]
					}
				//,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
				//		"data": {"position": 0.125}
				//	}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Bn4 1"
						,	"Bf4 1"
						,	"An4 1"
						,	"Af4 1"
						,	"Gn4 1"
						,	"Af4 1"
						,	"An4 1"
						,	"Bf4 1"
						]
					}
				
				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 320} // 8ths
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.5}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Bn4 8"
						]
					}
				]

		,	"nz":	// name of a channel on the chip	
				[
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.2, "dur": 0}
					}
				//,	{"command": "sweep", // set linear frequency sweep applied to every note (start and end multiply base note frequency)
				//		"data": {"start": 1.0, "end": 1.0, "dur": 0}
				//	}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.05}
					}
				,	{"command": "pan", 
						"data": {"position": 0.5}
					}
				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 640} // 16ths
					}
				//,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" cound when 2 similar frequencies overlap)
				//		"data": {"cents": 0}
				//	}

				// A

				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}

				,	{"command": "notes", 
						"data": [
							"Cn3 1" //bd2
						,	"Gn6 1" //hat2
						,	"Gn6 1" //hat2
						,	"Gn6 1" //hat2

						,	"Gn6 2" //hatsplash2
						,	"Gn6 1" //hat2
						,	"Gn6 1" //hat2

						,	"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Cn3 1" //bd2
						]
					}

				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -1, "times": 7}
					}

				,	{"command": "notes", 
						"data": [
							"Gn1 1" //bd
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat
						]
					}
				,	{"command": "notes", 
						"data": [
							"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat
						]
					}
				,	{"command": "notes", 
						"data": [
							"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat
						]
					}
				,	{"command": "notes", 
						"data": [
							"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Gn5 1" // ?
						,	"Gn1 1" //bd
						]
					}

				// B1

				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.0375}
					}

				// *smirks in percussion*
				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", 
						"data": [
							"Gn1 2" //bd
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 1" //hat
						,	"Rst 1" 
						,	"Gn1 2" //bd

						,	"Dn6 2" //hatsplash
						,	"Gn1 2" //bd
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -1, "times": 9}
					}
				,	{"command": "notes", 
						"data": [
							"Gn1 2" //bd
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Gn1 1" //bd
						]
					}

				// B2

				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", 
						"data": [
							"Gn1 2" //bd
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 1" //hat
						,	"Rst 1" 
						,	"Gn1 2" //bd

						,	"Dn6 2" //hatsplash
						,	"Gn1 2" //bd
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -1, "times": 9}
					}
				,	{"command": "notes", 
						"data": [
							"Gn1 2" //bd
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Gn1 1" //bd
						]
					}

				// C1

				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", 
						"data": [
							"Gn1 2" //bd
						,	"Gn1 1" //bd
						,	"Gn1 1" //bd

						,	"Dn6 1" //hat
						,	"Dn6 1" //hat
						,	"Gn1 1" //bd
						,	"Gn1 1" //bd
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -1, "times": 6}
					}
				,	{"command": "notes", 
						"data": [
							"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat
						]
					}

				// C2

				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", 
						"data": [
							"Gn1 2" //bd
						,	"Gn1 1" //bd
						,	"Gn1 1" //bd

						,	"Dn6 1" //hat
						,	"Dn6 1" //hat
						,	"Gn1 1" //bd
						,	"Gn1 1" //bd
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -1, "times": 6}
					}
				,	{"command": "notes", 
						"data": [
							"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat
						
						,	"Dn6 2" //hatsplash
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat
						]
					}

				// D

				// *grins manically in percussion*
				,	{"command": "notes", 
						"data": [
							"Dn6 2" //hatsplash
						,	"Gn1 1" //bd
						,	"Gn1 1" //bd
						
						,	"Gn1 2" //bd
						,	"Dn6 1" //hat
						,	"Rst 1" 

						,	"Gn1 2" //bd
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Gn1 2" //bd
						]
					}
				,	{"command": "notes", 
						"data": [
							"Gn1 1" //bd
						,	"Gn1 1" //bd
						,	"Dn6 1" //hat
						,	"Rst 1" 

						,	"Dn6 2" //hatsplash
						,	"Gn1 2" //bd

						,	"Gn1 2" //bd
						,	"Dn6 2" //hatsplash

						,	"Gn1 2" //bd
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						]
					}
				,	{"command": "notes", 
						"data": [
							"Dn6 2" //hatsplash
						,	"Gn1 1" //bd
						,	"Gn1 1" //bd
						
						,	"Dn6 1" //hat
						,	"Rst 1" 
						,	"Dn6 2" //hatsplash

						,	"Gn1 2" //bd
						,	"Dn6 1" //hat
						,	"Dn6 1" //hat

						,	"Dn6 2" //hatsplash
						,	"Gn1 2" //bd
						]
					}
				,	{"command": "notes", 
						"data": [
							"Dn6 2" //hatsplash
						,	"Gn1 2" //bd

						,	"Dn6 2" //hatsplash
						,	"Gn1 2" //bd

						,	"Dn6 2" //hatsplash
						,	"Gn1 2" //bd

						,	"Dn6 1" //hat
						,	"Dn6 1" //hat
						,	"Gn1 2" //bd
						]
					}

				]
		}
	};