"use strict";

/* --------------------------------------------------- */
/* SkyDragon Story track (10b)                         */
/* Teamwork                                            */
/* (Raviene+Meli finale)                               */
/* (c) Sean Kelly, 2015                                */
/* --------------------------------------------------- */
DATA_CHIPTUNES["Teamwork"] = {
		"chip": "oneofeach"
	,	"bpm": 120 // beats per minute; in this case, value is nominal
	,	"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.25}
					}
				//,	{"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.0375}
					}
				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 360} // 120 in 8th-triples
					}
				,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": 4}
					}

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						//"data": {"position": 0.25, "travel": 0.5, "dur": 60.0/360, "alternate":true}
						"data": {"position": 0.25, "travel": 0.5, "dur": 0.166666667, "alternate":true} // less precise, but easier for SoundEdit JSON
					}
				// intro + section A bar 1
				,	{"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": [
							"An3 1"
						,	"Cn4 1"
						,	"En4 1"
						,	"Cn4 1"
						,	"An4 1"
						,	"En4 1"
						,	"Cn5 1"
						,	"An4 1"
						,	"En4 1"
						,	"Cn4 1"
						,	"Dn4 1"
						,	"En4 1"
						]
					}

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

				// section A bar 2
				,	{"command": "notes",
						"data": [
							"Gn3 1"
						,	"Bn3 1"
						,	"Dn4 1"
						,	"Bn3 1"
						,	"Gn4 1"
						,	"Dn4 1"
						,	"Bn4 1"
						,	"Gn4 1"
						,	"Dn4 1"
						,	"Bn3 1"
						,	"Cn4 1"
						,	"Dn4 1"
						]
					}

				// section A bar 3
				,	{"command": "notes",
						"data": [
							"Fs3 1"
						,	"An3 1"
						,	"Dn4 1"
						,	"An3 1"
						,	"Fs4 1"
						,	"Dn4 1"
						,	"An4 1"
						,	"Fs4 1"
						,	"Dn4 1"
						,	"An3 1"
						,	"Bn3 1"
						,	"An3 1"
						]
					}

				// section A bar 4
				,	{"command": "notes",
						"data": [
							"Fn3 1"
						,	"An3 1"
						,	"Cn4 1"
						,	"An3 1"
						,	"Fn4 1"
						,	"Cn4 1"
						,	"An4 1"
						,	"Fn4 1"
						,	"Cn4 1"
						,	"An3 1"
						,	"Bn3 1"
						,	"Cn4 1"
						]
					}


				// section A bar 5
				,	{"command": "notes",
						"data": [
							"An3 1"
						,	"Cn4 1"
						,	"En4 1"
						,	"Cn4 1"
						,	"An4 1"
						,	"En4 1"
						,	"Cn5 1"
						,	"An4 1"
						,	"En4 1"
						,	"Cn4 1"
						,	"Dn4 1"
						,	"En4 1"
						]
					}

				// section A bar 6
				,	{"command": "notes",
						"data": [
							"Gn3 1"
						,	"Bn3 1"
						,	"Dn4 1"
						,	"Bn3 1"
						,	"Gn4 1"
						,	"Dn4 1"
						,	"Bn4 1"
						,	"Gn4 1"
						,	"Dn4 1"
						,	"Bn3 1"
						,	"Cn4 1"
						,	"Dn4 1"
						]
					}

				// section A bar 7
				,	{"command": "notes",
						"data": [
							"Fs3 1"
						,	"An3 1"
						,	"Dn4 1"
						,	"An3 1"
						,	"Fs4 1"
						,	"Dn4 1"
						,	"An4 1"
						,	"Fs4 1"
						,	"Dn4 1"
						,	"An3 1"
						,	"Bn3 1"
						,	"An3 1"
						]
					}

				// section A bar 8
				,	{"command": "notes",
						"data": [
							"En3 1"
						,	"Gs3 1"
						,	"Bn3 1"
						,	"Gs3 1"
						,	"En4 1"
						,	"Bn3 1"
						,	"Gs4 1"
						,	"En4 1"
						,	"Bn4 1" // mistranscribed Bn3, but sounds good as-is
						,	"Gs3 1"
						,	"An3 1"
						,	"Bn3 1"
						]
					}



				// section B bars 1-6
				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}

				// bar 1/3/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": [
							"Dn3 1"
						,	"Fn3 1"
						,	"An3 1"
						,	"Fn3 1"
						,	"Dn4 1"
						,	"An3 1"
						,	"Fn4 1"
						,	"Dn4 1"
						,	"An3 1"
						,	"Dn4 1"
						,	"An3 1"
						,	"Fn3 1"
						]
					}

				// bar 2/4/6
				,	{"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": [
							"Gn3 1"
						,	"Bn3 1"
						,	"Dn4 1"
						,	"Bn3 1"
						,	"Gn4 1"
						,	"Dn4 1"
						,	"Bn4 1"
						,	"Gn4 1"
						,	"Dn4 1"
						,	"Bn3 1"
						,	"Cn4 1"
						,	"Dn4 1"
						]
					}


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

				// bar 7
				,	{"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": [
							"Dn3 1"
						,	"Fn3 1"
						,	"An3 1"
						,	"Fn3 1"
						,	"Dn4 1"
						,	"An3 1"
						,	"Fn4 1"
						,	"Dn4 1"
						,	"An3 1"
						,	"Dn4 1"
						,	"An3 1"
						,	"Fn3 1"
						]
					}

				// bar 8
				,	{"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": [
							"En3 1"
						,	"Gs3 1"
						,	"Bn3 1"
						,	"Gs3 1"
						,	"En4 1"
						,	"Bn3 1"
						,	"Gs4 1"
						,	"En4 1"
						,	"Bn3 1"
						,	"En4 1"
						,	"Bn3 1"
						,	"Gs3 1"
						]
					}



				// section C bars 1-8
				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}

				// bar 1/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": [
							"An3 1"
						,	"Cn4 1"
						,	"En4 1"
						,	"Cn4 1"
						,	"An4 1"
						,	"En4 1"
						,	"Gn4 1"
						,	"Dn4 1"
						,	"Bn3 1"
						,	"Dn4 1"
						,	"Bn3 1"
						,	"Gn3 1"
						]
					}


				// bar 2/6
				,	{"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": [
							"Fn3 1"
						,	"An3 1"
						,	"Cn4 1"
						,	"An3 1"
						,	"Fn4 1"
						,	"Dn4 1"
						,	"En4 1"
						,	"Bn3 1"
						,	"Gn3 1"
						,	"Bn3 1"
						,	"Gn3 1"
						,	"En3 1"
						]
					}


				// bar 3/7
				,	{"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": [
							"Dn3 1"
						,	"Fn3 1"
						,	"An3 1"
						,	"Fn3 1"
						,	"Dn4 1"
						,	"An3 1"
						,	"En4 1"
						,	"Bn3 1"
						,	"Gs3 1"
						,	"Bn3 1"
						,	"Gs3 1"
						,	"En3 1"
						]
					}


				// bar 4/8
				,	{"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": [
							"Fn3 1"
						,	"An3 1"
						,	"Cn4 1"
						,	"An3 1"
						,	"Fn4 1"
						,	"Cn4 1"
						,	"Bn4 1"
						,	"Gn4 1"
						,	"Dn4 1"
						,	"Bn3 1"
						,	"Dn4 1"
						,	"Bn3 1"
						]
					}

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

				]
		,	"sin":	// name of a channel on the chip	
				[
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 1.0, "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.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": "tempo", // change tempo mid-tune
						"data": {"bpm": 360} // 120 in 8th-triples
					}
				,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": 0}
					}

				// Intro
				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", 
						"data": [
							"An2 2"
						,	"En3 1"
						,	"Cn3 1"
						,	"En3 2"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -1, "times": 3}
					}

				// Section A
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.0875}
					}
				,	{"command": "notes", 
						"data": [
							"An2 2"
						,	"En3 1"
						,	"Cn3 1"
						,	"En3 2"
						,	"An2 2"
						,	"En3 1"
						,	"Cn3 1"
						,	"En3 2"
						]
					}
				,	{"command": "notes", 
						"data": [
							"Gn2 2"
						,	"Dn3 1"
						,	"Bn2 1"
						,	"Dn3 2"
						,	"Gn2 2"
						,	"Dn3 1"
						,	"Bn2 1"
						,	"Dn3 2"
						]
					}
				,	{"command": "notes", 
						"data": [
							"Fs2 2"
						,	"Dn3 1"
						,	"An2 1"
						,	"Dn3 2"
						,	"Fs2 2"
						,	"Dn3 1"
						,	"An2 1"
						,	"Dn3 2"
						]
					}
				,	{"command": "notes", 
						"data": [
							"Fn2 2"
						,	"Cn3 1"
						,	"An2 1"
						,	"Cn3 2"
						,	"Fn2 2"
						,	"Cn3 1"
						,	"An2 1"
						,	"Cn3 2"
						]
					}
				,	{"command": "notes", 
						"data": [
							"An2 2"
						,	"En3 1"
						,	"Cn3 1"
						,	"En3 2"
						,	"An2 2"
						,	"En3 1"
						,	"Cn3 1"
						,	"En3 2"
						]
					}
				,	{"command": "notes", 
						"data": [
							"Gn2 2"
						,	"Dn3 1"
						,	"Bn2 1"
						,	"Dn3 2"
						,	"Gn2 2"
						,	"Dn3 1"
						,	"Bn2 1"
						,	"Dn3 2"
						]
					}
				,	{"command": "notes", 
						"data": [
							"Fs2 2"
						,	"Dn3 1"
						,	"An2 1"
						,	"Dn3 2"
						,	"Fs2 2"
						,	"Dn3 1"
						,	"An2 1"
						,	"Dn3 2"
						]
					}
				,	{"command": "notes", 
						"data": [
							"En2 2"
						,	"Bn2 1"
						,	"Gs2 1"
						,	"Bn2 2"
						,	"En2 2"
						,	"Bn2 1"
						,	"Gs2 1"
						,	"Bn2 2"
						]
					}

				// Section B
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.15}
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.25, "dur": 0}
					}
				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", 
						"data": [
							"Dn2 4"
						,	"Dn2 2"
						,	"Dn2 4"
						,	"Dn2 2"
						,	"Gn2 4"
						,	"Gn2 2"
						,	"Gn2 4"
						,	"Gn2 2"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -1, "times": 3}
					}

				// Section C
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.1}
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 1.0, "dur": 0}
					}

				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", 
						"data": [
							"An2 2"
						,	"En3 1"
						,	"Cn3 1"
						,	"En3 2"

						,	"Gn2 2"
						,	"Dn3 1"
						,	"Bn2 1"
						,	"Dn3 2"
						]
					}
				,	{"command": "notes", 
						"data": [
							"Fn2 2"
						,	"Cn3 1"
						,	"An2 1"
						,	"Cn3 2"
						
						,	"En2 2"
						,	"Bn2 1"
						,	"Rst 1"
						,	"Bn2 2"
						]
					}
				,	{"command": "notes", 
						"data": [
							"Dn2 2"
						,	"An2 1"
						,	"Fn2 1"
						,	"An2 2"

						,	"En2 2"
						,	"Bn2 1"
						,	"Gs2 1"
						,	"Bn2 2"
						]
					}
				,	{"command": "notes", 
						"data": [
							"Fn2 2"
						,	"Cn3 1"
						,	"An2 1"
						,	"Cn3 2"
						
						,	"Gn2 2"
						,	"Dn3 1"
						,	"Rst 1"
						,	"Dn3 2"
						]
					}

				,	{"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	
				[
					// Meli theme
					{"command": "env", // set linear ramp envelope applied to every 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
						"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.5}
					}
				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 360} // 120 in 8th-triples
					}
				,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": -2}
					}
				// intro
				,	{"command": "notes", 
						"data": [
							"An5 1"
						,	"An5 2"
						,	"An5 2"
						,	"An5 1"
						,	"An5 2"
						,	"An5 2"
						,	"An5 2"

						,	"An5 1"
						,	"An5 2"
						,	"An5 2"
						,	"An5 1"
						,	"An5 2"
						,	"An5 2"
						,	"An5 2"
						]
					}

				// section A
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.075}
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.5, "dur": 0}
					}
				,	{"command": "notes", 
						"data": [
							"En5 7"
						,	"An4 .85"
						,	"Cn5 1.15"
						,	"En5 .85"
						,	"Cn5 1.15"
						,	"An4 .85"

						,	"Dn5 1.15"
						,	"Bn4 .85"
						,	"Gn4 1.15"
						,	"Gn5 5"
						,	"Fn5 2"
						,	"Gn5 2"

						,	"Fs5 7"
						,	"Fs4 .85"
						,	"An4 1.15"
						,	"Dn5 .85"
						,	"An4 1.15"
						,	"Fs4 .85"

						,	"Fn5 1.15"
						,	"Cn5 5.15"
						,	"An4 1.85"
						,	"Bn4 2"
						,	"Cn5 2"
						]
					}

					,	{"command": "notes", 
						"data": [
							"En5 7"
						,	"An4 .85"
						,	"Cn5 1.15"
						,	"En5 .85"
						,	"Cn5 1.15"
						,	"An4 .85"

						,	"Dn5 1.15"
						,	"Bn4 .85"
						,	"Gn4 2.15"
						,	"Gn5 4"
						,	"Fn5 2"
						,	"Gn5 2"

						,	"Fs5 7"
						,	"Fs4 .85"
						,	"An4 1.15"
						,	"Dn5 .85"
						,	"An4 1.15"
						,	"Fs4 .85"

						,	"Bn4 1.15"
						,	"Gs4 5"
						,	"Gs4 2"
						,	"An4 2"
						,	"Bn4 2"
						]
					}

				// section B
				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 1440} // 120 in 8th-triples, stereo split by 4
					}

				,	{"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.375, "travel": 0.25, "dur": 60.0/1440, "alternate": true}
						"data": {"position": 0.375, "travel": 0.125, "dur": 0.04166666666667, "alternate": true} // for JSON
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.05}
					}
				,	{"command": "notes", 
						"data": [
							"Fn4 1"
						,	"Fn4 3"
						,	"Cn5 1"
						,	"Cn5 3"
						,	"An4 1"
						,	"An4 3"
						,	"An4 1"
						,	"An4 23"
						,	"An4 1"
						,	"An4 3"
						,	"An4 1"
						,	"An4 3"
						,	"Fn4 1"
						,	"Fn4 3"
						]
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.0625}
					}
				,	{"command": "notes", 
						"data": [
							"Gn4 1"
						,	"Gn4 3"
						,	"Dn5 1"
						,	"Dn5 3"
						,	"Bn4 1"
						,	"Bn4 3"
						,	"Gn4 1"
						,	"Gn4 23"
						,	"Gn4 1"
						,	"Gn4 3"
						,	"Gn4 1"
						,	"Gn4 3"
						,	"En4 1"
						,	"En4 3"
						]
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						//"data": {"position": 0.375, "travel": 0.25, "dur": 60.0/1440, "alternate": true}
						"data": {"position": 0.625, "travel": -0.125, "dur": 0.04166666666667, "alternate": true} // for JSON
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.05}
					}
				,	{"command": "notes", 
						"data": [
							"Fn4 1"
						,	"Fn4 3"
						,	"Cn5 1"
						,	"Cn5 3"
						,	"An4 1"
						,	"An4 3"
						,	"An4 1"
						,	"An4 23"
						,	"An4 1"
						,	"An4 3"
						,	"Bn4 1"
						,	"Bn4 3"
						,	"Cn5 1"
						,	"Cn5 3"
						]
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.0625}
					}
				,	{"command": "notes", 
						"data": [
							"Bn4 1"
						,	"Bn4 3"
						,	"Gn4 1"
						,	"Gn4 3"
						,	"Dn4 1"
						,	"Dn4 3"
						,	"Gn4 1"
						,	"Gn4 23"
						,	"Gn4 1"
						,	"Gn4 3"
						,	"Gn4 1"
						,	"Gn4 3"
						,	"En4 1"
						,	"En4 3"
						]
					}

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						//"data": {"position": 0.375, "travel": 0.25, "dur": 60.0/1440, "alternate": true}
						"data": {"position": 0.375, "travel": 0.125, "dur": 0.04166666666667, "alternate": true} // for JSON
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.05}
					}
				,	{"command": "notes", 
						"data": [
							"Fn4 1"
						,	"Fn4 3"
						,	"Cn5 1"
						,	"Cn5 3"
						,	"An4 1"
						,	"An4 3"
						,	"An4 1"
						,	"An4 23"
						,	"An4 1"
						,	"An4 3"
						,	"An4 1"
						,	"An4 3"
						,	"Fn4 1"
						,	"Fn4 3"
						]
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.0625}
					}
				,	{"command": "notes", 
						"data": [
							"Gn4 1"
						,	"Gn4 3"
						,	"Dn5 1"
						,	"Dn5 3"
						,	"Bn4 1"
						,	"Bn4 3"
						,	"Gn4 1"
						,	"Gn4 23"
						,	"Gn4 1"
						,	"Gn4 3"
						,	"Gn4 1"
						,	"Gn4 3"
						,	"En4 1"
						,	"En4 3"
						]
					}

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						//"data": {"position": 0.375, "travel": 0.25, "dur": 60.0/1440, "alternate": true}
						"data": {"position": 0.625, "travel": -0.125, "dur": 0.04166666666667, "alternate": true} // for JSON
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.0625}
					}
				,	{"command": "notes", 
						"data": [
							"Fn4 1"
						,	"Fn4 3"
						,	"Cn5 1"
						,	"Cn5 3"
						,	"An4 1"
						,	"An4 3"
						,	"An4 1"
						,	"An4 23"
						,	"An4 1"
						,	"An4 3"
						,	"Bn4 1"
						,	"Bn4 3"
						,	"Cn5 1"
						,	"Cn5 3"
						]
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.075}
					}
				,	{"command": "notes", 
						"data": [
							"Bn4 1"
						,	"Bn4 3"
						,	"Gs4 1"
						,	"Gs4 3"
						,	"En4 1"
						,	"En4 3"
						,	"Gs4 1"
						,	"Gs4 23"
						]
					}
				,	{"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": "tempo", // change tempo mid-tune
						"data": {"bpm": 360} // 120 in 8th-triples
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 1.0, "dur": 0}
					}
				,	{"command": "notes", 
						"data": [
							"Gs4 1"
						,	"An4 1"
						,	"Bn4 1"
						]
					}

				// section C
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 0.75, "end": 1.0, "dur": 0}
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.0875}
					}

				,	{"command": "notes", 
						"data": [
							"Cn5 6"
						,	"Bn4 2"
						,	"Cn5 2"
						,	"Bn4 2"

						,	"An4 8"
						,	"An4 2"
						,	"Bn4 2"

						,	"En5 6"
						,	"Dn5 2"
						,	"En5 2"
						,	"Dn5 2"

						,	"Cn5 2"
						,	"An4 4"
						,	"Gn4 2"
						,	"An4 2"
						,	"Bn4 2"

						,	"Cn5 6"
						,	"Bn4 2"
						,	"Cn5 2"
						,	"Bn4 2"

						,	"An4 8"
						,	"An4 2"
						,	"Bn4 2"

						,	"En5 6"
						,	"Dn5 2"
						,	"En5 2"
						,	"Dn5 2"

						//,	"En5 2"
						//,	"Cn5 4"
						//,	"Dn5 2"
						//,	"Gn5 4"
						,	"En5 2"
						,	"Cn5 2"
						,	"En5 .68"
						,	"Fn5 .66"
						,	"Fs5 .66"

						,	"Gn5 1"
						,	"En5 2"
						,	"Gn5 2"
						,	"Bn5 1"
						]
					}

				]

		,	"tri":	// name of a channel on the chip	
				[
					// Ravi theme
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 0.5, "end": 1.0, "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.0875}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.375, "travel": 0.25, "dur": 2.0, "alternate":true} // 1 bar
					}
				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 240} // 120 in 8ths
					}
				,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": -2}
					}
				// intro
				,	{"command": "notes", 
						"data": [
							"Rst 8"
						,	"Rst 8"
						]
					}

				// section A
				,	{"command": "notes", 
						"data": [
							"An3 2"
						,	"Bn3 2"
						,	"Cn4 2"
						,	"An3 2"

						,	"Gn4 2"
						,	"Fn4 3.34"
						,	"En4 1.33"
						,	"Dn4 1.33"

						,	"Cn4 4"
						,	"Dn4 2"
						,	"En4 2"

						,	"Dn4 2"
						,	"Cn4 2"
						,	"Bn3 2"
						,	"Gn3 2"
						]
					}

				,	{"command": "notes", 
						"data": [
							"An3 2"
						,	"Bn3 2"
						,	"Cn4 2"
						,	"An3 2"

						,	"Gn4 2"
						,	"Fn4 3.34"
						,	"En4 1.33"
						,	"Dn4 1.33"

						,	"Fs4 8"

						,	"En4 2"
						,	"Bn3 2"
						,	"Gs3 2"
						,	"Bn3 2"
						]
					}
				
				// Section B
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 0.5, "end": 1.0, "dur": 0}
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.0625}
					}
				,	{"command": "notes", 
						"data": [
							"Dn4 2"
						,	"Cn4 2"
						,	"Fn4 2"
						,	"Dn4 2"
						]
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.075}
					}
				,	{"command": "notes", 
						"data": [
							"Bn3 1"
						,	"Gn3 2"
						,	"Dn3 1"
						,	"Dn4 1"
						,	"Dn3 3"
						]
					}

				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.0625}
					}
				,	{"command": "notes", 
						"data": [
							"Dn4 2"
						,	"Cn4 2"
						,	"Fn4 2"
						,	"Dn4 2"
						]
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.075}
					}
				,	{"command": "notes", 
						"data": [
							"Bn3 1"
						,	"An3 1"
						,	"Gn3 1"
						,	"Dn4 1"
						,	"Dn3 4"
						]
					}

				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.0625}
					}
				,	{"command": "notes", 
						"data": [
							"Dn4 2"
						,	"Cn4 2"
						,	"Fn4 2"
						,	"Dn4 2"
						]
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.075}
					}
				,	{"command": "notes", 
						"data": [
							"Bn3 1"
						,	"Gn3 2"
						,	"Dn3 1"
						,	"Dn4 1"
						,	"Dn3 3"
						]
					}

				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.0625}
					}
				,	{"command": "notes", 
						"data": [
							"Dn4 2"
						,	"Cn4 2"
						,	"Fn4 2"
						,	"Dn4 2"
						]
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.075}
					}
				,	{"command": "notes", 
						"data": [
							"En4 1"
						,	"Fn4 1"
						,	"En4 1"
						,	"Fn4 1"
						]
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.0875}
					}
				,	{"command": "notes", 
						"data": [
							"En4 1"
						,	"En3 1"
						,	"Fs3 1"
						,	"Gs3 1"
						]
					}

				// section C
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.1}
					}

				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.0, "dur": 1}
					}
				,	{"command": "notes", 
						"data": [
							"An3 2"
						,	"En4 2"
						,	"Gn3 2"
						,	"Dn4 1"
						,	"Gn3 1"

						,	"Fn3 2"
						,	"Bn3 1"
						,	"Cn4 1"
						,	"Dn4 1"
						,	"Cn4 1"
						,	"Dn4 2"
						]
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 0.25, "end": 1.0, "dur": 0}
					}
				,	{"command": "notes", 
						"data": [
							"En4 4"
						,	"Dn4 4"

						,	"Fn4 2"
						,	"Gn4 2"
						,	"Fn4 2"
						,	"En4 1"
						,	"Bn3 1"
						]
					}

				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.0, "dur": 1}
					}
				,	{"command": "notes", 
						"data": [
							"An3 2"
						,	"En4 2"
						,	"Gn3 2"
						,	"Dn4 1"
						,	"Gn3 1"

						,	"Fn3 2"
						,	"Bn3 1"
						,	"Cn4 1"
						,	"Dn4 1"
						,	"Cn4 1"
						,	"Dn4 2"
						]
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 0.25, "end": 1.0, "dur": 0}
					}
				,	{"command": "notes", 
						"data": [
							"En4 4"
						,	"Dn4 4"

						,	"Cn4 4"
						,	"Bn3 4"
						]
					}
				
				]

		,	"nz":	// name of a channel on the chip	
				[
					
				//,	{"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.0625}
					}
				,	{"command": "pan", 
						"data": {"position": 0.5}
					}
				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 1440} // 120 in 12ths
					}
				//,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
				//		"data": {"cents": 0}
				//	}

				// Intro
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.25, "dur": 0}
					}
				,	{"command": "notes", 
						"data": [
							"Cn6 4" //hat1
						,	"Cn6 8" //hat1
						,	"Cn6 8" //hat1
						,	"Cn6 4" //hat1
						,	"Cn6 8" //hat1
						,	"Cn6 8" //hat1
						,	"Cn6 8" //hat1

						,	"Cn6 4" //hat1
						,	"Cn6 8" //hat1
						,	"Cn6 8" //hat1
						,	"Cn6 4" //hat1
						,	"Cn6 8" //hat1
						,	"Cn6 8" //hat1
						,	"Cn6 8" //hat1
						]
					}

				// section A
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.0, "dur": 0.125}
					}
				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", 
						"data": [
							"Fn5 2" //snare
						,	"Fn5 2" //snare
						,	"Fn5 4" //snare
						,	"Cn6 4" //hat1
						,	"Fn5 4" //snare
						,	"Cn6 4" //hat1
						,	"Fn5 4" //snare
						,	"Gn1 8" //bd
						,	"Cn6 8" //hat1
						,	"Fn5 4" //snare
						,	"Fn5 4" //snare

						,	"Gn1 4" //bd
						,	"Fn5 2" //snare
						,	"Fn5 2" //snare
						,	"Cn6 4" //hat1
						,	"Fn5 4" //snare
						,	"Cn6 4" //hat1
						,	"Fn5 4" //snare
						,	"Gn1 8" //bd
						,	"Cn6 8" //hat1
						,	"Fn5 4" //snare
						,	"Fn5 4" //snare
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -1, "times": 3}
					}

				// section B
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.0, "dur": 0.125}
					}
				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", 
						"data": [
							"Gn1 12" //bd
						,	"Fn5 4" //snare
						,	"Fn5 4" //snare
						,	"Fn5 4" //snare
						,	"Fn5 8" //snare
						,	"Fn5 2" //snare
						,	"Fn5 2" //snare
						,	"Fn5 4" //snare
						,	"Fn5 4" //snare
						,	"Fn5 4" //snare

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

				// section C
				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.0, "dur": 0.375}
					}
				,	{"command": "notes", 
						"data": [
							"Cn2 12" //bd1
						,	"Cn6 12" //hat1
						,	"Cn2 12" //bd1
						,	"Cn6 12" //hat1

						,	"Cn2 12" //bd1
						,	"Cn6 12" //hat1
						]
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.0, "dur": 0.125}
					}
				,	{"command": "notes", 
						"data": [
							"Gn1 4" //bd
						,	"Fn5 2" //snare
						,	"Fn5 2" //snare
						,	"Fn5 4" //snare
						,	"Fn5 4" //snare
						,	"Fn5 4" //snare
						,	"Fn5 4" //snare
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -4, "times": 3}
					}				
				
				]
		
	}
};
