<!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' />
<!--}}}-->
Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #18f
PrimaryMid: #04b
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
/*{{{*/
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}

h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}

.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}

.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}

.tabSelected {color:[[ColorPalette::PrimaryDark]];
	background:[[ColorPalette::TertiaryPale]];
	border-left:1px solid [[ColorPalette::TertiaryLight]];
	border-top:1px solid [[ColorPalette::TertiaryLight]];
	border-right:1px solid [[ColorPalette::TertiaryLight]];
}
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}

#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}

.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
	border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}

.wizard .notChanged {background:transparent;}
.wizard .changedLocally {background:#80ff80;}
.wizard .changedServer {background:#8080ff;}
.wizard .changedBoth {background:#ff8080;}
.wizard .notFound {background:#ffff80;}
.wizard .putToServer {background:#ff80ff;}
.wizard .gotFromServer {background:#80ffff;}

#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}

.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}

.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}

.tiddler .defaultCommand {font-weight:bold;}

.shadow .title {color:[[ColorPalette::TertiaryDark]];}

.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}

.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}

.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}

.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}

.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}

.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}

.imageLink, #displayArea .imageLink {background:transparent;}

.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}

.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}

.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}

.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}

.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}
.readOnly {background:[[ColorPalette::TertiaryPale]];}

#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:alpha(opacity=60);}
/*}}}*/
/*{{{*/
* html .tiddler {height:1%;}

body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0 1em 1em; left:0; top:0;}

.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}

#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 0.3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0 0; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0;}
.wizardFooter .status {padding:0 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em; margin:0;}

.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabset {padding:1em 0 0 0.5em;}
.tab {margin:0 0 0 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 17em 0 14em;}

.toolbar {text-align:right; font-size:.9em;}

.tiddler {padding:1em 1em 0;}

.missing .viewer,.missing .title {font-style:italic;}

.title {font-size:1.6em; font-weight:bold;}

.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0 0.25em; padding:0 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0 3px 0 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0; font-size:.9em;}
.editorFooter .button {padding-top:0; padding-bottom:0;}

.fieldsetFix {border:0; padding:0; margin:1px 0px;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0; right:0;}
#backstageButton a {padding:0.1em 0.4em; margin:0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin-left:3em; padding:1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/***
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.
***/
/*{{{*/
body {font-size:0.8em;}
#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}
.subtitle {font-size:0.8em;}
.viewer table.listView {font-size:0.95em;}
/*}}}*/
/*{{{*/
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none !important;}
#displayArea {margin: 1em 1em 0em;}
noscript {display:none;} /* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
}
/*}}}*/
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser excludeLists'></span></div>
<!--}}}-->
To get started with this blank [[TiddlyWiki]], you'll need to modify the following tiddlers:
* [[SiteTitle]] & [[SiteSubtitle]]: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* [[MainMenu]]: The menu (usually on the left)
* [[DefaultTiddlers]]: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
These [[InterfaceOptions]] for customising [[TiddlyWiki]] are saved in your browser

Your username for signing your edits. Write it as a [[WikiWord]] (eg [[JoeBloggs]])

<<option txtUserName>>
<<option chkSaveBackups>> [[SaveBackups]]
<<option chkAutoSave>> [[AutoSave]]
<<option chkRegExpSearch>> [[RegExpSearch]]
<<option chkCaseSensitiveSearch>> [[CaseSensitiveSearch]]
<<option chkAnimate>> [[EnableAnimations]]

----
Also see [[AdvancedOptions]]
<<importTiddlers>>
The ''Alias'' patch, alternate name ''Group'', may have any number of [[user-defined inputs|Created Input]] and will output those signals directly via outputs of the [[same name|Matched Output]].

It is useful for situations where it is desirable to group a number of [[signals|Signal]] and [[expressions|Expression]] under a single name, for easy access and cleaner code.

It is a common means of passing arguments to [[instances|Instance]] via the [[Import]] command.

<<<
''Note:'' //Alias is unrelated to the concepts described in [[Aliasing]].//
<<<

!!Inputs

{{{<port>}}}
<<<
All [[port names|Port]] are fair game for use as [[user-defined inputs|Created Input]].
<<<

!!Outputs

{{{<port>}}}
<<<
This patch has a [[matching output|Matched Output]] for each input, which routes the signal through unmodified.
<<<
An ''Array'' maintains some number of [[instances|Instance]] of a script file, each of which is assigned a number and informed of the total.

It is possible for an Array to maintain zero, one or many copies, and the number may be adjusted as the program runs.

!!Properties

[[Float]]{{{ count}}}
<<<
This number, rounded down, controls the number of instances in existence.  Instances will be created or destroyed at the end of the list as necessary.

Defaults to{{{ 0}}}.
<<<

!!Loading

The [[Load]] command specifies the script source file which will be used to create the Array's instances.

!!Imports

Patches specified with the [[Import]] command will be imported into every instance created by the Array.

In addition, the Array will import a special patch, named{{{ index}}}, into each instance it creates.  This patch has the following outputs:

[[Scalar]]{{{ index}}}
<<<
Specifies the ''array index'' of this instance, an integer ranging from{{{ 0 }}}to{{{ count-1}}}.
<<<

[[Scalar]]{{{ index.count}}}
<<<
Specifies the total number of instances in the Array.
<<<

[[Scalar]]{{{ index.fraction}}}
<<<
Equivalent to{{{ (index / index.count)}}}.  It is useful for Arrays whose elements should be evenly distributed across a range.
<<<
The ''Color'' patch facilitates conversion between color spaces.  Presently, it offers just one conversion: HSV to RGB.

<<<
''todo:''  //The default color conversion model will be changed to a smoother function -- a circle in colorspace rather than the jagged hexagon of conventional HSV computations.//
<<<

!!Inputs

[[Scalar]]{{{ hue}}}
<<<
The ''hue'' determines the bearing of the output color on the color wheel.
{{{0.0}}}, the default, is red.  {{{0.333 }}} is green.  {{{0.667 }}} is blue, and{{{ 1.0 }}}is red again.
As the color wheel is cyclic, values outside{{{ (0.0, 1.0)}}} will "wrap around".

