"use strict";

/* --------------------------------------------------- */
/* SkyDragon Story track 02                            */
/* It Is a Good Day (to be Alive)                      */
/* ("Meli's" theme)                                    */
/* (c) Sean Kelly, 2013                                */
/* --------------------------------------------------- */
DATA_CHIPTUNES["It Is a Good Day"] = {
		"chip": "oneofeach"
	,	"bpm": 330 // beats per minute; 155 quarters in 8ths
	,	"priority": 1 // baseline nonzero for BGM
	,	"songdata" : {
			"tri":	// 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.25, "dur": 1}
					}
				,	{"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.075}
					}
				,	{"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": 120}
				//	}
				//,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
				//		"data": {"cents": 0}
				//	}

				// What good is a time signature if I can't change it every bar?

				// IntroOutro
				// 5/4 -> 6/4
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.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": [
							"Fn2 1.2"
						,	"Cn3 2"
						,	"Cn3 2"
						,	"Cn3 0.8"
						,	"Gn2 2"
						,	"Cn3 2"

						,	"An2 1.2"
						,	"Cn3 2"
						,	"Cn3 2"
						,	"Cn3 0.8"
						,	"Gn2 2"
						,	"An2 2"
						,	"Bn2 2"
						]
					}

				,	{"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}
					}
				,	{"command": "sweep", // set linear frequency sweep applied to every note (start and end multiply base note frequency)
						"data": {"start": 1.0, "end": 0.25, "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": [
							"En3 2"
						,	"En3 2"
						]
					}

				,	{"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.25, "dur": 1}
					}
				,	{"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}
					}

				// Section A
				// 7/4+6/4 7/4+5/4
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.0875}
					}

				,	{"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.2"
						,	"Cn3 4.8"
						,	"Bn2 6"
						,	"Cn3 2"
						,	"An2 6"
						,	"Gn2 4"
						,	"Gn2 .68"
						,	"An2 .66"
						,	"Bn2 .66"

						,	"Cn3 6"
						,	"Bn2 6"
						,	"Cn3 1.2"
						,	"Bn2 .8"
						,	"An2 6"
						,	"Gn2 2"
						,	"Gn2 .68"
						,	"An2 .66"
						,	"Bn2 .66"
						]
					}

				// Section B
				// 11/4, could be thought of as 5/4+6/4

				,	{"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": [
							"Fn2 6"
						,	"En2 4"
						,	"Fn2 8"
						,	"Gn2 2"
						,	"Gn2 2"

						,	"Fn2 6"
						,	"En2 4"
						,	"Fn2 8"
						,	"Gn2 2"
						,	"Dn2 2"
						]
					}

				// Section C
				// 3/4, with occasional 2/4

				,	{"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.25, "dur": 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": [
							"Cn3 1.2" // 3/4
						,	"En3 2"
						,	"En3 2.8"

						,	"Bn2 1.2"
						,	"En3 2"
						,	"En3 2.8"

						,	"An2 1.2"
						,	"En3 2"
						,	"En3 2.8"

						,	"Gn2 2"// 2/4 ,	"Gn2 1.2"
						,	"En3 2"//,	"En3 2"
						//,	"En3 2.8"

						,	"Fn2 1.2" // 3/4
						,	"Cn3 2"
						,	"Cn3 2.8"

						,	"En2 1.2"
						,	"Cn3 2"
						,	"Cn3 2.8"

						,	"Dn2 1.2"
						,	"Cn3 2"
						,	"Cn3 2.8"

						,	"Dn2 1.2"
						,	"Bn2 2"
						,	"Bn2 2.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": [
							"Cn3 1.2" // 3/4
						,	"En3 2"
						,	"En3 2.8"

						,	"Bn2 1.2"
						,	"En3 2"
						,	"En3 2.8"

						,	"An2 1.2"
						,	"En3 2"
						,	"En3 2.8"

						,	"Gn2 2"// 2/4 ,	"Gn2 1.2"
						,	"En3 2"//,	"En3 2"
						//,	"En3 2.8"

						,	"Fn2 1.2" // 3/4
						,	"Cn3 2"
						,	"Cn3 2.8"

						,	"En2 1.2"
						,	"Cn3 2"
						,	"Cn3 2.8"

						,	"Dn2 1.2"
						,	"Cn3 2"
						,	"Cn3 2.8"

						,	"Dn2 1.2"
						,	"Bn2 2"
						,	"Bn2 2.8"
						]
					}

				// IntroOutro
				// 5/4 -> 6/4
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.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": [
							"Cn3 1.2"
						,	"En3 2"
						,	"En3 2"
						,	"En3 0.8"
						,	"Bn2 2"
						,	"Dn3 2"

						,	"An2 1.2"
						,	"En3 2"
						,	"En3 2"
						,	"En3 0.8"
						,	"Gn2 2"
						,	"Bn2 2"


						,	"Cn3 1.2"
						,	"En3 2"
						,	"En3 2"
						,	"En3 0.8"
						,	"Bn2 2"
						,	"Dn3 2"

						,	"An2 1.2"
						,	"En3 2"
						,	"En3 2"
						,	"En3 0.8"
						,	"Gn2 2"
						,	"Bn2 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}
				//	}
				]
		,	"st":	// 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": "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": 120}
				//	}
				,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": 5}
					}

				// IntroOutro
				// 5/4 -> 6/4
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.05}
					}
				,	{"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.25, "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": [
							"Cn6 1.2"
						,	"Cn6 .8"
						,	"Rst 1.2"
						,	"Cn6 2"
						,	"Cn6 .8"
						,	"Cn6 1.2"
						,	"Cn6 .8"
						,	"Gn5 1.2"
						,	"Gn5 .8"
						
						,	"Cn6 1.2"
						,	"Cn6 .8"
						,	"Rst 1.2"
						,	"Cn6 2"
						,	"Cn6 .8"
						,	"Bn5 1.2"
						,	"Bn5 .8"
						,	"Cn6 1.2"
						,	"Cn6 .8"
						,	"Dn6 1.2"
						,	"Dn6 .8"

						//,	"Rst .6"
						//,	"Gn6 .6"
						//,	"Gn6 .8"
						//,	"Gn6 2"
						,	"Rst 4"
						]
					}

				// Section A
				// 7/4+6/4 7/4+5/4

				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.0375}
					}

				,	{"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.25, "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": [
							"En6 1.2"
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						,	"En6 1.2"
						,	"En6 .8"
						,	"Gn6 1.2"
						,	"Gn6 .8"
						,	"Fn6 1.2"
						,	"Fn6 .8"
						,	"Rst 1.2"
						,	"Gn6 .8"

						,	"En6 1.2"
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						,	"Dn6 1.2"
						,	"Dn6 .8"
						,	"Dn6 1.2"
						,	"Dn6 .8"
						,	"Dn6 1.2"
						,	"Dn6 .8"

						,	"En6 1.2"
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						,	"En6 1.2"
						,	"En6 .8"
						,	"Gn6 1.2"
						,	"Gn6 .8"
						,	"Fn6 1.2"
						,	"Fn6 .8"
						,	"En6 1.2"
						,	"Dn6 .8"

						,	"En6 1.2"
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						,	"Dn6 1.2"
						,	"Dn6 .8"
						,	"Dn6 1.2"
						,	"Dn6 .8"
						]
					}

				// Section B
				// 11/4, could be thought of as 5/4+6/4

				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.05}
					}

				,	{"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 .68"
						,	"An4 .66"
						,	"Cn5 .66"
						,	"Cn5 .68"
						,	"An4 .66"
						,	"Fn4 .66"
						,	"Fn4 .68"
						,	"An4 .66"
						,	"Cn5 .66"

						,	"Dn5 .68"
						,	"Bn4 .66"
						,	"Gn4 .66"
						,	"Dn5 .68"
						,	"Bn4 .66"
						,	"Gn4 .66"

						,	"Fn4 .68"
						,	"An4 .66"
						,	"Cn5 .66"
						,	"Cn5 .68"
						,	"An4 .66"
						,	"Fn4 .66"
						,	"Fn4 .68"
						,	"An4 .66"
						,	"Cn5 .66"
						,	"Cn5 .68"
						,	"An4 .66"
						,	"Fn4 .66"

						,	"Bn4 .68"
						,	"Gn4 .66"
						,	"Dn4 .66"
						,	"Bn4 .68"
						,	"Gn4 .66"
						,	"Dn4 .66"


						,	"Fn4 .68"
						,	"An4 .66"
						,	"Cn5 .66"
						,	"Cn5 .68"
						,	"An4 .66"
						,	"Fn4 .66"
						,	"Fn4 .68"
						,	"An4 .66"
						,	"Cn5 .66"

						,	"Dn5 .68"
						,	"Bn4 .66"
						,	"Gn4 .66"
						,	"Dn5 .68"
						,	"Bn4 .66"
						,	"Gn4 .66"

						,	"Fn4 .68"
						,	"An4 .66"
						,	"Cn5 .66"
						,	"Cn5 .68"
						,	"An4 .66"
						,	"Fn4 .66"
						,	"Fn4 .68"
						,	"An4 .66"
						,	"Cn5 .66"
						,	"Cn5 .68"
						,	"An4 .66"
						,	"Fn4 .66"

						,	"Bn4 .68"
						,	"Gn4 .66"
						,	"Dn4 .66"
						,	"Dn4 .68"
						,	"Gn4 .66"
						,	"Bn4 .66"
						]
					}

				// Section C
				// 3/4 with occasional 2/4

				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"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": [
							"En6 1.2" // 3/4
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						,	"En6 1.2"
						,	"En6 .8"
						,	"En6 1.2"
						,	"En6 .8"
						,	"En6 1.2"
						,	"En6 .8"

						,	"En6 1.2"
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						,	"En6 1.2" // 2/4
						,	"En6 .8"
						,	"En6 1.2"
						,	"En6 .8"
						//,	"En6 1.2"
						//,	"En6 .8"

						,	"Cn6 1.2" // 3/4
						,	"Cn6 .8"
						,	"Rst 1.2"
						,	"Cn6 2"
						,	"Cn6 .8"
						,	"Cn6 1.2"
						,	"Cn6 .8"
						,	"Cn6 1.2"
						,	"Cn6 .8"
						,	"Cn6 1.2"
						,	"Cn6 .8"
						,	"En6 1.2"
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						,	"Dn6 1.2"
						,	"Dn6 .8"
						,	"Dn6 1.2"
						,	"Dn6 .8"
						,	"Dn6 1.2"
						,	"Dn6 .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": [
							"En6 1.2" // 3/4
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						,	"En6 1.2"
						,	"En6 .8"
						,	"En6 1.2"
						,	"En6 .8"
						,	"En6 1.2"
						,	"En6 .8"

						,	"En6 1.2"
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						,	"En6 1.2" // 2/4
						,	"En6 .8"
						,	"En6 1.2"
						,	"En6 .8"
						//,	"En6 1.2"
						//,	"En6 .8"

						,	"Cn6 1.2"
						,	"Cn6 .8"
						,	"Rst 1.2"
						,	"Cn6 2"
						,	"Cn6 .8"
						,	"Cn6 1.2"
						,	"Cn6 .8"
						,	"Cn6 1.2"
						,	"Cn6 .8"
						,	"Cn6 1.2"
						,	"Cn6 .8"
						,	"En6 1.2"
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						]
					}
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.05}
					}
				,	{"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.25, "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": [
							"Dn6 .68"
						,	"Bn5 .66"
						,	"Gn5 .66"
						,	"Dn6 .68"
						,	"Bn5 .66"
						,	"Gn5 .66"
						,	"Dn6 .68"
						,	"Bn5 .66"
						,	"Gn5 .66"
						]
					}

				// IntroOutro
				// 5/4 -> 6/4
				,	{"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": [
							"En6 1.2"
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						,	"En6 1.2"
						,	"En6 .8"
						,	"Fn6 1.2"
						,	"Fn6 .8"
						
						,	"En6 1.2"
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						,	"Gn6 1.2"
						,	"Fn6 .8"
						,	"En6 1.2"
						,	"Dn6 .8"


						,	"En6 1.2"
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						,	"En6 1.2"
						,	"En6 .8"
						,	"Fn6 1.2"
						,	"Fn6 .8"
						
						,	"En6 1.2"
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						,	"Gn6 1.2"
						,	"Fn6 .8"
						,	"En6 1.2"
						,	"Dn6 .8"
						]
					}
				
				]
		,	"sq":	// 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.625, "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; 0.1 is a sane "loud" level
						"data": {"level": 0.0675}
					}
				,	{"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": 120}
				//	}
				//,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
				//		"data": {"cents": 0}
				//	}

				// IntroOutro
				// 5/4->6/4
				,	{"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": [
							"Rst 10"
						,	"Rst 12"

						,	"Rst 4"
						]
					}

				// Section A
				// 7/4+6/4 7/4+5/4

				,	{"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": [
							"Rst 1.2"
						,	"En4 .8"
						,	"Gn4 1.2"
						,	"Cn5 .8"
						,	"En5 1.2"
						,	"Cn5 .8"
						,	"Dn5 1.2"
						,	"Bn4 .8"
						,	"Gn4 1.2"
						,	"Rst .8"
						,	"Dn5 1.2"
						,	"Rst .8"
						,	"Rst 2"

						,	"Rst 1.2"
						,	"Cn4 .8"
						,	"Fn4 1.2"
						,	"An4 .8"
						,	"Cn5 1.2"
						,	"An4 .8"
						,	"Bn4 1.2"
						,	"Gn4 .8"
						,	"Rst 4"


						,	"Rst 1.2"
						,	"En4 .8"
						,	"Gn4 1.2"
						,	"Cn5 .8"
						,	"En5 1.2"
						,	"Cn5 .8"
						,	"Dn5 1.2"
						,	"Bn4 .8"
						,	"Gn4 1.2"
						,	"Rst .8"
						,	"Dn5 1.2"
						,	"Rst .8"
						,	"En5 1.2"
						,	"Rst .8"

						,	"Cn5 1.2"
						,	"Cn4 .8"
						,	"Fn4 1.2"
						,	"An4 .8"
						,	"Cn5 1.2"
						,	"An4 .8"
						,	"Bn4 1.2"
						,	"Gn4 .8"
						,	"Rst 2"
						]
					}

				// Section B
				// 11/4, could be thought of as 5/4+6/4

				,	{"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.2"
						,	"Cn5 2"
						,	"An4 2"
						,	"Fn4 .8"
						,	"Gn4 1.2"
						,	"Dn5 .8"
						,	"Bn4 1.2"
						,	"Gn4 .8"

						,	"Fn4 1.2"
						,	"Cn5 2"
						,	"An4 2.8"
						,	"An4 .68"
						,	"Bn4 .66"
						,	"Cn5 .66"
						,	"Bn4 1.2"
						,	"Gn4 .8"
						,	"Dn4 1.2"
						,	"Gn4 .8"

						,	"Fn4 1.2"
						,	"Cn5 2"
						,	"An4 2"
						,	"Fn4 .8"
						,	"Gn4 1.2"
						,	"Dn5 .8"
						,	"Bn4 1.2"
						,	"Gn4 .8"

						,	"Fn4 1.2"
						,	"Cn5 2"
						,	"An4 2.8"
						,	"An4 .68"
						,	"Bn4 .66"
						,	"Cn5 .66"
						,	"Bn4 1.2"
						,	"Gn4 .8"
						,	"An4 1.2"
						,	"Bn4 .8"
						]
					}

				// Section C
				// 3/4, with occasional 2/4

				,	{"command": "env", // set linear ramp envelope applied to every note; dur is measured in seconds, 0 means length of current note
						"data": {"start": 0.75, "end": 1.0, "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": [
							"Cn5 6" // 3/4

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

						,	"An4 6" //,	"An4 8"

						,	"An4 2" // 2/4
						,	"Bn4 2"

						,	"En5 6" // 3/4

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

						,	"En5 2"
						,	"Cn5 4"

						,	"Bn4 2"
						,	"Cn5 2"
						,	"Dn5 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 6" // 3/4

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

						,	"An4 6" //,	"An4 8"

						,	"An4 2" // 2/4
						,	"Bn4 2"

						,	"En5 6" // 3/4

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

						//,	"En5 2"
						//,	"Cn5 4"

						//,	"Bn4 2"
						//,	"Gn4 4"

						,	"En5 2"
						,	"Cn5 2"
						,	"En5 0.66"
						,	"Fn5 0.66"
						,	"Fs5 0.68"

						,	"Gn5 1"
						,	"Dn5 2"
						,	"Bn4 2"
						,	"Dn5 1"
						]
					}

				// IntroOutro
				// 5/4->6/4
				,	{"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 6"
						,	"Rst 14"


						,	"Rst 20"
						]
					}

					
				]
		,	"sin":	// 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": "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": 120}
				//	}
				,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": 5}
					}

				// IntroOutro
				// 5/4->6/4
				,	{"command": "env", // set linear ramp envelope applied to every note; dur is measured in seconds, 0 means length of current note
						"data": {"start": 0.75, "end": 1.0, "dur": 0}
					}
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.075}
					}
				,	{"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 6"
						,	"Gn4 4"
						,	"An4 6"
						,	"Bn4 6"

						//,	"Gn4 4"
						,	"Rst 4"
						]
					}

				// Section A
				// 7/4+6/4 7/4+5/4
				,	{"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.25, "dur": 0}
					}

				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.02}
					}

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.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": [
							"Rst 0.25" // de-sync the echo

						,	"En6 1.2"
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						,	"En6 1.2"
						,	"En6 .8"
						,	"Gn6 1.2"
						,	"Gn6 .8"
						,	"Fn6 1.2"
						,	"Fn6 .8"
						,	"Rst 1.2"
						,	"Gn6 .8"
						]
					}

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.3}
					}

				,	{"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": [
							"En6 1.2"
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						,	"Dn6 1.2"
						,	"Dn6 .8"
						,	"Dn6 1.2"
						,	"Dn6 .8"
						,	"Dn6 1.2"
						,	"Dn6 .8"
						]
					}

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.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": [
							"En6 1.2"
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						,	"En6 1.2"
						,	"En6 .8"
						,	"Gn6 1.2"
						,	"Gn6 .8"
						,	"Fn6 1.2"
						,	"Fn6 .8"
						,	"En6 1.2"
						,	"Dn6 .8"
						]
					}

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.3}
					}

				,	{"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": [
							"En6 1.2"
						,	"En6 .8"
						,	"Rst 1.2"
						,	"En6 2"
						,	"En6 .8"
						,	"Dn6 1.2"
						,	"Dn6 .8"
						,	"Dn6 1.2"
						,	"Dn6 .8"
						]
					}

				// Section B
				// 11/4, could be thought of as 5/4+6/4

				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.0375}
					}

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.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": [
							"Fn4 .68"
						,	"An4 .66"
						,	"Cn5 .66"
						,	"Cn5 .68"
						,	"An4 .66"
						,	"Fn4 .66"
						,	"Fn4 .68"
						,	"An4 .66"
						,	"Cn5 .66"
						]
					}

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.3}
					}
				,	{"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 .68"
						,	"Bn4 .66"
						,	"Gn4 .66"
						]
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.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": [
							"Dn5 .68"
						,	"Bn4 .66"
						,	"Gn4 .66"
						]
					}

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.3}
					}
				,	{"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 .68"
						,	"An4 .66"
						,	"Cn5 .66"
						,	"Cn5 .68"
						,	"An4 .66"
						,	"Fn4 .66"
						,	"Fn4 .68"
						,	"An4 .66"
						,	"Cn5 .66"
						,	"Cn5 .68"
						,	"An4 .66"
						,	"Fn4 .66"
						]
					}

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.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": [
							"Bn4 .68"
						,	"Gn4 .66"
						,	"Dn4 .66"
						]
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.3}
					}
				,	{"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 .68"
						,	"Gn4 .66"
						,	"Dn4 .66"
						]
					}


				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.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": [
							"Fn4 .68"
						,	"An4 .66"
						,	"Cn5 .66"
						,	"Cn5 .68"
						,	"An4 .66"
						,	"Fn4 .66"
						,	"Fn4 .68"
						,	"An4 .66"
						,	"Cn5 .66"
						]
					}

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.3}
					}
				,	{"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 .68"
						,	"Bn4 .66"
						,	"Gn4 .66"
						]
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.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": [
							"Dn5 .68"
						,	"Bn4 .66"
						,	"Gn4 .66"
						]
					}

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.3}
					}
				,	{"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 .68"
						,	"An4 .66"
						,	"Cn5 .66"
						,	"Cn5 .68"
						,	"An4 .66"
						,	"Fn4 .66"
						,	"Fn4 .68"
						,	"An4 .66"
						,	"Cn5 .66"
						,	"Cn5 .68"
						,	"An4 .66"
						,	"Fn4 .66"
						]
					}

				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.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": [
							"Bn4 .68"
						,	"Gn4 .66"
						,	"Dn4 .66"
						]
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.3}
					}
				,	{"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": [
							"Dn4 .68"
						,	"Gn4 .66"
						,	"Bn4 .41" // -.25 to re-sync
						]
					}

				// Section C
				// 3/4, with occasional 2/4

				,	{"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; dur is measured in seconds, 0 means length of current note
						"data": {"start": 0.75, "end": 1.0, "dur": 0}
					}
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.05}
					}

				,	{"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": [
							"Rst 22" // "Rst 24"

						,	"Cn5 6"

						,	"Bn4 6"

						,	"Cn5 6"

						,	"Gn4 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": [
							"En4 6" // 3/4

						,	"Bn3 6"

						,	"Cn4 6"

						,	"Gn3 4" // 2/4 ,	"Gn3 6"

						,	"Cn5 6" // 3/4

						,	"Bn4 6"

						,	"Cn5 6"

						//,	"Gn4 2"
						//,	"Dn4 4"
						,	"Bn4 2"
						,	"Gn4 4"
						]
					}

				// IntroOutro
				// 5/4->6/4
				,	{"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 6"
						,	"Bn4 4"
						,	"An4 6"
						,	"Gn4 4"


						,	"Cn5 6"
						,	"Bn4 4"
						,	"An4 6"
						,	"Gn4 4"
						]
					}
					
				]
		}
	};

