"use strict";

/* --------------------------------------------------- */
/* SkyDragon Story track 03                            */
/* Take (it outside) On Them!                          */
/*                                                     */
/* (c) Sean Kelly, 2013                                */
/* --------------------------------------------------- */
DATA_CHIPTUNES["Take (it outside) On Them!"] = {
		"chip": "oneofeach"
	,	"bpm": 360 // beats per minute; 180 quarters in 8ths
	,	"priority": 1 // baseline nonzero for BGM
	,	"songdata" : {
			"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.25, "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.05}
					}
				//,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
				//		"data": {"cents": -5}
				//	}

				// Section A.0

				,	{"command": "pan", "data": {"position": 0.625}}
				,	{"command": "notes", 
						"data": [
							"Cn4 3"
						]
					}
				,	{"command": "pan", "data": {"position": 0.375}}
				,	{"command": "notes", 
						"data": [
							"Cn3 3"
						]
					}
				,	{"command": "pan", "data": {"position": 0.625}}
				,	{"command": "notes", 
						"data": [
							"Cn4 1"
						]
					}
				,	{"command": "pan", "data": {"position": 0.375}}
				,	{"command": "notes", 
						"data": [
							"Cn3 1"
						]
					}

				,	{"command": "pan", "data": {"position": 0.625}}
				,	{"command": "notes", 
						"data": [
							"Cn4 1"
						,	"Cn4 2"
						]
					}
				,	{"command": "pan", "data": {"position": 0.375}}
				,	{"command": "notes", 
						"data": [
							"Cn3 3"
						]
					}
				,	{"command": "pan", "data": {"position": 0.625}}
				,	{"command": "notes", 
						"data": [
							"Cn4 1"
						]
					}
				,	{"command": "pan", "data": {"position": 0.375}}
				,	{"command": "notes", 
						"data": [
							"Cn3 1"
						]
					}

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

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

				

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

				,	{"command": "notes", 
						"data": [
							"Rst 0.5" // permanent desync
						]
					}

				// Section A.0

				,	{"command": "pan", "data": {"position": 0.625}}
				,	{"command": "notes", 
						"data": [
							"Cn4 3"
						]
					}
				,	{"command": "pan", "data": {"position": 0.375}}
				,	{"command": "notes", 
						"data": [
							"Cn3 3"
						]
					}
				,	{"command": "pan", "data": {"position": 0.625}}
				,	{"command": "notes", 
						"data": [
							"Cn4 1"
						]
					}
				,	{"command": "pan", "data": {"position": 0.375}}
				,	{"command": "notes", 
						"data": [
							"Cn3 1"
						]
					}

				,	{"command": "pan", "data": {"position": 0.625}}
				,	{"command": "notes", 
						"data": [
							"Cn4 1"
						,	"Cn4 2"
						]
					}
				,	{"command": "pan", "data": {"position": 0.375}}
				,	{"command": "notes", 
						"data": [
							"Cn3 3"
						]
					}
				,	{"command": "pan", "data": {"position": 0.625}}
				,	{"command": "notes", 
						"data": [
							"Cn4 1"
						]
					}
				,	{"command": "pan", "data": {"position": 0.375}}
				,	{"command": "notes", 
						"data": [
							"Cn3 1"
						]
					}

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

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

				]
		,	"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.5, "dur": 0}
					}
				,	{"command": "sweep", // set linear frequency sweep applied to every note (start and end multiply base note frequency)
						"data": {"start": 1.0, "end": 1.0, "dur": 0}
					}
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.12}
					}
				//,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
				//		"data": {"cents": 0}
				//	}

				// Section A.0

				,	{"command": "notes", 
						"data": [
							"Rst 32"
						]
					}

				,	{"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": -2, "times": 1}
					}

				]
		,	"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.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": 0.5, "dur": 0.25}
					}
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.15}
					}
				//,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
				//		"data": {"cents": 0}
				//	}
				,	{"command": "pan", 
						"data": {"position": 0.4375}
					}

				// Section A.0

				,	{"command": "notes", 
						"data": [
							"Gn2 3"
						,	"Gn2 4"
						,	"Gn2 2"

						,	"Gn2 3"
						,	"Gn2 1"
						,	"Gn2 3"

						,	"Gn2 3"
						,	"Gn2 4"
						,	"Gn2 2"

						,	"Gn2 3"
						,	"Gn2 1"
						,	"Gn2 3"
						]
					}

				,	{"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": -2, "times": 1}
					}

				]
		,	"nz":	// name of a channel on the chip	
				[
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.2, "dur": 0}
					}
				//,	{"command": "sweep", // set linear frequency sweep applied to every note (start and end multiply base note frequency)
				//		"data": {"start": 1.0, "end": 1.0, "dur": 0}
				//	}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.05}
					}
				,	{"command": "pan", 
						"data": {"position": 0.5625}
					}
				//,	{"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}
				//	}

				// Section A.0

				,	{"command": "notes", 
						"data": [
							"Rst 2"
						,	"Cn4 1" //snare
						,	"Rst 1"
						,	"Dn6 2" //hat
						,	"Cn4 1" //snare
						,	"Rst 1"

						,	"Rst 2"
						,	"Cn4 1" //snare
						,	"Rst 1"
						,	"Rst 2"
						,	"Cn4 1" //snare
						,	"Rst 1"

						,	"Rst 2"
						,	"Cn4 1" //snare
						,	"Rst 1"
						,	"Dn6 2" //hat
						,	"Cn4 1" //snare
						,	"Rst 1"

						,	"Rst 2"
						,	"Cn4 1" //snare
						,	"Rst 1"
						,	"Rst 2"
						,	"Cn4 1" //snare
						,	"Rst 1"
						]
					}

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

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

				]
		}
	};