A fuller sequence:
|Red|Orange|Yellow|Chartreuse|Green|Turquoise|Cyan|Aqua|Blue|Purple|Fuchsia|Rose|Red|
|{{{0.0000}}}|{{{0.0833}}}|{{{0.1667}}}|{{{0.2500}}}|{{{0.3333}}}|{{{0.4167}}}|{{{0.5000}}}|{{{0.5833}}}|{{{0.6667}}}|{{{0.7500}}}|{{{0.8333}}}|{{{0.9167}}}|{{{1.0000}}}|
<<<

[[Scalar]]{{{ sat}}}
<<<
The ''saturation'' determines the intensity of the color.
{{{0.0}}}, the default, produces greyscale colors.  {{{1.0 }}}maximizes the hues described above.

It is common artistic wisdom to avoid using multiple fully-saturated colors together.
<<<

[[Scalar]]{{{ val}}}
<<<
The ''value'' determines how bright or dark the color is.  The lower the value, the closer the color becomes to black.
{{{1.0}}}, the default, means the brightest color channel will have a value of{{{ 1.0}}}.  {{{0.0 }}}will make the output color black.
<<<

!!Outputs

[[Scalar]]{{{ red, green, blue}}} -- alternately,{{{ r, g, b}}}
<<<
The channels of the output color, as computed based on the inputs above.
Assuming{{{ sat }}}and{{{ val }}}are within standard ranges, these will be between{{{ 0.0 }}}and{{{ 1.0}}}.
<<<
Some patches allow [[Input]] ports to be created with custom names using an{{{ Input }}}or{{{ Output }}}command and the{{{ + }}}character.

This is useful when a patch takes an arbitrary number of inputs, especially when those inputs have [[sub-ports|Port]] supplying further information.

It's also essential for patches with [[Matched Output]].

!!Syntax

Using Variant 2 or 3 of the [[Input]] syntax, add a{{{ + }}}before the name of the port which is to be created, like so:
{{{
Alias: myAlias
{
    Input +myPort = 2.0;

    Input
    {
        //We can create a default input port, but we have to type out the name.
        +default = (1.0 / 3.0);
    }
}
}}}

It is also possible to create an input in the target port of an [[Output]] statement.  Again, variant 2 or 3 must be used, but now the plus-sign needs to be in a different position.
(this example also demonstrates use of [[Matched Output]] in outputter.)
{{{
Alias: target
{
}

Alias: outputter
{
    Input
    {
        +valueA = 3;
        +valueB = 42;
    }

    Output
    {
        valueA -> +target.valueA;
        valueB -> +target.valueB;
    }
}
}}}
After this code,{{{ target }}}should output{{{ 3 }}}and{{{ 42 }}}from its{{{ valueA }}}and{{{ valueB }}}ports, respectively.
The ''Curve'' patch smooths a set of [[Scalar]] values out over time.  By gently ramping output values toward input values, it can turn a chaotic signal into a gentle one.

<<<
''todo'': //This patch was named a little hastily, and its name may be changed in the future.  Another proposed patch is much more well-described by the name "Curve".//
''todo'': //More curvature modes should be added, and the control values should be made framerate-independent.//
<<<

This process improves [[Continuity]] -- making the signal's changes gentler and preventing sudden jumps.  At the same time, it induces [[Latency]] -- making the signal take effect more slowly.  These two effects are directly related, and will tend to increase or decrease together.

A few different types of ramping are available, as described below; their effects may be combined freely.

!!Properties

[[Float]]{{{ linear, up, down}}}
<<<
''Linear ramping'' will bring the output value toward the input at a fixed rate when they differ.
{{{up }}}and{{{ down }}}control the rates of increase and decrease separately, while{{{ linear }}}controls both at once.
These values default to{{{ 0.0}}}.
<<<

[[Float]]{{{ damp, damp2}}}
<<<
''Asymptotic ramping'' pulls the output value toward the input value at a rate proportional to the difference between them.
The target value will be approached, but never quite reached -- as letting values reach 0 can be important, combining a tiny amount of linear ramping can be helpful.
{{{damp }}}defaults to{{{ 0.0 }}}and controls the first-order asymptotic ramp.  More intuitively, it defines the fraction of the difference to be eliminated per frame.
{{{damp2 }}}defaults to{{{ 1.0 }}}and can optionally be assigned a lesser value to make the ramp's rate of change also continuous.  It controls a second-order asymptotic ramp, toward the value of the first one.
<<<

!!Inputs

[[Scalar]]{{{ <port>}}}
<<<
All [[port names|Port]] are fair game for use as [[user-defined|Created Input]] [[scalar|Scalar]] inputs.  Their values are the targets for the ramping action each [[update|Update]].
<<<

!!Outputs

[[Scalar]]{{{ <port>}}}
<<<
This patch has a [[matching output|Matched Output]] for each input, which produces the smoothly-ramped value of that input.
<<<
Patches with "main" input or output [[ports|Port]] conventionally name those ports{{{ default}}}.  These ''default ports'' may be referenced in shorthand by simply referring to the patch itself, or using the shortest variant of the [[Input]] or [[Output]] clause.

For example, the [[LFO]] patch has a single input and a single output, both called "default".  Therefore, if I declare an LFO by the name{{{ myLFO}}}, I may optionally omit the{{{ default }}}when I would otherwise type out{{{ myLFO.default }}}or{{{ Input default}}}.

In patches with [[Created Input]] functionality, it is generally possible to create default ports, which can be very convenient.

!!Advanced

Default ports have several interesting uses within the [[Page]] patch.  A Page's port-names are the patches inside it.  When such a port is referenced as an input or output, with no sub-port names following, the patch's default port is used as normal.  If a patch is //called// default, its default ports become the default ports for the Page itself.  This can be very useful when building [[Custom Patches]].
[[Ozone]]
The ''Export'' command allows [[patches|Patch]] in the current [[Page]] to be [[Imported|Import]] into other patches.  It complements the [[Import]] keyword in a way similar to how [[Output]] complements [[Input]].

