# Motion

> The device's accelerometer and gyroscope as control lanes: acceleration, rotation rate, tilt, heading and a shake gate.

Source: https://docs.tune.toys/nodes/sense.motion/

Motion turns the device's accelerometer and gyroscope into control lanes.

## What it does

It has no inputs. The `control` output has 10 lanes from 0 to 1, in order: accel.x, accel.y, accel.z, rot.alpha, rot.beta, rot.gamma, tilt, heading, shake, present. It needs a device with motion sensors; the browser may ask permission. Last values hold when the sensor stops and `present` falls after 220 ms. Nothing is uploaded.

## When to use it

Use it to tilt or shake a phone to play. See [Sensing](https://docs.tune.toys/concepts/sensing/).

## Ports

<!-- ports:start -->

| Port      | Direction | Signal  | Lanes |
| --------- | --------- | ------- | ----- |
| `control` | Output    | Control | 10    |

<!-- ports:end -->

## Parameters

<!-- parameters:start -->

| Parameter | Label  | Range     | Default | Unit | Scale  | Notes                                            |
| --------- | ------ | --------- | ------- | ---- | ------ | ------------------------------------------------ |
| `smooth`  | Smooth | 0 to 1000 | 30      | ms   | linear | One-pole smoothing of every lane.                |
| `range`   | Range  | 0.5 to 8  | 2       | g    | linear | Acceleration that maps to the ends of the lanes. |

<!-- parameters:end -->

### Smooth (`smooth`)

Smoothing time in milliseconds for the lanes.

### Range (`range`)

Scales how much motion maps to the full 0 to 1 range.

## Tips

- Use [Select lanes](https://docs.tune.toys/nodes/ctl.select/) with `"audio": {"channels": 1, "firstChannel": N}` to pick one lane; lanes count from 1.
- A one-lane control cable can drive any parameter through its `{ "node": "x", "port": "@param" }` socket.

## See also

[Select lanes](https://docs.tune.toys/nodes/ctl.select/), [Scale](https://docs.tune.toys/nodes/ctl.scale/), [Smooth](https://docs.tune.toys/nodes/ctl.smooth/), [Sensing](https://docs.tune.toys/concepts/sensing/), [Control lanes](https://docs.tune.toys/concepts/control-lanes/).
