Motion

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

  • Sensing
  • Since 0.2.0
  • motion
  • accelerometer
  • sensing

Open in TuneToys

Motion as the Patch draws it, at default values: inlets on the left, outlets on the right.

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.

Ports#

PortDirectionSignalLanes
controlOutputControl10

Parameters#

ParameterLabelRangeDefaultUnitScaleNotes
smoothSmooth0 to 100030mslinearOne-pole smoothing of every lane.
rangeRange0.5 to 82glinearAcceleration that maps to the ends of the lanes.

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 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, Scale, Smooth, Sensing, Control lanes.

Help patches

Each help patch is an ordinary Toy that teaches one idea. The diagram shows the Patch; the preview shows its Frame. Open it in TuneToys to play and edit it.

1. Tilt the filter

beginner Teaches: smooth, range, sensing

Device tilt sweeps a filter.

Patch: Motion control output connected to Select lanes control input. Select lanes control output connected to Filter @cutoff input. Oscillator audio output connected to Filter audio input. Filter audio output connected to Patch outputs audio input.
Connections as text
  • Motion control output connected to Select lanes control input
  • Select lanes control output connected to Filter @cutoff input
  • Oscillator audio output connected to Filter audio input
  • Filter audio output connected to Patch outputs audio input
  • Lane 7 is tilt. Motion sensors need a phone or tablet; a desktop reports present as 0.
  • Browsers may ask permission for motion on first Play.
Frame preview: Tilt the filterFrame “Tilt the filter” with 3 elements: text heading, knob Range, knob Smooth.TILT THE FILTER2 gRange30 msSmooth
Frame preview (static). Controls show their default values.

Open in TuneToys

  • Select lanes Extract a contiguous lane range from a control bundle. Use several to split a sensor's lanes.
  • Scale Map a control range onto another with a curve, clamp and inversion. Depth and offset for any modulation.
  • Smooth Slow a control lane down with separate rise and fall times so jumpy sensors and buttons stop clicking.

Edit this page on GitHub

esc

↑ ↓ move↩ open⌘↩ new tabesc close