Its use in practice is often //very// different from ''Import''.  Specifically, it was designed for use with [[dynamic instantiator|Instance]] patches, which often create instances in response to specific exports.

!!Export Syntax

The export command may only appear at [[page scope|Scope]], outside all patch definitions.

An export may be defined with the following syntax:
{{{
Export <patch> -> <destination>.<name>;
}}}
Inside the patch{{{ <destination>}}}, the item referred to by{{{ <patch> }}}will be known as{{{ <name>}}}.

Frequently, [[dynamic instantiators|Instance]] will create code when they receive an export to a special name, which depends on their type.

It is possible to export patches from inside another [[Page]], using the dot operator, like so:
{{{Export timeModule.clock -> myArray.clock;}}}

!!Example Usage
The ''Harmonograph'' is an extremely flexible visual generator which creates line figure based on a series of decaying sinusoidal oscillations along various axes, spatial and otherwise.  The interference -- consonances and dissonances -- between the rates and phases of these oscillations create complex emergent patterns in the resulting figure.

Like any good [[Generator]], its artistic usage is a topic far more complex and nuanced than the system itself, and outside the scope of this article.  Experiment and explore.

''This article is a work in progress.''
The ''Import'' command allows [[patches|Patch]] in the current [[Page]] to be made accessible to other Pages and [[Instances|Instance]] that it creates, effectively allowing for bi-directional communication between separate pieces of code.

This is useful for various purposes, for example:
*Sharing Patches and information between two scripts, allowing for a connected program in multiple files.
*Making multiple [[Pages|Page]] from a single script, each with different inputs controlling its behavior.  (This use is similar to function arguments.)
*Capturing and combining output from dynamic [[Instances|Instance]] of scripts, whose outputs cannot be referenced directly.

Creative uses of Import are discussed further in the articles on patches which support the function.  (See the ''meta'' tag.)

!!Import Syntax

Within a patch capable of creating instances, an import may be defined with the following syntax:
{{{
Import <name> = <patch>;
}}}
Inside the created patches, the item referred to by{{{ <patch> }}}will be known as{{{ <name>}}}.
<<<
//Note: Import commands should, as a convention, precede [[Load]] commands in code.//
<<<
It may often be desirable for the internal name to match the external one, and lines such as{{{ Import clock = clock; }}} are not unreasonable.

It is possible to import patches from inside another [[Page]], using the dot operator, like so:
{{{Import clock = timeModule.clock;}}}

Under no condition, however, is it possible to import a single [[Port]].  For this reason, [[Alias]] and [[Variables]] are commonly used as imports.

!!Required Imports

Scripts written for use with import will generally reference{{{ <name> }}}and will malfunction if it is not imported due to a typo or programming oversight.  Normally, this malfunction (a missing patch-name) produces only non-critical warnings which will appear on the terminal.

The requirement may be enforced more strictly by placing the following line inside the imported file, above and outside of any patches:
{{{Import <name>;}}}
Again, to programmers familiar with other languages it's useful to think of imports as arguments.  This line enforces that an argument must be supplied.

!!Example Usage
An Input is a type of [[Port]] through which a [[Signal]]'s data may flow into a Patch.  They are generally assigned using the{{{ Input }}}keyword within the definition of the [[Patch]].

The input signal may come directly from the output of another patch, or may be a non-trivial [[Expression]].  When a built-in input is left undefined, it will generally assume a reasonable default value.

Some patches' inputs behave in unusual ways.  These special behaviors have their own articles:
*[[Created Input]] -- Inputs created by the script-writer, which might have custom or temporary names.
*[[Plural Input]] -- Inputs which can take more than one signal in at the same port.

!!Input syntax
There are three variants of the Input clause, each of which is essentially shorthand for the next.
See the [[Expression]] article for a better understanding of what code may replace{{{ <expression> }}}below.

Variant 1 defines an input to the patch's default port.
{{{
Input = <expression>;
}}}

Variant 2 defines an input to a single named port.
{{{
Input portName = <expression>;
Input portName.subPort = <expression>;
}}}

Variant 3 allows many ports to be assigned at once.
{{{
Input
{
    //Equivalent to Variant 1 example
    default = <expression>;

    //Equivalent to Variant 2 examples
    portName = <expression>;
    portName.subPort = <expression>;
}
}}}

!!Example Usage
{{{
Timer: clock
{
    //The Timer patch has a scalar default output which we will use below.
}

LFO: myLFO
{
    //The LFO patch has a default input and a default output, both Scalar.
    //See the LFO article for further information.

    Input = clock;
}

Color: myColor
{
    //A Color has inputs "hue", "sat" and "val", and outputs "r", "g" and "b".
    //See the Color article for further information.

    Input
    {
        //Assign constants to sat and val.
        sat = .8;
        val = .6;

        //Assign a math expression to hue.
        hue = (2 * clock);
    }
}

Harmonograph
{
    Input
    {
        //Assign to a created input we call "osc", with a constant: 1.
        +osc = 1;

        //Assign to the sub-ports of our created port.  Control spatial oscillations with myLFO.
        osc.x = myLFO;
        osc.y = (1 - myLFO);

        //Control color oscillation sub-ports with the outputs of myColor
        osc.r = myColor.r;
        osc.g = myColor.g;
        osc.b = myColor.b;
    }
}
}}}
An ''instance'' is technically the same thing as a [[Page]] -- a contained set of [[patches|Patch]] that have been created according to the instructions in an ozone [[script file|Parser]].

The term is used with preference, however, in situations where the created page is not accessible to the page which created it.  This is most commonly the case when the page is created ''dynamically'' -- meaning while the program runs.

!!Communication

