Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autogenerate docs/funcs.md #65

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
584 changes: 287 additions & 297 deletions docs/funcs.md

Large diffs are not rendered by default.

264 changes: 264 additions & 0 deletions docs/funcs.md.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
{{! This is a mustache template for the Hydra function documentation.
The funcs.md file is generated by `scripts/docs.js` using this template.
}}
# Functions

- [Categories of functions](#categories)
- [Complete contents of functions](#contents)

## Categories

- [Audio](#audio)
- [Color](#color)
- [Geometry](#geometry)
- [Global variables](#global-variables)
- [Modulators](#modulators)
- [Operators](#operators)
- [Sources](#sources)
- [Parameter sequences](#parameter-sequences)

## Contents

- [Audio](#audio)
- [hide](#hide)
- [setBins](#setbins)
- [setCutoff](#setcutoff)
- [setScale](#setScale)
- [setSmooth](#setSmooth)
- [show](#show)
- [Color](#color)
{{ category-toc-color }}
- [Geometry](#geometry)
{{ category-toc-geometry }}
- [Global variables](#global-variables)
- [mouse](#mouse)
- [time](#time)
- [Modulators](#modulators)
{{ category-toc-modulators }}
- [Operators](#operators)
{{ category-toc-operators }}
- [Sources](#sources)
{{ category-toc-sources }}
- [out](#out)
- [render](#render)
- [Parameter sequences](#parameter-sequences)
- [Lists as parameter sequences](#lists-as-parameter-sequences)
- [Functions on parameter sequences](#functions-on-parameter-sequences)
- [fast](#fast)

---

## Audio

Functions for manipulating audio signals.

- [hide](#hide)
- [setBins](#setbins)
- [setCutoff](#setcutoff)
- [setScale](#setScale)
- [setSmooth](#setSmooth)
- [show](#show)

### hide

`.hide()`

### setBins

`.setBins( bins )`

* `bins` :: integer (default `x`)

### setCutoff

`.setCutoff( frequency )`

* `frequency` :: float (default `x`)

### setScale

`.setScale( amount )`

* `amount` :: float (default `x`)

### setSmooth

`.setSmooth( amount )`

* `amount` :: float (default `x`)

### show

`.show()`

---

## Color

Functions for manipulating color.

{{ category-toc-color }}

{{& functions-color }}

---

## Geometry

Functions for manipulating geometry.

{{ category-toc-geometry }}

{{& functions-geometry }}

---

## Global variables

Useful variables that are defined globally, and can be used within functions as a parameter.

- [mouse](#mouse)
- [time](#time)

### mouse

`mouse`

* `.x` :: x position of mouse
* `.y` :: y position of mouse

#### Example

Control the oscillator frequency with the mouse position:

```javascript
osc(() => mouse.x).out(o0)
```

### time

`time`

* `time` :: the current time

#### Example

Control the oscillator using a sine wave based on the current time:

```javascript
osc( ({time}) => Math.sin(time) ).out(o0)
```

---

## Modulators

Functions for describing modulations of sources.

{{ category-toc-modulators }}

{{& functions-modulators }}

## Operators

Functions for performing operations on sources.

{{ category-toc-operators }}

{{& functions-operators }}

---

## Sources

Sources are elementary generators that output different types of visual content.

{{ category-toc-sources }}
- [out](#out)
- [render](#render)

{{& functions-sources }}

### out

`.out( buffer )`

* `buffer`
* `osc`: `o0`, `o1`, `o2`, `o3`
* `src`: `s0`, `s1`, `s2`, `s3`

#### Example

```javascript
// output four oscillators to different buffers
// and then modulate them together
osc( [1,10,50,100,250,500].fast(2) ).kaleid(20).out(o0) // frequency
osc( ({time}) => Math.sin(time/10) * 100 ).kaleid(19).out(o1) // frequency 2
osc( 10, [-10,-1,-0.1,0,0.1,1,10], 0 ).kaleid(21).out(o2) // sync
osc(10,0.1, ({time}) => Math.sin(time/10) * 1 ) // offset
.modulate(o1,0.05)
.modulate(o2,0.05)
.modulate(o3,0.05)
.kaleid(20)
.add(noise(3,10))
.out(o3)
render(o3)
```

### render

`render( buffer )`

* `buffer`: buffer (default `o0`)

#### Example

```javascript
osc( [1,10,50,100,250,500].fast(2) ).out(o0) // frequency
osc( ({time}) => Math.sin(time/10) * 100 ).out(o1) // frequency 2
osc( 10, [-10,-1,-0.1,0,0.1,1,10], 0 ).out(o2) // sync
osc(10,0.1, ({time}) => Math.sin(time/10) * 100 ).out(o3) // offset

render(o0) // change to o1, o2, or o3
```

```javascript
// see all four buffers at once
osc( [1,10,50,100,250,500].fast(2) ).out(o0) // frequency
osc( ({time}) => Math.sin(time/10) * 100 ).out(o1) // frequency 2
osc( 10, [-10,-1,-0.1,0,0.1,1,10], 0 ).out(o2) // sync
osc(10,0.1, ({time}) => Math.sin(time/10) * 100 ).out(o3) // offset
render()
```

---

## Parameter sequences

- [Lists as parameter sequences](#lists-as-parameter-sequences)
- [Functions on parameter sequences](#functions-on-parameter-sequences)
- [fast](#fast)

### Lists as parameter sequences

```
osc(
[80, 100, 200, 50], 1 )
)
.out(o0)
```

### Functions on parameter sequences

#### fast

`fast ( amount) `

* `amount` :: float (default `x`)

```
osc(
[80, 100, 200, 50].fast(0.2), 1 )
)
.out(o0)
```
42 changes: 0 additions & 42 deletions docs/funcs_audio.md

This file was deleted.

Loading