"use strict";

/* --------------------------------------------------- */
/* Short tunes which temporarily replace the BGM       */
/* --------------------------------------------------- */

DATA_CHIPTUNES["Earthquake"] = {
		"chip": "oneofeach",
		"bpm": 540, // 9 "beats" per second
		"priority": 4, // major fanfare - override BGM and normal SFX
		"songdata" : {
			"nz":	// name of a channel on the chip	
				[
					{"command": "vol", // set overall volume of channel
						"data": {"level": 0.12}
					}
				,	{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.75, "dur": 0}
					}
				,	{"command": "sweep", // set linear frequency sweep applied to every note ("start" and "end" multiply base note frequency)
						"data": {"start": 0.5, "end": 0.45, "dur": 0}
					}

				,	{"command": "jump", // reset the loop counter
						"data": {"reset": true}
					}
				,	{"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": [
							"Ef2 1"
						]
					}
				,	{"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": [
							"Ef2 1"
						]
					}
				,	{"command": "jump", // go forwards/backwards delta "command"s if loop counter < times; increase loop counter
						"data": {"delta": -5, "times": 1}
					}

				]
		}
	};

DATA_CHIPTUNES["A Strange Gift"] = {
		"chip": "oneofeach",
		"bpm": 120, // beats per minute;
		"priority": 4, // major fanfare - override BGM and normal SFX
		"songdata" : {
			"sq":	// 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": "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": 0.6}
					},
					//{"command": "tempo", // change tempo mid-tune
					//	"data": {"bpm": 80}
					//},
					{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" cound 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": [
							"Gs4 0.33",
							"An4 0.33",
							"Gs4 0.34",
							"En4 0.5",
							"Bn3 0.5",
							"Cn4 0.5",
							"En4 0.5",
							"Fs4 3",
						]
					},
				],
			"st":	// name of a channel on the chip	
				[
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.25, "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.05}
					},
					{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.4}
					},
					//{"command": "tempo", // change tempo mid-tune
					//	"data": {"bpm": 80}
					//},
					{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" cound 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": [
							"Bn4 0.25",
							"Cn5 0.25",
							"Bn4 0.25",
							"Cn5 0.25",
							"Bn4 1",
							"Bn4 0.5",
							"Bn4 0.5",
							"Bn4 3",
						]
					},
				],
			"tri":	// 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}
					},
					{"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": 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}
					},
					{"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": [
							"En3 2",
							"Fn3 0.5",
							"En3 0.5",
							"Bn2 3",
						]
					},
				],
		}
	};

DATA_CHIPTUNES["Soylent Purple"] = {
		"chip": "oneofeach"
	,	"bpm": 120 // beats per minute
	,	"priority": 4 // major fanfare - override BGM and normal SFX
	,	"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.0, "dur": 1}
					}
				,	{"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": 0.6}
					}
				//,	{"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": [
							"Af4 1"
						,	"Fn4 0.66"
						,	"Gn4 0.33"
						,	"Af4 0.33"
						,	"Gn4 0.34"
						,	"Ef4 0.34"
						,	"Fn4 2"
						//,	"Dn4 2"
						]
					}
				]
		,	"st":	// 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": 1}
					}
				,	{"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": 0.4}
					}
				//,	{"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": [
							"Ef4 1"
						,	"Cn4 2"
						,	"Gn3 2"
						]
					}
				]
		,	"tri":	// 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": 1}
					}
				,	{"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": 0.5}
					}
				//,	{"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": [
							"Af3 1"
						,	"Gn3 2"
						,	"Cn2 2"
						]
					}
				]
		}
	};