Because these pages don't exist while their creating page -- called the ''parent'' -- is being [[parsed|Parser]], their outputs cannot be acquired by the parent.  However, using the [[Output]] keyword, they may route outputs from their patches to the inputs of patches which have been [[imported|Import]] into them.  These connections will be automatically severed when the instance is destroyed.

Several patches exist which facilitate this specifically.  Look out for these instance-friendly features, which can be used to combine outputs:
*[[Anonymous Input]]
*[[Plural Input]]
The ''Joiner'' is a more complex relative of the [[Spawner]].  Like its cousin, it creates [[instances|Instance]], called "groups", in response to [[imports|Import]] or [[exports|Export]] to a special name -- {{{item}}}.  The critical difference is that it is possible for an item to connect with an already-existing group.  A group may "contain" zero, one or many items.

When an item is added to the joiner, it is matched with an existing group according to the ''join rule''.  If no suitable group exists, one is created.  As in [[Spawner]], groups may optionally control their own lifetime and continue existing even with zero members.

Since there is no way for groups to be directly changed by the addition of new items, connections are made and broken through the creation and destruction of a second page type, called ''joints''.  Think of these as representing an item's membership in a group, which ceases to exist when the item or group vanishes, or the item is moved to a different group.

!!Join Rule

Currently the ''join rule'' is that each group has a range of numeric values,{{{ GROUP.min }}}to{{{ GROUP.max}}}, in which the item's value{{{ JOIN.x }}}must fit.  Thus, groups are effectively arranged along a number-line.  In the future this may be generalized.

!!Properties

[[Boolean]]{{{ dynamic}}}
<<<
If this value is true, items will be constantly checked against their groups to see if the ''join rule'' has been broken -- that is, if they've strayed outside the group's range.  If so

Defaults to{{{ 0}}}.
<<<

!!Imports (joint)

In the joint page, the patch exported to{{{ item }}}on the joiner will be available as{{{ item}}}, and the group with which it has been associated will be available as{{{ group}}}.

In order to move information between the two, it may be necessary to use the [[In-Out]] technique.

!!Special Definitions (group)

The Group page must define a patch called{{{ GROUP}}}, with numeric outputs{{{ min }}}and{{{ max}}}, defining its range for use with the ''join rule''.  Optionally it may also define an output{{{ survive}}}, which functions as in [[Spawner]].

An example:
{{{
Variables: GROUP
{
    Input
    {
        +min = -1;
        +max = 1;
    }
}
}}}
This isn't a very useful group, as its range is fixed.  Generally a scheme for defining a group's range based on its initial item will be necessary.

!!Special Definitions (item)

Items exported to a joiner need to define an output within themselves named{{{ JOIN.x}}}.

The value{{{ x }}}will be compared to the group ranges described above in order to enforce the ''join rule''.

An example:
{{{
Variables: JOIN
{
    Input +x = 5;
}
}}}
This page would be entered into a group at position 5.
A ''keyboard'' exposes input from the system keyboard (if any) to the program.

It is intended as a ''debugging'' feature but there's nothing wrong with using it to make keyboard-controlled programs.

!!Outputs

[[Scalar]]{{{ <key name>}}}
<<<
Each of the keys listed below outputs a value of{{{ 1.0 }}}if the key is being held, and{{{ 0.0 }}}otherwise.
<<<
{{{
//Arrow keys
up, down, left, right,

//Letters and numbers
_0, _1, _2, _3, _4, _5, _6, _7, _8, _9,
a, b, c, d, e, f, g, h, i, j, k, l, m,
n, o, p, q, r, s, t, u, v, w, x, y, z,

//General purpose controls.  A few of these control built-in Ozone functions; see the Operation article.
control, shift, alt, capsLock,
space, tab, backspace, enter, escape,
home, end, pageUp, pageDown, insert, del,

//The following keys should be avoided as some control special engine functions.
f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15,
tilde,

none; //A null button which is always un-held.
}}}
An ''LFO'', short for ''Low Frequency Oscillator'', is a mathematical function that oscillates (moves back and forth) between two values.  Generally this oscillation is over [[time|Timer]] but it is possible to control it with other values.

This patch allows some control over the shape of the oscillation (with{{{ curve}}}) and its starting point (with{{{ phase}}}).

!!Input

[[Scalar]]{{{ default}}} -- [[Default]] Input
<<<
The value which controls the oscillation, generally expected to be a [[Timer]].
Defaults to{{{ 0.0}}}.

Every increase of{{{ 1.0 }}}in this input value represents a full oscillation of the LFO.
Thus its output would be the same for inputs of{{{ 0.43}}},{{{ 11.43 }}}and{{{ -2.57}}}, for instance.
<<<

!!Output
[[Scalar]]{{{ default}}} -- [[Default]] Output
<<<
Returns the value of the oscillation function, as defined by the below parameters.
<<<

!!Properties

[[Float]]{{{ low, high}}}
<<<
These are the two values between which the LFO will oscillate.
Default to{{{ 0.0 }}}and{{{ 1.0 }}}respectively; these values are useful for fading colors and sounds.

It's quite all right for{{{ high }}} to be less than or equal to{{{ low}}}; the names are chosen for clarity.
<<<

[[Float]]{{{ curve}}}
<<<
This value controls the shape of the oscillation between{{{ low }}}and{{{ high}}}.

Defaults to{{{ 0.5}}}, which produces a gentle ''sine wave'' motion.
A value of{{{ 1.0 }}}will produce a ''triangle wave'' where the value moves at a constant speed, changing direction suddenly.
A value of{{{ 0.0 }}}will produce a ''square wave'' where the value jumps between its extremes suddenly.

Values anywhere between{{{ 0.0 }}}and{{{ 1.0 }}}are valid and will produce motions in-between the ones described here.
Values in excess of{{{ 1.0 }}}will produce strange motions that linger near a center value, jumping only briefly to the extremes.

Be aware that temporal [[Aliasing]] might have undesirable effects on very low or high{{{ curve }}}values.
<<<

