"use strict";

/* --------------------------------------------------- */
/* SkyDragon Story track 10                            */
/* A-minor Waltz in 4                                  */
/* (Raviene's theme)                                   */
/* (c) Sean Kelly, 2015                                */
/* --------------------------------------------------- */
DATA_CHIPTUNES["A-minor Waltz in 4"] = {
		"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": [
							"Fn3 1"
						,	"An3 1"
						,	"Dn4 1"
						,	"An3 1"
						,	"Fn4 1"
						,	"Dn4 1"
						,	"An4 1"
						,	"Fn4 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-8
				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}

				// bar 1/3/5/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 2/4/6/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"
						]
					}


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



				// 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"
						,	"Gs3 1"
						,	"Bn3 1"
						,	"Gs3 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}
					}

				]
		,	"tri":	// 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": [
							"Fn2 2"
						,	"Dn3 1"
						,	"An2 1"
						,	"Dn3 2"
						,	"Fn2 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"
						,	"En2 4"
						,	"En2 2"
						,	"En2 4"
						,	"En2 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	
				[
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 0.25, "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.075}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.5625}
					}
				,	{"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 4"
						,	"En4 1"
						,	"Dn4 1"

						,	"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 4"
						,	"En4 1"
						,	"Dn4 1"

						,	"Fn4 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.05}
					}
				,	{"command": "notes", 
						"data": [
							"Dn4 2"
						,	"Cn4 2"
						,	"Fn4 2"
						,	"Dn4 2"
						]
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.0625}
					}
				,	{"command": "notes", 
						"data": [
							"Bn3 1"
						,	"Gs3 2"
						,	"En3 1"
						,	"En4 1"
						,	"En3 3"
						]
					}

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

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

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

				// section C
				,	{"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.0, "dur": 1}
					}
				,	{"command": "notes", 
						"data": [
							"An3 2"
						,	"En4 2"
						,	"Gn3 2"
						,	"Dn4 1"
						,	"Gn3 1"

						,	"Fn3 2"
						,	"Bn3 1"
						,	"Cn4 1"
						,	"Dn4 1.5"
						,	"Cn4 1.5"
						,	"Dn4 1"
						]
					}
				,	{"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.5"
						,	"Cn4 1.5"
						,	"Dn4 1"
						]
					}
				,	{"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 4"
						,	"Gn4 4"
						]
					}
				
				]

		,	"sin":	// name of a channel on the chip	
				[
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1, "end": 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.075}
					}
				,	{"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": "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 4"
						,	"En4 1"
						,	"Dn4 1"

						,	"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 4"
						,	"En4 1"
						,	"Dn4 1"

						,	"Fn4 8"

						,	"En4 2"
						,	"Bn3 2"
						,	"Gs3 2"
						,	"Bn3 2"
						]
					}
				
				// Section B
				,	{"command": "notes", 
						"data": [
							"Rst 8"

						,	"Rst 8"

						,	"Rst 8"

						,	"Rst 8"

						,	"Rst 8"

						,	"Rst 8"

						,	"Rst 8"

						,	"Rst 8"
						]
					}

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

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

						,	"Fn3 2"
						,	"Bn3 1"
						,	"Cn4 1"
						,	"Dn4 1.5"
						,	"Cn4 1.5"
						,	"Dn4 1"
						]
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1, "end": 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.5"
						,	"Cn4 1.5"
						,	"Dn4 1"
						]
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1, "end": 0, "dur": 0}
					}
				,	{"command": "notes", 
						"data": [
							"En4 4"
						,	"Dn4 4"

						,	"Fn4 4"
						,	"Gn4 3.75"
						]
					}
				
				]
		,	"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.4375}
					}
				,	{"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.0, "dur": 0.125}
					}
				,	{"command": "notes", 
						"data": [
							"Cn6 8" //hat1
						,	"Rst 16"
						,	"Rst 24"

						,	"Cn6 8" //hat1
						,	"Rst 16"
						,	"Rst 24"
						]
					}

				// 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": [
							"Cn2 12" //bd1
						,	"Cn2 12" //bd1
						,	"Cn6 8" //hat1
						,	"Cn2 12" //bd1
						,	"Cn2 4" //bd1

						,	"Cn2 8" //bd1
						,	"Cn2 8" //bd1
						,	"Cn2 8" //bd1
						,	"Cn6 8" //hat1
						,	"Cn2 8" //bd1
						,	"Rst 8"
						]
					}
				,	{"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.25}
					}
				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "notes", 
						"data": [
							"Fn5 8" //hat2
						,	"Gn1 8" //bd2
						,	"Gn1 8" //bd2
						,	"Fn5 8" //hat2
						,	"Gn1 8" //bd2
						,	"Gn1 8" //bd2

						,	"Gn1 12" //bd2
						,	"Gn1 6" //bd2
						,	"Gn1 6" //bd2
						,	"Fn5 12" //hat2
						,	"Gn1 6" //bd2
						,	"Gn1 6" //bd2
						]
					}
				,	{"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": "notes", 
						"data": [
							"Rst 12"
						,	"Fn5 12" //hat2
						,	"Gn1 8" //bd2
						,	"Gn1 8" //bd2
						,	"Gn1 8" //bd2

						,	"Gn1 12" //bd2
						,	"Fn5 12" //hat2
						,	"Gn1 4" //bd2
						,	"Rst 4"
						,	"Gn1 4" //bd2
						,	"Fn5 12" //hat2
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -1, "times": 3}
					}				
				
				]
	}
};
