"use strict";

/* --------------------------------------------------- */
/* SkyDragon Story track 21 (02b)                      */
/* Secondhand Feelings                                 */
/* ("Meli"'s depression)                               */
/* (c) Sean Kelly, 2017                                */
/* --------------------------------------------------- */
DATA_CHIPTUNES["Secondhand Feelings"] = {
		"chip": "oneofeach"
	,	"bpm": 120 // beats per minute
	,	"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}
					}
				,	{"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": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": 0}
					}

				// A
				
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.05}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.5}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Gn3 6"
						]
					}
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.025}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.625}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Gn3 6"
						]
					}
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.05}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.5}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Gn3 6"
						]
					}
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.01875}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.375}
					}
				,	{"command": "notes", // strings of the form "NnO L" where NnO is the Note-modifier-Octave note to play (from DEF_CHIPTUNE_PITCHES) and L is the length in beats or fractions (can be multiple characters as long as parseFloat will take it)
						"data": [
							"Gn3 6"
						]
					}
				// B/C/D

				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.05}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.5}
					}

				,	{"command": "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": [
							"Cn4 1"
						,	"Cn3 1"
						,	"Cn3 1"
						,	"Cn3 2"
						,	"Cn3 1"
						]
					}

				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -1, "times": 11}
					}
				]
		,	"tri":	// 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}
					}
				//,	{"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.5}
					}
				,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": 0}
					}

				// A

				,	{"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 1"
						,	"Cn3 1"
						,	"Cn3 1"
						,	"Cn3 2"
						,	"Cn3 1"
						]
					}

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

				// B
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.4375}
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.0875}
					}
				,	{"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 .66"
						,	"Ef4 .34"
						,	"Gn4 .66"
						,	"Cn5 .34"
						,	"Ef5 .66"
						,	"Cn5 .34"
						]
					}
				,	{"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 .66"
						,	"Cn5 .34"
						,	"Gn4 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": [
							"Dn5 .66"
						,	"Bn4 .34"
						,	"Gn4 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": [
							"Dn5 .66"
						,	"Bf4 .34"
						,	"Gn4 2"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -4, "times": 1}
					}

				// C
				,	{"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 .66"
						,	"An4 .34"
						,	"Fn4 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 .66"
						,	"Af4 .34"
						,	"Fn4 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": [
							"Bn4 .66"
						,	"Af4 .34"
						,	"Fn4 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": [
							"Bf4 .66"
						,	"Gn4 .34"
						,	"En4 2"
						]
					}

				// D
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.625}
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.5, "dur": 0}
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.025}
					}
				,	{"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 3"
						,	"Cn5 3"
						,	"Cn5 3"
						,	"Fn4 3"

						,	"Ef4 3"
						,	"Rst 3"
						,	"Ef4 3"
						,	"Rst 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": [
							"Gn4 3"
						,	"Ef4 3"
						,	"Ef4 3"
						,	"Dn4 3"
						]
					}


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

				// A

				,	{"command": "sweep", // set linear frequency sweep applied to every note (start and end multiply base note frequency)
						"data": {"start": 0.99, "end": 1.0, "dur": 0.1}
					}
				
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.05}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.5}
					}
				,	{"command": "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 6"
						]
					}
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.025}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.6875}
					}
				,	{"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 6"
						]
					}
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.05}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.5}
					}
				,	{"command": "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 6"
						]
					}
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.01875}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.3125}
					}
				,	{"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 6"
						]
					}

				// B
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.025}
					}
				,	{"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.5625}
					}

				,	{"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 .71"
						,	"Ef4 .34"
						,	"Gn4 .66"
						,	"Cn5 .34"
						,	"Ef5 .66"
						,	"Cn5 .34"
						]
					}
				,	{"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 .66"
						,	"Cn5 .34"
						,	"Gn4 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": [
							"Dn5 .66"
						,	"Bn4 .34"
						,	"Gn4 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": [
							"Dn5 .66"
						,	"Bf4 .34"
						,	"Gn4 1.95"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta commands if loop counter < times; increase loop counter
						"data": {"delta": -4, "times": 1}
					}

				// C
				,	{"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 .66"
						,	"An4 .34"
						,	"Fn4 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 .66"
						,	"Af4 .34"
						,	"Fn4 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": [
							"Bn4 .66"
						,	"Af4 .34"
						,	"Fn4 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": [
							"Bf4 .66"
						,	"Gn4 .34"
						,	"En4 2"
						]
					}

				// D
				,	{"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.5}
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.5, "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": [
							"Ef4 3"

						,	"Cn4 2"
						,	"Bf3 1"

						,	"An3 3"

						,	"An3 3"

						,	"Gn3 6"

						,	"Gn3 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": [
							"Ef4 3"

						,	"Cn4 2"
						,	"Bf3 1"

						,	"An3 3"

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

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

				,	{"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": [
							"Cn4 1"
						,	"Cn4 1"
						,	"Cn4 1"
						,	"Cn4 2"
						,	"Cn4 1"
						]
					}

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

				// B
//				,	{"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 3"
//						,	"Rst 3"
//						,	"Rst 3"
//						,	"Rst 3"
//						,	"Rst 3"
//						,	"Rst 3"
//						,	"Rst 3"
//						,	"Rst 3"
//						]
//					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.025}
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 0.0, "end": 1.0, "dur": 0}
					}
				,	{"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": [
							"Cn4 1"
						,	"Cn4 1"
						,	"Cn4 1"
						,	"Cn4 2"
						,	"Cn4 1"
						]
					}

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

				// 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.5, "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": [
							"Fn4 3"
						,	"Fn4 3"
						,	"Dn4 3"
						,	"Dn4 3"
						]
					}

				// D
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.375}
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.5, "dur": 0}
					}
				,	{"command": "vol", // set overall volume of channel
						"data": {"level": 0.025}
					}
				,	{"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 3"
						,	"Cn5 3"
						,	"Cn5 3"
						,	"Fn4 3"

						,	"Ef4 3"
						,	"Rst 3"
						,	"Ef4 3"
						,	"Rst 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": [
							"Gn4 3"
						,	"Ef4 3"
						,	"Ef4 3"
						,	"Dn4 3"
						]
					}

				]
		}
	};
/* --------------------------------------------------- */
/* Matt Burton.                                        */
/* --------------------------------------------------- */