[[Float]]{{{ phase}}}
<<<
Added to the default input (see below) when computing the oscillation function.  Useful for controlling the starting-point.
Defaults to{{{ 0.0}}}, which has the oscillation at its middle value, increasing.
{{{0.25 }}}will start the oscillation at{{{ high}}}, while{{{ 0.75 }}}will start it at{{{ low}}}.
{{{0.5 }}}will start the oscillation in the middle, but decreasing.
<<<
[[Patches|Patch]] which require some kind of external data may import that data with a{{{ Load }}}command written within the patch definition.

To load a data file into a patch, place a line like this inside its definition.
{{{Load("path/to/file.ext");}}}

The file path should be relative to the ozone file which contains it.  Thus, I write:
*{{{Load("picture.png"); }}}to load a file "picture.png" in the same folder as this piece of code.
*{{{Load("sounds/sound.ogg"); }}}to load a file "sound.ogg" from the "sound" folder next to my code.
*{{{Load("../othercode.ozone"); }}}to load a piece of ozone source from the parent folder -- "{{{..}}}" means "the folder above this one."

Different patches might load, for example, [[images|Image]], [[sounds|Texture]], [[settings|Timeline]] or [[other script files|Page]].
[[Ozone]]

[[Patch List]]

__[[Patch Anatomy|Patch]]__
[[Properties|Property]]
[[Ports|Port]] ([[In|Input]] / [[Out|Output]])
[[Signals|Signal]]
[[Expressions|Expression]]
[[Load]]
[[Import]] / [[Export]]
A ''matched output'' is an [[Output]] port which is created at the same time as a [[Created Input]], with the same name.  Its value will be based on the matching input in some way.

These are useful for patches which alias, collect, or process many values or [[signals|Signal]] side-by-side.

!!Example Usage

The following example uses the [[Variables]] patch, which supports this feature.
{{{
Variables: vars
{
    Input
    {
        +a = 1.0;
        +b = 42;
        +c = (1 / 3.1415926);
    }
}

PrintOut
{
    Input
    {
        +value_of_a = vars.a;
        +value_of_b = vars.b;
        +value_of_c = vars.c;
    }
}
}}}
Most [[patches|Patch]] output some kind of information in the course of doing their work.  Those which do not display that information to the user will make it available via output [[ports|Port]] in the form of [[Signals|Signal]], which may be fed into the inputs of other patches.

It is important to understand that despite the similarity in [[syntax|Port]], outputs are separate from [[inputs|Input]].  The existence of an input with a given name does not guarantee an output of the same name will exist, and vice versa.

The outputs of a patch are generally defined by that patch's type or the data it [[loads|Load]].  A few other schemes exist, however:
*[[Matched Output]] -- Outputs whose names match those of [[created inputs|Created Input]] on the patch.

Using the{{{ Output }}}keyword within the definition of a Patch will allow a signal from that patch to be routed to some destination.  This is much less common than using [[Input]] declarations, but allows "later" patches to communicate to "earlier" ones, and to destinations which might otherwise have no awareness of the data source's existence.

!!Output syntax
Similar to the [[Input]] clause, there are three variants, each of which is shorthand for the next.
See the [[Target]] article for a better understanding of what code may replace{{{ <target> }}}below.

Variant 1 outputs from the patch's default port to some target.
{{{
Output -> <target>;
}}}

Variant 2 outputs from a single named port.
{{{
Output portName -> <target>;
Output portName.subPort -> <target>;
}}}

Variant 3 allows many outputs to be routed at once.
{{{
Output
{
    //Equivalent to Variant 1 example
    default -> <target>;

    //Equivalent to Variant 2 examples
    portName -> <target>;
    portName.subPort -> <target>;
}
}}}
Welcome to the Ozone documentation!

Ozone is a dataflow programming language.  You'll want to first acquaint yourself with its core concepts before delving into its use -- start with the [[Patch]] article.

Ozone was written by Evan Balster beginning in 2012 for use in Robin Arnott's experimental game, //~SoundSelf//.
''Page'' is perhaps the most important and powerful among the native patches in Ozone.  Whenever a script file is loaded up, a Page is created according to the instructions in that file.

Effectively, it represents a single [[instance|Instance]] of a script file, and acts as a container for other [[Patches|Patch]].  It is also a patch itself, and makes the inputs and outputs of all patches within it readily accessible as [[sub-ports|Port]].

Pages can be created by means other than the declaration of this patch, in which case their inputs and outputs are not accessible except from inside the Page:
*When Ozone loads a script file directly.  These are called ''main pages'' or ''programs'' by convention.
*When an [[Instance]] is created dynamically by a ''meta'' patch other than Page.

!!Imports

This patch supports the [[Import]] command.  Unlike most other ''meta'' patches, it has no built-in imports to the imported Page.

!!Loading

