"use strict";

/* --------------------------------------------------- */
/* SkyDragon Story track 07                            */
/* Awakening                                           */
/* (bay theme)                                         */
/* (c) Sean Kelly, 2014                                */
/* --------------------------------------------------- */
DATA_CHIPTUNES["Awakening"] = {
		"chip": "oneofeach"
	,	"bpm": 360 // beats per minute (180 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.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; 0.1 is a sane "loud" level
						"data": {"level": 0.04}
					}
				,	{"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": -2}
					}

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

				// intro

				,	{"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 2"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 2"
						,	"Fs4 1"
						,	"Fs4 1"
						,	"Fs4 1"

						,	"Rst 2"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 2"
						,	"Fs4 1"
						,	"Fs4 1"
						,	"Fs4 1"

						,	"Rst 2"
						,	"Gs4 3"
						,	"Gs4 3"
						,	"Gs4 3"
						,	"Gs4 2"
						,	"Gs4 1"
						,	"Gs4 1"
						,	"Gs4 1"

						,	"Rst 2"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 2"
						,	"Fs4 1"
						,	"Fs4 1"
						,	"Fs4 1"
						]
					}

				// block 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": [
							"Rst 2"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 4"

						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 4"

						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 4"

						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 2"						
						]
					}

				// block 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": [
							"Rst 2"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 4"

						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 4"

						,	"Gs4 3"
						,	"Gs4 3"
						,	"Gs4 3"
						,	"Gs4 3"
						,	"Gs4 4"

						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Gs4 3"
						,	"Fs4 2"						
						]
					}

				// block 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": [
							"Rst 2"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 4"

						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 4"

						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 4"

						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 2"						
						]
					}

				// block 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 2"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 4"

						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 3"
						,	"Fs4 4"

						,	"Gs4 3"
						,	"Gs4 3"
						,	"Gs4 3"
						,	"Gs4 3"
						,	"Gs4 4"

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

				// B section

				,	{"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 2"
						,	"Bn4 3"
						,	"Bn4 3"
						,	"Bn4 3"
						,	"Bn4 3"
						,	"Bn4 4"

						,	"As4 3"
						,	"As4 3"
						,	"As4 3"
						,	"As4 3"
						,	"As4 4"

						,	"Gs4 3"
						,	"Gs4 3"
						,	"Gs4 3"
						,	"Gs4 3"
						,	"Gs4 4"

						,	"As4 3"
						,	"As4 3"
						,	"As4 3"
						,	"As4 3"
						,	"As4 2"	


						,	"Rst 2"
						,	"Bn4 3"
						,	"Bn4 3"
						,	"Bn4 3"
						,	"Bn4 3"
						,	"Bn4 4"

						,	"As4 3"
						,	"As4 3"
						,	"As4 3"
						,	"As4 3"
						,	"As4 4"

						,	"Gs4 3"
						,	"Gs4 3"
						,	"Gs4 3"
						,	"Gs4 3"
						,	"Gs4 4"

						,	"Gs4 3"
						,	"Gs4 3"
						,	"Fs4 3"
						,	"Fn4 3"
						,	"Ds4 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}
				//	}
				]
		,	"sin":	// name of a channel on the chip	
				[
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.5, "dur": 0.0}
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 1.0, "dur": 0.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.175}
					}
				,	{"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": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": 3}
					}

				// Intro / all

				,	{"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": [
//							"Cs2 2"
//						,	"Cs3 2"
//						,	"Cs2 2"
//						,	"Cs3 2"
//						,	"Cs2 2"
//						,	"Cs3 2"
//						,	"Cs2 2"
//						,	"Cs3 2"

//						,	"Ds2 2"
//						,	"Ds3 2"
//						,	"Ds2 2"
//						,	"Ds3 2"
//						,	"Ds2 2"
//						,	"Ds3 2"
//						,	"Ds2 2"
//						,	"Ds3 2"

//						,	"Fn2 2"
//						,	"Fn3 2"
//						,	"Fn2 2"
//						,	"Fn3 2"
//						,	"Fn2 2"
//						,	"Fn3 2"
//						,	"Fn2 2"
//						,	"Fn3 2"

//						,	"Ds2 2"
//						,	"Ds3 2"
//						,	"Ds2 2"
//						,	"Ds3 2"
//						,	"Ds2 2"
//						,	"Ds3 2"
//						,	"Ds2 2"
//						,	"Ds3 2"


							"Fs2 2"
						,	"Cs2 1"
						,	"Cs3 2"
						,	"Cs2 1"
						,	"Cs3 1"
						,	"Cs2 1"
						,	"Fs2 2"
						,	"Cs2 1"
						,	"Cs3 2"
						,	"Cs2 1"
						,	"Cs3 1"
						,	"Cs2 1"

						,	"Fs2 2"
						,	"Ds2 1"
						,	"Ds3 2"
						,	"Ds2 1"
						,	"Ds3 1"
						,	"Ds2 1"
						,	"Fs2 2"
						,	"Ds2 1"
						,	"Ds3 2"
						,	"Ds2 1"
						,	"Ds3 1"
						,	"Ds2 1"

						,	"Gs2 2"
						,	"Fn2 1"
						,	"Fn3 2"
						,	"Fn2 1"
						,	"Fn3 1"
						,	"Fn2 1"
						,	"Gs2 2"
						,	"Fn2 1"
						,	"Fn3 2"
						,	"Fn2 1"
						,	"Fn3 1"
						,	"Fn2 1"

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

				// B section

				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.2}
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.0, "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": [
							"Ds5 1"
						,	"Ds5 2"
						,	"Bn4 1"
						,	"Bn4 2"
						,	"Fs4 1"
						,	"Fs4 2"
						,	"Ds5 1"
						,	"Ds5 2"
						,	"Cs5 2"
						,	"Bn4 2"

						,	"Cs5 3"
						,	"As4 3"
						,	"Fs4 3"
						,	"Cs4 1"
						]
					}
				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 540} // 180 in 8-tuples
					}
				,	{"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": [
							"Cs4 1"
						,	"Cs4 1"
						,	"Cs4 1"
						,	"Cs4 1"
						,	"Cs4 1"
						,	"Cs4 1"
						,	"Cs4 1"
						,	"Cs4 1"
						,	"Cs4 1"
						]
					}
				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 360} // 180 in 8ths
					}

				,	{"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 2"
						,	"Cs4 1"
						,	"Ds4 1"
						,	"Fn4 1"
						,	"Fs4 2"
						,	"Gs4 2"
						,	"As4 2"
						,	"Bn4 2"
						,	"Cs5 1"
						,	"Cs5 1"
						,	"Cs5 1"

						,	"As4 3"
						,	"Fs4 3"
						]
					}
				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 540} // 180 in 8-tuples
					}
				,	{"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": [
							"Cs5 1"
						,	"Cs5 1"
						,	"Cs5 1"
						,	"Cs5 1"
						,	"Cs5 1"
						,	"Cs5 1"
						,	"Cs5 1"
						,	"Cs5 1"
						,	"Cs5 1"
						,	"Cs5 1"
						,	"Cs5 1"
						,	"Cs5 1"
						,	"Cs5 1"
						,	"Cs5 1"
						,	"Cs5 1"
						]
					}
				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 360} // 180 in 8ths
					}

				,	{"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": [
							"Ds5 1"
						,	"Ds5 2"
						,	"Bn4 1"
						,	"Bn4 2"
						,	"Fs5 1"
						,	"Fs5 2"
						,	"Ds5 1"
						,	"Ds5 2"
						,	"Bn4 2"
						,	"Ds5 2"

						,	"Cs5 2"
						,	"Cs5 2"
						,	"Bn4 2"
						,	"Cs5 1"
						,	"As4 1"
						]
					}
				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 540} // 180 in 8-tuples
					}
				,	{"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": [
							"As4 1"
						,	"As4 1"
						,	"As4 1"
						,	"As4 1"
						,	"As4 1"
						,	"As4 1"
						,	"As4 1"
						,	"As4 1"
						,	"As4 1"
						,	"As4 1"
						,	"As4 1"
						,	"As4 1"
						]
					}
				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 360} // 180 in 8ths
					}

				,	{"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 2"
						,	"Gs4 1"
						,	"Gs4 2"
						,	"As4 1"
						,	"As4 2"
						,	"Bn4 1"
						,	"Bn4 2"
						,	"As4 1"
						,	"Gs4 2"
						,	"Fs4 2"

						,	"Fn4 2"
						,	"Fs4 2"
						,	"Fn4 2"
						,	"Ds4 1"
						,	"Cs4 1"
						]
					}
				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 540} // 180 in 8-tuples
					}
				,	{"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": [
							"Cs4 1"
						,	"Cs4 1"
						,	"Cs4 1"
						,	"Cs4 1"
						,	"Cs4 1"
						,	"Cs4 1"
						,	"Cs4 1"
						,	"Cs4 1"
						,	"Cs4 1"
						,	"Cs4 1"
						,	"Cs4 1"
						,	"Cs4 1"
						]
					}
				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 360} // 180 in 8ths
					}

				]
		,	"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.04}
					}
				,	{"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": 2}
					}

				// intro/all

				,	{"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": [
							"Rst 2"
						,	"As4 3"
						,	"As4 3"
						,	"As4 3"
						,	"As4 3"
						,	"As4 4"

						,	"Bn4 3"
						,	"Bn4 3"
						,	"Bn4 3"
						,	"Bn4 3"
						,	"Bn4 4"

						,	"Cs5 3"
						,	"Cs5 3"
						,	"Cs5 3"
						,	"Cs5 3"
						,	"Cs5 4"

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

				// B section

				,	{"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 2"
						,	"Cs5 3"
						,	"Cs5 3"
						,	"Cs5 3"
						,	"Cs5 3"
						,	"Cs5 4"

						,	"Cs5 3"
						,	"Cs5 3"
						,	"Cs5 3"
						,	"Cs5 3"
						,	"Cs5 4"

						,	"Fn5 3"
						,	"Fn5 3"
						,	"Fn5 3"
						,	"Ds5 3"
						,	"Fn5 4"

						,	"Fs5 3"
						,	"Fs5 3"
						,	"Fs5 3"
						,	"Fn5 3"
						,	"Ds5 2"


						,	"Rst 2"
						,	"Cs5 3"
						,	"Cs5 3"
						,	"Cs5 3"
						,	"Cs5 3"
						,	"Cs5 4"

						,	"Cs5 3"
						,	"Cs5 3"
						,	"Cs5 3"
						,	"Cs5 3"
						,	"Cs5 4"

						,	"Fn5 3"
						,	"Fn5 3"
						,	"Fn5 3"
						,	"Ds5 3"
						,	"Fn5 4"

						,	"Fn4 3"
						,	"Fn4 3"
						,	"As4 3"
						,	"Gs4 3"
						,	"Fs4 2"
						]
					}
				]
		,	"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.8, "dur": 0.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.175}
					}
				,	{"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": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": 0}
					}

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

				,	{"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 8"
						,	"Rst 8"
						,	"Rst 8"
						,	"Rst 8"
						,	"Rst 8"
						,	"Rst 8"
						,	"Rst 8"

						,	"Rst 2"
						,	"Cs4 2"
						,	"Ds4 2"
						,	"Fs4 2"
						]
					}

				// block 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": [
							"Rst 2"
						,	"As4 2"
						,	"Gs4 1"
						,	"As4 2"
						,	"Rst 1"

						,	"As4 2"
						,	"Gs4 1"
						,	"As4 2"
						,	"Rst 1"
						,	"As4 2"

						,	"Bn4 3"
						,	"As4 3"
						,	"Fs4 4"

						,	"Fs4 2"
						,	"Gs4 2"
						,	"As4 2"

						,	"Bn4 3"
						,	"Cs5 3"
						]
					}
				,	{"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": 1.2, "dur": 0.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": [
							"As4 9"
						]
					}
				,	{"command": "env", // set linear ramp envelope applied to every note; dur is measured in seconds, 0 means length of current note
						"data": {"start": 1.2, "end": 0.25, "dur": 0.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": [
							"As4 9"
						]
					}
				,	{"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.8, "dur": 0.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": [
							"Rst 2"
						,	"Cs4 2"
						,	"Ds4 2"
						,	"Fs4 2"
						]
					}

				// block 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": [
							"Rst 2"
						,	"As4 2"
						,	"Gs4 1"
						,	"As4 2"
						,	"Rst 1"

						,	"As4 2"
						,	"Gs4 1"
						,	"As4 2"
						,	"Rst 1"
						,	"As4 2"

						,	"Gs4 2"
						,	"Gs4 2"
						,	"Bn4 2"
						,	"As4 2"

						,	"Fs4 2"
						,	"Cs4 2"
						,	"Ds4 2"
						,	"Fs4 2"

						,	"Gs4 2"
						,	"As4 1"
						]
					}
				,	{"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": 1.2, "dur": 0.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": [
							"Fs4 9"
						]
					}
				,	{"command": "env", // set linear ramp envelope applied to every note; dur is measured in seconds, 0 means length of current note
						"data": {"start": 1.2, "end": 0.25, "dur": 0.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": [
							"Fs4 12"
						,	"Rst 8"
						]
					}
				,	{"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.8, "dur": 0.0}
					}

				// block 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": [
							"Rst 2"
						,	"Fs5 6"

						,	"Fn5 1"
						,	"Cs5 2"
						,	"As4 2"
						,	"Fs4 1"
						,	"As4 1"
						,	"Cs5 1"

						,	"Ds5 2"
						,	"Cs5 2"
						,	"As4 2"
						,	"Fs4 2"

						,	"Gs4 3"
						,	"Cs5 3"
						,	"Fs4 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": 1.2, "dur": 0.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": [
							"Gs4 6"
						,	"As4 9"
						]
					}
				,	{"command": "env", // set linear ramp envelope applied to every note; dur is measured in seconds, 0 means length of current note
						"data": {"start": 1.2, "end": 0.25, "dur": 0.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": [
							"As4 9"
						,	"Rst 8"
						]
					}
				,	{"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.8, "dur": 0.0}
					}
					
				// block 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 2"
						,	"Fs5 6"

						,	"Fn5 1"
						,	"Cs5 2"
						,	"As4 2"
						,	"Fs4 1"
						,	"As4 1"
						,	"Cs5 1"

						,	"Ds5 2"
						,	"Cs5 2"
						,	"As4 1"
						,	"Fs4 1"
						,	"As4 1"
						,	"Cs5 1"

						,	"Gs4 3"
						,	"Cs5 3"
						,	"Cs4 2"
						]
					}

				// go to first ending when "loop" counter < 1
				// (and increase loop counter)
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": 8, "times": 1}
					}

				// second ending
				,	{"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": 1.2, "dur": 0.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": [
							"Gs4 6"
						,	"Fs4 6"
						]
					}
				,	{"command": "env", // set linear ramp envelope applied to every note; dur is measured in seconds, 0 means length of current note
						"data": {"start": 1.2, "end": 0.25, "dur": 0.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": [
							"Fs4 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.8, "dur": 0.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": [
							"Bn4 2"
						,	"As4 2"
						,	"Gs4 2"
						,	"Fs4 1"
						,	"Cs4 9"
						]
					}
				// go to next section when "loop" counter < 3
				// (and increase loop counter)
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": 7, "times": 3}
					}

				// first ending
				,	{"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": 1.2, "dur": 0.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": [
							"Gs4 6"
						,	"Fs4 9"
						]
					}
				,	{"command": "env", // set linear ramp envelope applied to every note; dur is measured in seconds, 0 means length of current note
						"data": {"start": 1.2, "end": 0.25, "dur": 0.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": [
							"Fs4 9"
						,	"Rst 8"
						]
					}
				,	{"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.8, "dur": 0.0}
					}

				// repeat from start of section when "loop" counter < 2
				// (and increase loop counter)
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -34, "times": 2}
					}

				// B section

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

				,	{"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.5, "dur": 0.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": [
							"Fs2 4"
						,	"Fs3 3"
						,	"Fs2 2"
						,	"Fs2 3"
						,	"Fs3 4"

						,	"Fs2 4"
						,	"Fs3 3"
						,	"Fs2 2"
						,	"Fs3 1"
						,	"Fs2 2"
						,	"Fs3 4"

						,	"Cs3 4"
						,	"Cs2 3"
						,	"Cs3 2"
						,	"Cs3 3"
						,	"Cs2 4"

						,	"Fs2 4"
						,	"Fs3 3"
						,	"Fs2 2"
						,	"Fs2 3"
						,	"Fs3 4"


						,	"Bn2 4"
						,	"Fs3 3"
						,	"Bn2 2"
						,	"Fs3 1"
						,	"Bn2 2"
						,	"Fs3 4"

						,	"Fs2 4"
						,	"Fs3 3"
						,	"Fs2 2"
						,	"Fs2 3"
						,	"Fs3 4"

						,	"Cs2 4"
						,	"Cs3 3"
						,	"Cs2 2"
						,	"Cs2 3"
						,	"Cs3 4"

						,	"Cs2 4"
						,	"Cs3 3"
						,	"Cs2 2"
						,	"Cs3 1"
						,	"Cs2 2"
						,	"Cs3 4"
						]
					}

				]
			,	"nz":	// 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.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
						"data": {"level": 0.07}
					}
				,	{"command": "pan", 
						"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" cound when 2 similar frequencies overlap)
				//		"data": {"cents": 0}
				//	}

				// First iter

				,	{"command": "notes", 
						"data": [
							"Rst 64" // intro
						,	"Rst 64" // block 1
						,	"Rst 64" // block 2
						,	"Rst 64" // block 3

						,	"Rst 48" // block 4

						,	"Gn2 2" //bd
						,	"Rst 1"
						,	"Gn2 1" //bd
						,	"Cn6 2" //hat
						,	"Rst 1"
						,	"Gn2 1" //bd
						,	"Gn2 2" //bd
						,	"Cn6 2" //hat
						,	"Gn2 1.5" //bd
						,	"Cn6 0.5" //hat
						,	"En4 2" //snare
						]
					}

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

				,	{"command": "notes", 
						"data": [
							"Gn2 4" //bd
						,	"Cn6 3" //hat
						,	"Gn2 1" //bd

						,	"Gn2 4" //bd
						,	"Rst 1"
						,	"Cn6 1" //hat
						,	"En4 2" //snare


						,	"Gn2 4" //bd
						,	"Cn6 3" //hat
						,	"Gn2 1" //bd

						,	"Gn2 4" //bd
						,	"Rst 1"
						,	"Cn6 1" //hat
						,	"En4 2" //snare


						,	"Gn2 4" //bd
						,	"Cn6 3" //hat
						,	"Gn2 1" //bd

						,	"Gn2 4" //bd
						,	"Rst 1"
						,	"Cn6 1" //hat
						,	"En4 2" //snare


						,	"Gn2 4" //bd
						,	"Cn6 3" //hat
						,	"Gn2 1" //bd

						,	"Gn2 2" //bd
						,	"Cn6 1" //hat
						,	"Gn2 2" //bd
						,	"Cn6 1" //hat
						,	"En4 2" //snare
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -1, "times": 4}
					}

				// B section

				//,	{"command": "notes", 
				//		"data": [
				//			"Rst 64"
				//		,	"Rst 64"
				//		]
				//	}
				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 0.0, "end": 1.0, "dur": 0}
					}
				,	{"command": "notes", 
						"data": [
							"Rst 3"
						,	"An4 1" //snare (brush rub)
						]
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.0, "dur": 0}
					}
				,	{"command": "notes", 
						"data": [
							"En4 2" //snare (brush rub)
						,	"Rst 2"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -4, "times": 15}
					}
				
				]
		}
	};
