Skip to content

tai-studio/senselosc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

senselosc

2020, LFSaw (interaction | music)

An OSC interface for the sensel morph. Exposes contact information for up to 16 regions of the sensel morph using the Sensel API.

ko-fi

Requirements

  • a sensel morph
  • system-wide installed sensel API (in /usr/local) to compile.
  • installed boost
  • git
  • internet connection (for downloading additional dependency libs (fmt) at configuration time)

Usage

cli program in

build/apps/senselosc

SuperCollider

Morph is a reference implementation of the OSC interface for SuperCollider. It is also available through the SuperColider-internal Quarks package management system.

OSC interface

5 message types

/contactAvg index num_contacts x y avg_force avg_dist area x_w y_w total_force avg_wdist
/contact index id state x y force area dist wdist orientation  major_axis  minor_axis
/contactDelta index id state delta_x delta_y delta_force delta_area
/contactBB index id state min_x min_y max_x max_y
/contactPeak index id state peak_x peak_y peak_force
/sync index updated_0 ... updated_15

contactAvg

/contactAvg index num_contacts x y avg_force avg_dist area x_w y_w total_force avg_wdist

Average values for all currently registered contacts. If messages are sent in bundles, this message precedes the messages for the individual contacts. If no contacts are detected, a message with num_contacts = 0 is sent once.

index           [int]   device index (currently always 0)
num_contacts    [int]   number of contacts
x               [float] average x-coordinate over all contacts in [mm]
y               [float] average y-coordinate over all contacts in [mm]
avg_force       [float] average pressure applied [g] 
avg_dist        [float] distance to average position [mm]
area            [int]   covered area [sensels]
w_x             [float] force-weigthed average x-coordinate over all contacts in [mm]
w_y             [float] force-weigthed average y-coordinate over all contacts in [mm]
total_force     [float] sum of pressure applied [g] 
avg_wdist       [float] distance to force-weighted average position [mm]

contact

Basic values for each registered contact.

/contact index id state x y force area dist wdist orientation  major_axis  minor_axis
index           [int]   device index (currently always 0)
id              [int]   contact id (0..15)
state           [int]   one of invalid(0), start(1), move(2), end(3) 
x               [float] x-coordinate in [mm]
y               [float] y-coordinate in [mm]
force           [float] sum of pressure applied [g] 
area            [int]   covered area [sensels]
dist            [float] distance to average position [mm]
wdist           [float] distance to weighted average position [mm]
orientation     [float] orientation of bounding elipsis [deg] (0..360)
major_axis      [float] major axis length of bounding elipsis [mm]
minor_axis      [float] minor axis length of bounding elipsis [mm]

contactDelta

Delta-values for each registered contact.

/contactDelta index id state delta_x delta_y delta_force delta_area
index           [int]   device index (currently always 0)
id              [int]   contact id (0..15)
state           [int]   one of invalid(0), start(1), move(2), end(3) 
num_contacts    [int]   number of contacts
delta_x         [float] x displacement [mm]
delta_y         [float] y displacement [mm]
delta_force     [float] change of force [g]
delta_area      [int]   change of covered area [sensels]

contactBB

A bounding box for each registered contact.

/contactBB index id state min_x min_y max_x max_y
index           [int]   device index (currently always 0)
id              [int]   contact id (0..15)
state           [int]   one of invalid(0), start(1), move(2), end(3) 
min_x           [float] upper-left x-coordinate of bounding-box [mm] 
min_y           [float] upper-left y-coordinate of bounding-box [mm] 
max_x           [float] lower-right x-coordinate of bounding-box [mm] 
max_y           [float] lower-right y-coordinate of bounding-box [mm] 

contactPeak

Peak values for each registered contact.

/contactPeak index id state peak_x peak_y peak_force
index           [int]   device index (currently always 0)
id              [int]   contact id (0..15)
state           [int]   one of invalid(0), start(1), move(2), end(3) 
peak_x          [float] x-coordinate of pressure peak [mm]
peak_y          [float] y-coordinate of pressure peak [mm]
peak_force      [float] force at pressure peak [g]

sync

Each processed frame of updated information is concluded by a sync message that can be used to update functionality using all sent values.

/sync index updated_0 ... updated_15
index           [int]   device index (currently always 0)
updated_X       [int]   1 if contact id was updated, 0 otherwise

Compilation

The requirements for compilation are

  • CMake >= 3.14
  • A C++17 compatible compiler
  • Git

This repository contains oscpack as a submodule. To install with this dependency, clone the repository with

git clone --recursive https://github.com/tai-studio/senselosc

Alternatively, you can update the submodule (after cloning) with

git submodule update --init --recursive

To configure

cmake -S . -B build

To build

cmake --build build

To test ( --target can be written as -t in CMake 3.15+)

cmake --build build --target test

To build docs (requires Doxygen, output in build/docs/html)

cmake --build build --target docs

To use an IDE, such as Xcode (untested)

cmake -S . -B xbuild -GXcode
cmake --open xbuild

Thanks

Thanks go to Ross Bencina (@RossBencina) for his awesome oscpack library (here in an adapted form with a compatible cmake structure), and Henry Schreiner et. al. for a comprehensive and wonderfully written guide on how to structure a cmake-based build system. Also of course to the sensel team for their decision to not only create a powerful API but also make it open source.

If you find this useful, you can buy me a coffee if you like, or purchase some of my albums.