Use the [[Load]] command with a relative path to the script file which is to be created.  The current script will cease [[parsing|Parser]] at this point, until the target file has been loaded completely.  (In a sense it's like the child script was stuck in the middle of the parent script, except all the names created live inside the page.)

[[Imports|Import]] should be declared ''before'' the Load command of a page, and any inputs or outputs afterwards.  This is because these commands are executed in order; the Load operation is dependent on Imports, and no patches exist within the page until afterward.

!!Inputs and Outputs

The ports of a Page are simply the names of the Patches existing inside it, and their ports within them.

For instance,{{{ myPage.myPatch }}}refers to a patch called{{{ myPatch }}}inside a Page patch we have called{{{ myPage}}}.  Because no port-name was specified after{{{ myPatch}}}, this name will refer to a [[Default]] port of{{{ myPatch}}}, assuming one exists.

This rule allows for routing both [[Input]] and [[Output]] to patches inside a page, and to pages within it as well.
A ''Patch'' is the basic building block in Ozone.  A wide variety of [[built-in patches|Patch List]] are available for various purposes, and it is possible to [[invent your own|Custom Patches]] with a little creativity.

Ozone is a dataflow language, meaning it models a flow of information -- [[Signals|Signal]] -- though processing pathways within a program.  These pathways consist of Patches, each of which performs some combination of generating, transforming, inputting or outputting that data.  Some patches are even capable of dynamically altering the structure of the program, managing the creation, destruction and inter-connection of other patches.

A Patch consists of a few basic parts.  A given patch may use only some of these:
*[[Properties|Property]] -- Built-in values which control the behavior of native patches.
*[[Ports|Port]] -- Named channels which move data [[Signals|Signal]] between patches.  There are two types:
**[[Inputs|Input]] -- Data flows into a patch at these entry points.
**[[Outputs|Output]] -- Sources of data which may flow out of a patch.
*[[Load]] command -- Used to load some kind of data file into the patch.
*[[Import]] commands -- Allows communication between patches defined in different pieces of code.

!!Patch Syntax

A patch of a given [[type|Patch List]] may be declared as follows:

Variant 1 -- named patch declaration
{{{
PatchType: patchName
{
    //This patch of imaginary type PatchType may be referred to as "patchName" by other patches.
}
}}}

Variant 2 -- anonymous patch declaration
{{{
PatchType
{
    //This patch is anonymous and may not be directly referred to by other patches.
}
}}}

The space between the{{{ { }}}brackets{{{ } }}}is called the ''patch definition'' elsewhere in this documentation.  The various parts listed above may be manipulated by writing code within it.
Following is a list of native patches in Ozone.  These are built into the system and written in C++; it is also possible to write [[your own patches|Custom Patches]] in the ozone language.

See the [[Patch]] article for general information on how to put these to use.

!!General
*[[Alias]] -- Collects the outputs of other patches under a single name.  Also known as Group.
*[[Timer]] -- A value which changes over time.  By default, measures time in seconds.
*[[Timeline]] -- Used to query user-defined regions within multi-dimensional maps.  An editor is included.

!!Meta
*[[Page]] -- A single instance of a piece of code, which may be accessed fully.
*[[Array]] -- Creates a variable number of instances.
*[[Table]] -- Creates a grid of instances relating one set of imports to another.
*[[Spawner]] -- Creates independent pages in response to an export trigger.
*[[Joiner]] -- Creates independent pages called "groups" which may connect with various exports over time.

!!Debugging and IO
*[[Keyboard]] -- Facilitates input from keyboard keys.
*[[Midi]] -- Facilitates input from and output to system MIDI devices, presently limited to CC values.
*[[PrintOut]] -- Displays numeric values to the screen.

!!Math
*[[Variables]] -- Stores numeric values which update each frame.  Differs very subtly from Alias.
*[[Total]] -- Maintains various sums of numbers.  Intended for use with [[Instances|Instance]].
*[[Curve]] -- Ramps values gradually over time, improving [[Continuity]] but increasing [[Latency]].
*[[LFO]] -- A function which oscillates between two values based on some "time" variable.

!!Audio
*[[Perilymph]] -- A voice analysis system which identifies sung tones.
*//Voice// -- The original voice analysis patch. ''Deprecated.''
*[[Trioxy]] -- A modular AM/PM synthesizer, with an external editor.
*[[Texture]] -- Plays an audio loop, whose pitch and amplitude may be varied.

!!Video
*[[Color]] -- Converts from HSV colorspace to RGB colorspace.
*[[Background]] -- Draws a solid color over the screen. Can be transparent or a foreground, despite its name.
*[[Harmonograph]] -- A visual generator based on decaying sinusoidal oscillations of varying frequencies, axes and phases.
*[[Image]] -- A raster graphic loaded from an image file.  May be blended, tiled and alpha-mapped.
''Perilymph'' is a pitch detection and voice analysis system used as the control scheme in SoundSelf.  It is also a separate program.

''this page is a work-in-progress.''

This patch creates [[instances|Instance]] of code which receive information on individual voice tones it detects.

<<<
''todo'': //Due to its incomplete state and central importance in SoundSelf, this patch is very likely to be refactored in the future, possibly breaking compatibility with old code.//
<<<

!!Properties

[[String]]{{{ toneCode}}}
<<<
Used in lieu of a [[Load]] command.
<<<
A ''Plural Input'' is a special type of [[input port|Input]] which accepts more than one [[Signal]], generally combining them somehow.

This is distinguished from the general case of a ''Single Input'', which will most often drop the old input signal when a new one is supplied.

Plural inputs are very useful with [[dynamic instantiation|Instance]], though not exclusively.
Ports are the points at which [[Signals|Signal]] to flow into and out of a [[Patch]].  They may be [[Inputs|Input]] or [[Outputs|Output]].

A port is referred to by its name, which consists of a chain of [[identifiers|Identifier]] separated by dots.  For instance,{{{ velocity }}}and{{{ circle.x }}}are valid port-names.

Outside of the patch in which they exist, ports are referred to by the name of the patch, a dot, and the port's name.  For instance,{{{ myPatch.circle.x}}}.

!!Default Ports
<<<
Main article: [[Default]]
<<<
Patches with "main" inputs or outputs conventionally name those ports{{{ default}}}.  These ''default ports'' may be referenced in shorthand by simply referring to the patch itself, or using the shortest variant of the [[Input]] or [[Output]] clause.

!!~Sub-Ports
When a port-name contains dots, the names after the dots are called ''sub-ports'' of the names preceding them, which signify some kind of grouping.  A port might be named{{{ circle.x}}}, where{{{ x }}}is a sub-port of{{{ circle}}}.

Some Patches, specifically [[Page]], contain other Patches and treat them as ports, with the ports of those patches being sub-ports.

It is possible, though uncommon, for sub-port chains to be quite long.  Something like {{{page.subPage.patch.port.subPort.subSubPort}}} is entirely possible.
''Properties'' are intrinsic values of a [[Patch]] which control its behavior.  They are separate from [[Signals|Signal]] and exist only in Ozone's [[native patches|Patch List]].

They are assigned inside a Patch using the syntax{{{ property = <value>;}}}

They may presently assume the following types:
*[[strings|String]] of text.
*[[boolean|Boolean]] values which may be{{{ true }}}or{{{ false}}}.
*Numbers:
**[[floating-point|Float]] values (decimal numbers).
**[[integers|Integer]] (whole numbers) which might be
***''signed'', meaning they permit negative values, or
***''unsigned'', meaning they do not.

It is possible for real-valued properties to be controlled by [[expressions|Expression]], in which case their value will be automatically updated each frame.  This creates a potentially confusing overlap with [[Inputs|Input]], which also accept expressions.  As a rule of thumb, numbers which might often be assigned constant values are implemented as properties.

''Example Usage''
{{{
PatchType: myPatch
{
    //We can set a numeric property to a constant value...
    decimalProperty = .4;

    //...Or to some math expression, which will cause it to change every frame.
    anotherDecimalProperty = (clock * 2);

    //Not all numeric properties are decimals.
    integerProperty = 5;

    //Strings are a datatype that is unsupported by Signals but can be used with properties.
    stringProperty = "This is some text!";

    //Booleans are another.
    booleanProperty = true;
}
}}}
A ''Scalar'' is the only type of [[signal|Signal]] presently available in Ozone.

It is a numeric value, specifically a [[Float]], which may change in value for each frame of program execution.

Behaviors:
*A Scalar output may be safely bound to any number of input ports.
*A Scalar input may be safely re-bound to a new signal while the program is running.
*Disconnected Scalar inputs are nearly always substituted with reasonable default values.

!!Pitfalls

Because it is sampled at the program framerate -- generally 60hz -- oscillations near or above half that -- 30hz -- will not be accurately represented.
See [[Aliasing]] for further details.

There are various things to be cautious about with math on scalars:
*[[Division]] by zero, which will produce infinity or not-a-number (~NaN) values
*Taking a negative number to an [[Exponent]] which is not a whole number, which will produce ~NaNs.
*Computing extremely small, ''denormalized'' numbers -- billionths of billionths of billionths -- will cause program slowdown.  Their occurrence is uncommon.
*Computing extremely large numbers -- billions of billions of billions -- risks the creation of infinity values.
~NaNs and infinities have an unpleasant habit of spreading like wildfire through systems which take them as inputs, rendering whole sections of code non-functional.
Fortunately Ozone offers limited debugging facilities to detect all of these mathematical errors.
<<tabs txtMainTab "Tags" "All tags" TabTags "All" "All tiddlers" TabAll "More" "More lists" TabMore "Timeline" "Timeline" TabTimeline>>
A ''Signal'' is a continuous stream of data flowing from the [[Output]] port of one [[Patch]] to the [[Input]] port of another.
They are the basis of all scriptwriter-defined communication, computation and processing in the Ozone engine.

Different signal types may exhibit some differences in behavior, particularly with regard to "splitting" or "sharing" them between multiple destinations.

Currently, Ozone supports signals of the following types:
*[[Scalar]] -- A [[Float]] value which changes from frame to frame.
**Supports mathematical [[expressions|Expression]].
**May be shared by any number of inputs.

Forthcoming signal types include:
*''Audio'' -- A stream of audio data which may be synthesized, processed, and analyzed in realtime.
*''Video'' -- Geometry and pixel data which can be duplicated and postprocessed.
creative engine -- June 20, 2013
Ozone
An ''Spawner'' [[instantiates|Instance]] of a script file in response to [[imports|Import]] or (more frequently) [[exports|Export]] to the name{{{ trigger}}}.

By default, these instances will last as long as the trigger which created them.  However, it is possible for them to take control of their own lifetimes and outlast their originators.  This makes the Spawner well-suited to modeling "independent" objects and processes -- though as with any instantiator none will outlive the Spawner itself.

!!Loading

The [[Load]] command specifies the script source file which will be used to create the Spawner's instances.

!!Imports

The patch exported to{{{ trigger }}}will be available in created instances as{{{ trigger}}}.

!!Special Definitions

Instances may define a patch called{{{ SPAWN}}}, with a numeric output called{{{ survive}}}.  If this is done, the instance will continue to exist so long as{{{ SPAWN.survive}}} is not equal to zero.  This will override the default behavior, allowing the instance to terminate while the trigger still exists, or endure long after it has vanished.

An example:
{{{
Import trigger;  //Any outputs taken from the trigger will break if we outlive it.

Timer: age
{
}

Variables: SPAWN
{
    Input +survive = (age < 10);
}
}}}
If created by a spawner, this instance would exist for exactly ten seconds before being destroyed.
.viewer {font-size:1.1em;}

hr.postbreaker {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.tagged li, .tagged ul {display:inline;}

.viewer code {font-size:1.3em; line-height:1.2em;}

.subtitle {float:right; opacity:0.5;}
The ''Texture'' patch plays a sound file on loop, with continuously-controlled pitch and amplification.

Changes in pitch and amplitude will ramp smoothly from [[frame to frame|Update]].
Multiple mechanisms for pitch changing are available, and their effects "stack".

Be cautious of using extremely high pitches as these may cause performance issues and audio [[aliasing|Aliasing]].  As data is no longer streamed from disk, this is less of a problem than formerly, however.
Extremely low pitches have no such drawbacks and are in fact quite a lot of fun.

<<<
''todo'': //The term "texture" creates an unpleasant confusion with the graphics concept.  This patch may be renamed or given a preferred alias in the future.//
''todo'': //When support for [[Audio]] signals is added, this patch will no longer output directly to the speakers, instead using its [[Default]] output port.//
<<<

!!Load command

The [[Load]] command for this Patch expects a path to a supported audio file.
Currently the only format supported is ogg.

The file will be buffered into memory by Ozone, and played from there by this patch.  Only one copy of any given file will be buffered, so the cost of having multiple Textures using a single file is low.

!!Inputs

[[Scalar]]{{{ amp}}}
<<<
Controls the amplification of the sound, where{{{ 1.0 }}}is full volume and{{{ 0.0 }}}is silence.
Defaults to{{{ 1.0}}}.

It is possible to amplify beyond 100% volume, or to use negative values to invert the signal, which allows for interesting tricks...
Be cautious with the math; careless audio programming can easily cause [[hearing damage|Safety]].
<<<

[[Scalar]]{{{ pitch}}}
<<<
An offset in musical semitones (equal temperament) that affects the pitch (and tempo) of the loop.
Defaults to{{{ 0.0}}}, meaning a shift of 0 semitones.

{{{12.0 }}}will double the rate of the sound and bring its pitch up an octave.  {{{-12.0 }}}will halve the rate and drop down an octave.
<<<

[[Scalar]]{{{ rate}}}
<<<
An alternate means of affecting the pitch and tempo of the sound.  Multiplies the resampling rate.
Defaults to{{{ 1.0}}}, meaning one times the base pitch.

{{{2.0 }}}will double the pitch and{{{ .5 }}}will halve it.  Zero and negative values are meaningless and will be clamped.
<<<

!!Properties

[[String]]{{{ fitScale, fitNotes}}}
<<<
These string values allow for automatic pitch fitting of sounds in the A440 scale.  This adjustment combines with the above pitch settings.
fitScale defaults to{{{ "GbAbBbDbEb" }}}and fitNotes defaults to an empty string.

They must be formatted as a string containing some set of capitalized note names ({{{A}}}-{{{G}}}), possibly followed by sharps or flats:{{{ b }}}or{{{ #}}}.  Spaces are okay.
Examples:{{{ "ABCDEFG", "A B C# D E F# G", "DbBb"}}}

The filename passed to the [[Load]] command must also contain a list of notes present in the sound.  ''This list should be present in the name of the file itself,'' between the last underscore and the last dot in the filename.
Example:{{{ Load("audio/Synth_wet_BbDbF.ogg");}}}

If all of these requirements are met, an algorithm will be run which searches for the best pitch-shift to satisfy the following goals, in descending order of importance:
#Make sure every note in{{{ fitNotes }}}is present in the shifted sound.
#Make sure every note in the shifted sound is present in{{{ fitScale}}}.
#Pitch-shift the sound as little as possible, which a slight preference for shifting downward.
<<<

!!Outputs

None as yet.  In the future this patch will output its audio via an [[Audio]] port.
A ''Timer'' patch maintains an output value, called the ''accumulator'', which is advanced each frame at a per-second rate.  By default, this rate is{{{ 1.0}}}, and the Timer counts the seconds that have elapsed since its creation.

Clever usage of this Patch allows it to do more than track time -- for instance, it may be used to model moving objects.  Simply create a timer for each axis of movement, and set the timer's rate to the object's velocity along that axis.

!!Inputs

[[Scalar]]{{{ rate}}}
<<<
The rate of change for the Timer's accumulator value.
Defaults to{{{ 1.0}}}.

To track minutes rather than seconds, this value could be set to{{{ (1/60)}}}.
<<<

[[Scalar]]{{{ reset}}}
<<<
If this input is non-zero, the accumulator is set to zero.
Defaults to{{{ 0.0}}}.

To create a clock that resets to zero every sixty seconds, we could write:
{{{
Timer: myClock
{
    Input reset = (myClock > 60);
}
}}}
<<<

!!Outputs

[[Scalar]]{{{ default}}} -- [[Default]] output
<<<
Outputs the value of the Timer's accumulator.  By default, this is the number of seconds elapsed since creation.
<<<
A ''Total'' patch maintains a set of running totals of [[Scalar]] values, via [[created|Created Input]], [[plural|Plural Input]] input ports.

It is useful for combining the output values of [[dynamic instances|Instance]] whose outputs cannot be directly accessed, using the [[Output]] keyword.

!!Inputs

[[Scalar]]{{{ <port> }}}([[plural|Plural Input]])
<<<
Once [[created|Created Input]], input ports will accept additional scalar inputs, which will be summed together to the output of the same name.

When using this patch with dynamic instances, convention is to declare the inputs in the Total patch, usually initializing them to{{{ 0}}} or some other desirable base value.
<<<

!!Outputs

[[Scalar]]{{{ <port>}}}
<<<
These [[matched outputs|Matched Output]] produce the sums of all scalars connected to the corresponding inputs.
<<<
The ''Variables'' patch is very similar in usage to the [[Alias]] patch, but limited to use with [[Scalar]] signals.  It stores them each [[update|Update]] and outputs the stored values.

The usefulness of this may be less than obvious, and merits some explanation:
<<<
Mathematical [[expressions|Expression]] and many math patches will re-compute the value of their scalar outputs, querying their inputs, each time another patch queries for those outputs.  It is legal for the output of a math formula to go to several destinations, and each of those may split in the same manner.  Every split causes the formula to be evaluated again, and certain arrangements can cause them to explode exponentially.  Early SoundSelf versions ran into problems where the same math was being performed tens of thousands of times per frame!

It is also possible, though uncommon, that a formula may end up collecting part of its input from a patch to which it outputs, and a loop may be created.  If no caching mechanism like Variables is used, this loop creates an infinite formula which can never be solved, and hangs or crashes the program.
<<<


!!Inputs

[[Scalar]]{{{ <port>}}}
<<<
All [[port names|Port]] are fair game for use as [[user-defined|Created Input]] [[scalar|Scalar]] inputs.  Their values will be captured each [[update|Update]].
<<<

!!Outputs

[[Scalar]]{{{ <port>}}}
<<<
This patch has a [[matching output|Matched Output]] for each input, which produces the stored value of that input.
<<<
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span></div>
<div class='tagging' macro='tagging'></div>
<br>
<div class='viewer' macro='view text wikified'></div>
<br>
<div class='tagged' macro='tags'></div>
<br>
<hr class='postbreaker'>
<div class='tagClear'></div>
<!--}}}-->
config.options.txtUserName = "Evan";  // instead of "YourName"
config.options.chkSaveBackups = false;   // don't do backups
config.options.chkAutoSave = true;       // AutoSave whenever I edit
Type the text for 'excludeLists'
Type the text for 'systemConfig'