DATA_CHIPTUNES["Found A Shiny Thing"] = {
		"chip": "oneofeach",
		"bpm": 180, // beats per minute;
		"priority": 4, // major fanfare - override BGM and normal SFX
		"songdata" : {
			"sq":	// name of a channel on the chip	
				[
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.75, "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.075}
					},
					{"command": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.6}
					},
					//{"command": "tempo", // change tempo mid-tune
					//	"data": {"bpm": 80}
					//},
					{"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": [
							"Fs4 1.5",
							"Bf4 1.5",
							"Cn5 1"
						]
					},
					{"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": [
							"Cs5 2",
							"Fs5 2"
						]
					},
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 0.75, "end": 1.0, "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": [
							"Fn5 4"
						]
					},
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.0, "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": [
							"Fn5 4"
						]
					}
				],
			"st":	// name of a channel on the chip	
				[
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.75, "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": "pan", // linearly-divided fraction of the audio going to the right channel, with the remainder going to the left
						"data": {"position": 0.4}
					},
					//{"command": "tempo", // change tempo mid-tune
					//	"data": {"bpm": 80}
					//},
					{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": 0}
					},
					{"command": "vol", // set overall volume of channel
						"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": [
							"Bf4 0.5",
							"Af4 0.5",
							"Fs4 0.5",
							"Fn4 0.5"
						]
					},
					{"command": "vol", // set overall volume of channel
						"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": [
							"Bf4 0.5",
							"Af4 0.5",
							"Fs4 0.5",
							"Fn4 0.5"
						]
					},
					{"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": [
							"Bf4 0.5",
							"Af4 0.5",
							"Fs4 0.5",
							"Fn4 0.5"
						]
					},
					{"command": "vol", // set overall volume of channel
						"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": [
							"Bf4 0.5",
							"Af4 0.5",
							"Fs4 0.5",
							"Fn4 0.5"
						]
					},

					{"command": "vol", // set overall volume of channel
						"data": {"level": 0.125}
					},
					{"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 4"
						]
					},
					{"command": "vol", // set overall volume of channel
						"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": [
							"Bf4 4"
						]
					}
				],
			"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": "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": "tempo", // change tempo mid-tune
					//	"data": {"bpm": 80}
					//},
					{"command": "detune", // detune in cents to be applied to the oscillator (for "richer" sound when 2 similar frequencies overlap)
						"data": {"cents": -5}
					},
					{"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": "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": [
							"Cs7 0.5"
						]
					},
					{"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": "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": [
							"Cs7 0.25"
						]
					},
					{"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": "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": [
							"Cs7 0.25"
						]
					},
				{"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": "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": [
							"Cs7 0.5"
						]
					},
					{"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": "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": [
							"Cs7 1"
						]
					},
				{"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": "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": [
							"Cs7 0.5"
						]
					},
					{"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": "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": [
							"Cs7 0.5"
						]
					},
					{"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": "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": [
							"Cs7 0.5"
						]
					},

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

					{"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": "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": [
							"Cs7 0.25"
						]
					},
					{"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": "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": [
							"Cs7 0.25"
						]
					},
					{"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": "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": [
							"Cs7 0.25"
						]
					},
					{"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": "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": [
							"Cs7 0.25"
						]
					},
					{"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": "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": [
							"Cs7 0.5"
						]
					},
					{"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": "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": [
							"Cs7 0.5"
						]
					},

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

					{"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": "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": [
							"Cs7 0.25",
							"Dn7 0.25",
							"Cs7 0.25",
							"Dn7 0.25"
						]
					},
					{"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": [
							"Cs7 0.25",
							"Dn7 0.25",
							"Cs7 0.25",
							"Dn7 0.25"
						]
					},
					{"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": [
							"Cs7 0.25",
							"Dn7 0.25",
							"Cs7 0.25",
							"Dn7 0.25"
						]
					},
					{"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": "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": [
							"Cs7 0.25",
							"Dn7 0.25",
							"Cs7 0.25",
							"Dn7 0.25"
						]
					},

					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 0.0, "dur": 0.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": "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": [
							"Fn7 4"
						]
					}


				],
			"tri":	// name of a channel on the chip	
				[
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 0.5, "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": "vol", // set overall volume of channel
						"data": {"level": 0.15}
					},
					{"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
					//	"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}
					},
					{"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": [
							"Bf2 8"
						]
					},
					{"command": "env", // set linear ramp envelope applied to every note
						"data": {"start": 1.0, "end": 1.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": [
							"Dn3 8"
						]
					}
				]
		}
	};

	