@ircam/comote-helpers 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,45 @@
1
+ # Zip and release Max package on new version
2
+
3
+ name: CI
4
+
5
+ # Controls when the action will run.
6
+ on:
7
+ # Triggers the workflow on push or pull request events but only for the master branch
8
+ push:
9
+ # Sequence of patterns matched against refs/tags
10
+ tags:
11
+ - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
12
+
13
+ # Allows you to run this workflow manually from the Actions tab
14
+ workflow_dispatch:
15
+
16
+ jobs:
17
+ build:
18
+ name: Upload Release Asset
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Checkout code
22
+ uses: actions/checkout@v2
23
+ - name: Build project # This would actually build your project, using zip for an example artifact
24
+ run: |
25
+ (cd max && zip -r - comote) > comote-for-max.zip
26
+ - name: Create Release
27
+ id: create_release
28
+ uses: actions/create-release@v1
29
+ env:
30
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31
+ with:
32
+ tag_name: ${{ github.ref }}
33
+ release_name: Release ${{ github.ref }}
34
+ draft: false
35
+ prerelease: false
36
+ - name: Upload Release Asset
37
+ id: upload-release-asset
38
+ uses: actions/upload-release-asset@v1
39
+ env:
40
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41
+ with:
42
+ upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
43
+ asset_path: ./comote-for-max.zip
44
+ asset_name: comote-for-max.zip
45
+ asset_content_type: application/zip
package/README.md CHANGED
@@ -3,37 +3,54 @@
3
3
  > Javascript and Max/MSP utilities to create applications compatible with iPhone
4
4
  > and Android `CoMo.te` application.
5
5
 
6
+
7
+ The CoMo.te application (iOS and Android) allows for streaming motion data (accelerometer, gyroscope) from the smartphone to desktop applications using either the OSC or Websockets protocols. The network's setup is facilitated by the use of a QR code generated by the targeted remote application receiving the motion sensor data.
8
+
9
+ CoMo.te is especially designed for the CoMo applications family that enables real-time interaction between gestures/movements and sounds. Nevertheless, the CoMo.te application can be used with any software that makes use of the OSC protocol.
10
+
11
+ Among the CoMo applications that make use of CoMo.te are CoMo-Vox to learn and train conducting gestures, and CoMo-Elements to interact collectively thought body movements with recorded sounds.
12
+
13
+ CoMo.te and the CoMo applications are software designed and developed by IRCAM in the Sound-Music-Movement-Interaction team (UMR STMS).
14
+
15
+ This repository provides utilities to help to generate the QRCode in the target application both for Max/MSP and Node.js
16
+
6
17
  ## Table of Contents
7
18
 
8
19
  <!-- toc -->
9
20
 
