"use strict";

/* --------------------------------------------------- */
/* a template track in SoundEdit-parseable format      */
/* --------------------------------------------------- */
DATA_CHIPTUNES["JSON_template"] = {
		"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.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.1}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 1.0}
					}
				,	{"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}
					}
				,	{"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"
						,	"Dn2 1"
						,	"En2 1"
						,	"Fn2 1"
						,	"Gn2 1"
						,	"An2 1"
						,	"Bn2 1"
						,	"Cn3 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}
					}
				,	{"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"
						,	"Rst 1"
						,	"Rst 1"
						,	"Rst 1"
						,	"Rst 1"
						,	"Rst 1"
						,	"Rst 1"
						,	"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": -4, "times": 1}
				//	}
				]
		,	"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.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.1}
					}
				,	{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 1.0}
					}
				,	{"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}
					}
				,	{"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"
						,	"Rst 1"
						,	"Rst 1"
						,	"Rst 1"
						,	"Rst 1"
						,	"Rst 1"
						,	"Rst 1"
						,	"Rst 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}
					}
				,	{"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"
						,	"Bn2 1"
						,	"An2 1"
						,	"Gn2 1"
						,	"Fn2 1"
						,	"En2 1"
						,	"Dn2 1"
						,	"Cn2 1"
						]
					}
				]
		,	"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.1}
					}
				,	{"command": "tempo", // change tempo mid-tune
						"data": {"bpm": 240}
					}
				,	{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": 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": [
							"Cn3 1"
						,	"Cn3 1"
						,	"Dn3 1"
						,	"Dn3 1"
						,	"En3 1"
						,	"Cn3 1"
						,	"Fn3 1"
						,	"Fn3 1"
						,	"Gn3 1"
						,	"Cn3 1"
						,	"An3 1"
						,	"An3 1"
						,	"Bn3 1"
						,	"Bn3 1"
						,	"Cn4 1"
						,	"Cn3 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": [
							"Cn4 1"
						,	"Cn3 1"
						,	"Bn3 1"
						,	"Bn3 1"
						,	"An3 1"
						,	"An3 1"
						,	"Gn3 1"
						,	"Cn3 1"
						,	"Fn3 1"
						,	"Fn3 1"
						,	"En3 1"
						,	"Cn3 1"
						,	"Dn3 1"
						,	"Dn3 1"
						,	"Cn3 1"
						,	"Cn3 1"
						]
					}
				]
		,	"sin":	// name of a channel on the chip	
				[
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 1.0, "dur": 0.0}
					}
				,	{"command": "vol", // set overall volume of channel
						"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": [
							"Cn5 1"
						,	"Bn4 1"
						,	"Cn5 1"
						,	"Gn4 1"
						,	"Cn5 1"
						,	"Bn4 1"
						,	"Cn5 1"
						,	"Rst 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": [
							"Cn5 1"
						,	"Dn5 1"
						,	"Cn5 1"
						,	"Gn4 1"
						,	"Cn5 1"
						,	"Dn5 1"
						,	"Cn5 1"
						,	"Rst 1"
						]
					}
				]
		}
	};