"use strict";

/* --------------------------------------------------- */
/* SkyDragon Story track 25d                           */
/* Seeking the Darkness Within - IV - Denouement       */
/* (Underdark finish)                                  */
/* (c) Sean Kelly, 2020                                */
/* --------------------------------------------------- */
DATA_CHIPTUNES["Seeking the Darkness IV"] = {
		"chip": "oneofeach"
	,	"bpm": 360 // beats per minute; 120 in 8th-tuples
	,	"priority": 1 // baseline nonzero for BGM
	,	"songdata" : {
			"st":	// name of a channel on the chip	
				[
					{"command": "env", // set linear ramp envelope applied to every note; dur is measured in seconds, 0 means length of current note
						"data": {"start": 1.0, "end": 0.0, "dur": 0.25}
					}
				,	{"command": "sweep", // set linear frequency sweep applied to every note (start and end multiply base note frequency)
						"data": {"start": 1.0, "end": 1.0, "dur": 0}
					}
				,	{"command": "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 - need this redundancy for queueing
						"data": {"bpm": 360}
					}
				,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": 0}
					}

				// Breath

				// 1
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.0, "travel": 1.0, "dur": 0.398, "alternate":true} // less precise, but easier for SoundEdit JSON
					}
				,	{"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": [
							"Bf5 1"
						,	"Ef6 1"
						,	"Dn6 1"
						
						,	"Af5 1"
						,	"Df6 1"
						,	"Cn6 1"
						
						,	"Gf5 1"
						,	"Bn5 1"
						,	"Bf5 1"
						
						,	"Dn5 1"
						,	"Af5 1"
						,	"En5 1"
						]
					}
				,	{"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": [
							"Ef6 1"
						,	"Dn6 1"
						,	"Bf5 1"

						,	"Df6 1"
						,	"Cn6 1"
						,	"Af5 1"

						,	"Bn5 1"
						,	"Bf5 1"
						,	"Gf5 1"

						,	"Af5 1"
						,	"En5 1"
						,	"Dn5 1"
						]
					}
				,	{"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": [
							"Bf5 1"
						,	"Ef6 1"
						,	"Dn6 1"
						
						,	"Af5 1"
						,	"Df6 1"
						,	"Cn6 1"
						
						,	"Gf5 1"
						,	"Bn5 1"
						,	"Bf5 1"
						
						,	"Dn5 1"
						,	"Af5 1"
						,	"En5 1"
						]
					}
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.1125}
					}
				,	{"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": [
							"Ef6 2"
						,	"Dn6 2"
						,	"Bf5 2"

						,	"Df6 2"
						,	"Cn6 2"
						,	"Af5 2"

						,	"Bn5 2"
						,	"Bf5 2"
						,	"Gf5 2"

						,	"Af5 2"
						,	"En5 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": [
							"Rst 3"
						,	"Rst 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.25, "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": "tempo", // change tempo mid-tune - need this redundancy for queueing
						"data": {"bpm": 360}
					}
				,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": 0}
					}

				// Breath

				// 1
				,	{"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": [
							"Ef2 12"
						,	"Ef2 12"
						,	"Ef2 12"
						,	"Ef2 24"
						]
					}
				,	{"command": "env", // set linear ramp envelope applied to every note; dur is measured in seconds, 0 means length of current note
						"data": {"start": 0.25, "end": 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": [
							"Ef2 6"
						]
					}

				

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

				// Breath

				// Delay
				,	{"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.5"
						]
					}

				// 1
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.0, "travel": 1.0, "dur": 0.118, "alternate":true} // less precise, but easier for SoundEdit JSON
					}
				,	{"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": [
							"Bf5 1"
						,	"Ef6 1"
						,	"Dn6 1"
						
						,	"Af5 1"
						,	"Df6 1"
						,	"Cn6 1"
						
						,	"Gf5 1"
						,	"Bn5 1"
						,	"Bf5 1"
						
						,	"Dn5 1"
						,	"Af5 1"
						,	"En5 1"
						]
					}
				,	{"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": [
							"Ef6 1"
						,	"Dn6 1"
						,	"Bf5 1"

						,	"Df6 1"
						,	"Cn6 1"
						,	"Af5 1"

						,	"Bn5 1"
						,	"Bf5 1"
						,	"Gf5 1"

						,	"Af5 1"
						,	"En5 1"
						,	"Dn5 1"
						]
					}
				,	{"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": [
							"Bf5 1"
						,	"Ef6 1"
						,	"Dn6 1"
						
						,	"Af5 1"
						,	"Df6 1"
						,	"Cn6 1"
						
						,	"Gf5 1"
						,	"Bn5 1"
						,	"Bf5 1"
						
						,	"Dn5 1"
						,	"Af5 1"
						,	"En5 1"
						]
					}
				,	{"command": "vol", // set overall volume of channel; 0.1 is a sane "loud" level
						"data": {"level": 0.1125}
					}
				,	{"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": [
							"Ef6 2"
						,	"Dn6 2"
						,	"Bf5 2"

						,	"Df6 2"
						,	"Cn6 2"
						,	"Af5 2"

						,	"Bn5 2"
						,	"Bf5 2"
						,	"Gf5 2"

						,	"Af5 2"
						,	"En5 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": [
							"Rst 3"
						,	"Rst 1.5" // resync
						]
					}

				
				]

		,	"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": 1.0, "dur": 0}
					}
				,	{"command": "sweep", // set linear frequency sweep applied to every note (start and end multiply base note frequency)
						"data": {"start": 1.0, "end": 1.0, "dur": 0}
					}
				,	{"command": "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 - this one's actually different
						"data": {"bpm": 480} // 120 in 16ths
					}
				,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": 0}
					}

				
				// 1
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.0, "travel": 1.0, "dur": 0.544, "alternate":true} // less precise, but easier for SoundEdit JSON
					}
				,	{"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": [
							"Bf3 1"
						,	"Bn3 1"
						,	"Bf3 1"
						,	"Bn3 1"
						,	"Bf3 1"
						,	"Bn3 1"
						,	"Bf3 1"
						,	"Bn3 1"
						,	"Bf3 1"
						,	"Bn3 1"
						,	"Bf3 1"
						,	"Bn3 1"
						,	"Bf3 1"
						,	"Bn3 1"
						,	"Bf3 1"
						,	"Bn3 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": [
							"Ef4 1"
						,	"En4 1"
						,	"Ef4 1"
						,	"En4 1"
						,	"Ef4 1"
						,	"En4 1"
						,	"Ef4 1"
						,	"En4 1"
						,	"Ef4 1"
						,	"En4 1"
						,	"Ef4 1"
						,	"En4 1"
						,	"Ef4 1"
						,	"En4 1"
						,	"Ef4 1"
						,	"En4 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": [
							"Gn4 1"
						,	"Af4 1"
						,	"Gn4 1"
						,	"Af4 1"
						,	"Gn4 1"
						,	"Af4 1"
						,	"Gn4 1"
						,	"Af4 1"
						,	"Gn4 1"
						,	"Af4 1"
						,	"Gn4 1"
						,	"Af4 1"
						,	"Gn4 1"
						,	"Af4 1"
						,	"Gn4 1"
						,	"Af4 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": [
							"Bf4 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"Bn4 1"

						,	"Bf4 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"Bn4 1"
						,	"Bf4 1"
						,	"Bn4 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 4"
						,	"Rst 4"
						]
					}

				
				]
		}
	};