10
- - [Install](#install)
11
- - [API](#api)
12
- * [Classes](#classes)
13
- * [Functions](#functions)
14
- * [Typedefs](#typedefs)
15
- * [getWifiInfos() ⇒ WiFiInfos \| null](#getwifiinfos-%E2%87%92-wifiinfos--null)
16
- * [rawLink()](#rawlink)
17
- * [terminal(config)](#terminalconfig)
18
- * [dataURL(config)](#dataurlconfig)
19
- * [WifiInfos : Object](#wifiinfos--object)
20
- * [CoMoteConfig : Object](#comoteconfig--object)
21
- * [CoMoteTarget : Object](#comotetarget--object)
21
+ - [Max/MSP](#maxmsp)
22
+ - [JS](#js)
23
+ * [Node.js](#nodejs)
24
+ * [API](#api)
22
25
  - [License](#license)
23
26
 
24
27
  <!-- tocstop -->
25
28
 
26
- ## Install
29
+ ## Max/MSP
30
+
31
+ Download the Max abstraction (SoundworksAPI.zip) from the releases page: https://github.com/ircam-ismm/comote-helpers/releases
32
+ Unzip the package and copy the resulting directory in `~/Documents/Max 8/Packages`
33
+
34
+ For now, the package only provide abstraction `[comote.connect]` that allows you to generate a QRCode that can be
35
+ flashed within the CoMo.te application to configure the OSC stream.
36
+
37
+ You can find more informations in the Helper patch: `~/Document/Max 8/Packages/CoMo.te/extras/CoMo.te.maxpat`
38
+
39
+ This version requires Max 7.1 or higher.
40
+
41
+ ## JS
42
+
43
+ ### Node.js
27
44
 
28
45
  ```sh
29
46
  npm install --save @ircam/comote-helpers
30
47
  ```
31
48
 
32
- ## JS API
49
+ ### API
33
50
 
34
51
  <!-- api -->
35
52
 
36
- ### Classes
53
+ #### Classes
37
54
 
38
55
  <dl>
39
56
  <dt><a href="#Server">Server</a></dt>
@@ -41,13 +58,9 @@ npm install --save @ircam/comote-helpers
41
58
  </dd>
42
59
  </dl>
43
60
 
44
- ### Functions
61
+ #### Functions
45
62
 
46
63
  <dl>
47
- <dt><a href="#getWifiInfos">getWifiInfos()</a> ⇒ <code>WiFiInfos</code> | <code>null</code></dt>
48
- <dd><p>Retrieve the SSID and related IP of the first WiFi connection found, return
49
- <code>null</code> if no WiFi connection found.</p>
50
- </dd>
51
64
  <dt><a href="#rawLink">rawLink()</a></dt>
52
65
  <dd><p>Return the link to be encoded in the QRCode accroding to given <code>CoMoteConfig</code></p>
53
66
  </dd>
@@ -59,33 +72,24 @@ npm install --save @ircam/comote-helpers
59
72
  </dd>
60
73
  </dl>
61
74
 
62
- ### Typedefs
75
+ #### Typedefs
63
76
 
64
77
  <dl>
65
- <dt><a href="#WifiInfos">WifiInfos</a> : <code>Object</code></dt>
66
- <dd></dd>
67
78
  <dt><a href="#CoMoteConfig">CoMoteConfig</a> : <code>Object</code></dt>
68
79
  <dd></dd>
69
80
  <dt><a href="#CoMoteTarget">CoMoteTarget</a> : <code>Object</code></dt>
70
81
  <dd></dd>
71
82
  </dl>
72
83
 
73
- <a name="getWifiInfos"></a>
74
-
75
- ### getWifiInfos() ⇒ <code>WiFiInfos</code> \| <code>null</code>
76
- Retrieve the SSID and related IP of the first WiFi connection found, return
77
- `null` if no WiFi connection found.
78
-
79
- **Kind**: global function
80
84
  <a name="rawLink"></a>
81
85
 
82
- ### rawLink()
86
+ #### rawLink()
83
87
  Return the link to be encoded in the QRCode accroding to given `CoMoteConfig`
84
88
 
85
89
  **Kind**: global function
86
90
  <a name="terminal"></a>
87
91
 
88
- ### terminal(config)
92
+ #### terminal(config)
89
93
  Create a qrcode to be logged in terminal according to given `CoMoteConfig``
90
94
 
91
95
  **Kind**: global function
@@ -96,11 +100,11 @@ Create a qrcode to be logged in terminal according to given `CoMoteConfig``
96
100
 
97
101
  **Example**
98
102
  ```js
99
- console(CoMoteQRCode.terminal(config));
103
+ console(await CoMoteQRCode.terminal(config));
100
104
  ```
101
105
  <a name="dataURL"></a>
102
106
 
103
- ### dataURL(config)
107
+ #### dataURL(config)
104
108
  Create a qrcode to be used as in Image source according to given `CoMoteConfig``
105
109
 
106
110
  **Kind**: global function
@@ -111,22 +115,13 @@ Create a qrcode to be used as in Image source according to given `CoMoteConfig``
111
115
 
112
116
  **Example**
113
117
  ```js
114
- <img src="${CoMoteQRCode.dataURL(config))}" />
115
- ```
116
- <a name="WifiInfos"></a>
117
-
118
- ### WifiInfos : <code>Object</code>
119
- **Kind**: global typedef
120
- **Properties**
121
-
122
- | Name | Type | Description |
123
- | --- | --- | --- |
124
- | ssid | <code>number</code> | SSID of the WiFi connection |
125
- | ip | <code>number</code> | Related IP (IPV4) |
118
+ const qrCode = await CoMoteQRCode.dataURL(config));
126
119
 
120
+ <img src="${qrCode}" />
121
+ ```
127
122
  <a name="CoMoteConfig"></a>
128
123
 
129
- ### CoMoteConfig : <code>Object</code>
124
+ #### CoMoteConfig : <code>Object</code>
130
125
  **Kind**: global typedef
131
126
  **Properties**
132
127
 
@@ -139,7 +134,7 @@ Create a qrcode to be used as in Image source according to given `CoMoteConfig``
139
134
 
140
135
  <a name="CoMoteTarget"></a>
141
136
 
142
- ### CoMoteTarget : <code>Object</code>
137
+ #### CoMoteTarget : <code>Object</code>
143
138
  **Kind**: global typedef
144
139
  **Properties**
145
140
 
@@ -152,6 +147,12 @@ Create a qrcode to be used as in Image source according to given `CoMoteConfig``
152
147
 
153
148
  <!-- apistop -->
154
149
 
150
+ ## Credits
151
+
152
+ CoMo.te is developed by Ircam and the Music and Sound Science and Technology Joint Research Unit (STMS), supported by Ircam, CNRS, the French Ministry of Culture and Sorbonne University.
153
+
154
+ Produced with the support of the French Ministry of Education, Youth and Sports (Edu-up system), the National Research Agency (ELEMENT project), and in partnership with Radio France.
155
+
155
156
  ## License
156
157
 
157
158
  BSD-3-Clause
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ircam/comote-helpers",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Server component & utilities for the CoMo.te application",
5
5
  "authors": [
6
6
  "Benjamin.Matuszewski@ircam.fr",
@@ -15,7 +15,7 @@
15
15
  "access": "public"
16
16
  },
17
17
  "scripts": {
18
- "api": "jsdoc-to-readme --src src/server.js src/qrcode.js",
18
+ "api": "jsdoc-to-readme --src src/server.js src/qrcode.js --heading-depth 4",
19
19
  "build": "npm run clean && babel src --out-dir .",
20
20
  "clean": "rm -f server.js qrcode.js",
21
21
  "dev": "npm run build && chokidar src -c \"npm run build\"",
package/qrcode.js CHANGED
@@ -15,7 +15,7 @@ function formatConfigToLink(config) {
15
15
  let link = `comote://settings?`;
16
16
  const query = [];
17
17
 
18
- if (Number.isFinite(config.id) && config.id >= 0) {
18
+ if ('id' in config) {
19
19
  query.push(`id=${config.id}`);
20
20
  }
21
21
 
@@ -25,15 +25,30 @@ function formatConfigToLink(config) {
25
25
 
26
26
  if (config.ws) {
27
27
  const {
28
+ protocol,
28
29
  hostname,
29
- port
30
- } = config.ws;
30
+ port,
31
+ pathname
32
+ } = config.ws; // build valid url
33
+ // only hostname is required
31
34
 
32
- if (!hostname || !Number.isInteger(port)) {
35
+ if (!hostname) {
33
36
  throw new Error(`Invalid WebSocket config: ${config.ws}`);
34
37
  }
35
38
 
36
- query.push(`ws-url=ws://${hostname}:${port}`);
39
+ let url = `ws-url=`;
40
+ url += protocol == 'ws' || protocol == 'wss' ? `${protocol}://` : `ws://`;
41
+ url += hostname;
42
+
43
+ if (port) {
44
+ url += `:${port}`;
45
+ }
46
+
47
+ if (pathname) {
48
+ url += pathname;
49
+ }
50
+
51
+ query.push(url); // autostart
37
52
 
38
53
  if (config.ws.autostart === true) {
39
54
  query.push(`ws-enable=1`);