Skip to content

feat: add Ribbon descriptor (1D touch-strip gestures) - #134

Open
edumeneses wants to merge 2 commits into
mainfrom
ribbon-gesture
Open

feat: add Ribbon descriptor (1D touch-strip gestures)#134
edumeneses wants to merge 2 commits into
mainfrom
ribbon-gesture

Conversation

@edumeneses

Copy link
Copy Markdown
Member

Summary

Adds puara_gestures::Ribbon for a 1D touch strip (ribbon / SoftPot / linear position sensor). It turns a position + touched pair into playable gestures: absolute position, slide velocity/direction (glissando), touch-down/up events, and a quick tap (a brief touch that barely moves).

It handles the awkward parts: velocity is not computed across a lift-and-retouch (so moving your finger to a new spot does not produce a spurious jump), and it resets cleanly on release.

API

puara_gestures::Ribbon ribbon;

bool touched = ribbonTouched();
double pos = ribbonPosition(); // e.g. 0..1
ribbon.update(pos, touched);

double pitch = ribbon.position;
double slide = ribbon.velocity;
if (ribbon.tap) triggerNote();

Outputs: position, velocity, direction, touched, onset/release, tap. tapMaxTime/tapMaxTravel define what counts as a tap.

Design note

Timing uses the monotonic clock (update(pos, touched)) or an explicit step (update(pos, touched, dt)) for reproducible results. Identical in Arduino loop(), thread, or ossia process.

Conventions kept

  • Header-only, #pragma once, puara_gestures namespace
  • update(...) overloads, current_value() (position), reset()
  • Doubles only, no STL/Boost/allocation → Arduino-friendly

Files

  • include/puara/descriptors/ribbon.h
  • registered in include/puara/gestures.h
  • examples/arduino/descriptors/ribbon/ribbon.ino
  • Catch2 tests in tests/test_descriptors.cpp ([descriptors][ribbon])
  • README entry + quick example

Testing

  • Ribbon: 17 assertions / 3 cases pass (position/velocity/direction, re-touch jump suppression, tap vs long/large touch)
  • Full descriptor suite: 272 assertions / 10 cases pass (no regressions)

🤖 Generated with Claude Code

https://claude.ai/code/session_0163cH7Znu2oYvnaP7fTEQMN

edumeneses and others added 2 commits July 22, 2026 19:50
Adds puara_gestures::Ribbon for a 1D touch strip (ribbon / SoftPot / linear
position sensor): it turns a position + touched pair into playable gestures
- absolute position, slide velocity and direction (glissando), touch-down/up
events, and a quick tap (a brief touch that barely moves). It handles the
awkward parts: velocity is not computed across a lift-and-retouch (so moving
to a new spot does not produce a spurious jump) and it resets on release.

Positions are in the sensor's own units (0..1 or raw). tapMaxTime/
tapMaxTravel define a tap. Timing uses the monotonic clock
(update(pos, touched)) or an explicit step (update(pos, touched, dt)), so it
behaves identically in an Arduino loop(), a thread, or an ossia score
process. Provides current_value() (position). Header-only, doubles only, no
STL/Boost.

Includes an Arduino example, README entry, and Catch2 tests covering
position/velocity/direction, re-touch jump suppression, and tap detection
vs long/large touches.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0163cH7Znu2oYvnaP7fTEQMN
Follow the one-cpp-per-descriptor layout requested in review (#118): put the
Ribbon test cases in tests/descriptors/ribbon.cpp and register it in the
test_descriptors executable, instead of appending to the monolithic
test_descriptors.cpp. No test logic changed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0163cH7Znu2oYvnaP7fTEQMN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant