nodeskini 1.0.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.
Files changed (215) hide show
  1. package/README.md +31 -0
  2. package/client/archive/bundle.js +11528 -0
  3. package/client/archive/golem.html +60 -0
  4. package/client/archive/golemClient.js +595 -0
  5. package/client/archive/golembundle.js +11634 -0
  6. package/client/archive/sequencer.html +43 -0
  7. package/client/archive/sequenceurClient.js +815 -0
  8. package/client/archive/stylegolem.css +158 -0
  9. package/client/archive/stylesequenceur.css +204 -0
  10. package/client/clientListe/Sortable-master/.circleci/config.yml +33 -0
  11. package/client/clientListe/Sortable-master/.editorconfig +15 -0
  12. package/client/clientListe/Sortable-master/.github/ISSUE_TEMPLATE/bug-report.md +73 -0
  13. package/client/clientListe/Sortable-master/.github/ISSUE_TEMPLATE/custom-template.md +48 -0
  14. package/client/clientListe/Sortable-master/.github/ISSUE_TEMPLATE/feature-request.md +41 -0
  15. package/client/clientListe/Sortable-master/.jshintrc +25 -0
  16. package/client/clientListe/Sortable-master/.testcaferc.json +7 -0
  17. package/client/clientListe/Sortable-master/CONTRIBUTING.md +26 -0
  18. package/client/clientListe/Sortable-master/LICENSE +21 -0
  19. package/client/clientListe/Sortable-master/README.md +813 -0
  20. package/client/clientListe/Sortable-master/Sortable.js +3709 -0
  21. package/client/clientListe/Sortable-master/Sortable.min.js +2 -0
  22. package/client/clientListe/Sortable-master/Sortable.min.old.js +2 -0
  23. package/client/clientListe/Sortable-master/Sortable.min.old.old.js +2 -0
  24. package/client/clientListe/Sortable-master/babel.config.js +27 -0
  25. package/client/clientListe/Sortable-master/bower.json +30 -0
  26. package/client/clientListe/Sortable-master/entry/entry-complete.js +8 -0
  27. package/client/clientListe/Sortable-master/entry/entry-core.js +19 -0
  28. package/client/clientListe/Sortable-master/entry/entry-defaults.js +19 -0
  29. package/client/clientListe/Sortable-master/index.html +460 -0
  30. package/client/clientListe/Sortable-master/modular/sortable.complete.esm.js +3701 -0
  31. package/client/clientListe/Sortable-master/modular/sortable.core.esm.js +3698 -0
  32. package/client/clientListe/Sortable-master/modular/sortable.esm.js +3699 -0
  33. package/client/clientListe/Sortable-master/package-lock.json +5704 -0
  34. package/client/clientListe/Sortable-master/package.json +56 -0
  35. package/client/clientListe/Sortable-master/plugins/AutoScroll/AutoScroll.js +270 -0
  36. package/client/clientListe/Sortable-master/plugins/AutoScroll/README.md +80 -0
  37. package/client/clientListe/Sortable-master/plugins/AutoScroll/index.js +1 -0
  38. package/client/clientListe/Sortable-master/plugins/MultiDrag/MultiDrag.js +617 -0
  39. package/client/clientListe/Sortable-master/plugins/MultiDrag/README.md +96 -0
  40. package/client/clientListe/Sortable-master/plugins/MultiDrag/index.js +1 -0
  41. package/client/clientListe/Sortable-master/plugins/OnSpill/OnSpill.js +79 -0
  42. package/client/clientListe/Sortable-master/plugins/OnSpill/README.md +60 -0
  43. package/client/clientListe/Sortable-master/plugins/OnSpill/index.js +1 -0
  44. package/client/clientListe/Sortable-master/plugins/README.md +178 -0
  45. package/client/clientListe/Sortable-master/plugins/Swap/README.md +55 -0
  46. package/client/clientListe/Sortable-master/plugins/Swap/Swap.js +90 -0
  47. package/client/clientListe/Sortable-master/plugins/Swap/index.js +1 -0
  48. package/client/clientListe/Sortable-master/scripts/banner.js +8 -0
  49. package/client/clientListe/Sortable-master/scripts/build.js +17 -0
  50. package/client/clientListe/Sortable-master/scripts/esm-build.js +28 -0
  51. package/client/clientListe/Sortable-master/scripts/minify.js +11 -0
  52. package/client/clientListe/Sortable-master/scripts/test-compat.js +30 -0
  53. package/client/clientListe/Sortable-master/scripts/test.js +21 -0
  54. package/client/clientListe/Sortable-master/scripts/umd-build.js +15 -0
  55. package/client/clientListe/Sortable-master/src/Animation.js +175 -0
  56. package/client/clientListe/Sortable-master/src/BrowserInfo.js +12 -0
  57. package/client/clientListe/Sortable-master/src/EventDispatcher.js +57 -0
  58. package/client/clientListe/Sortable-master/src/PluginManager.js +87 -0
  59. package/client/clientListe/Sortable-master/src/Sortable.js +1971 -0
  60. package/client/clientListe/Sortable-master/src/utils.js +556 -0
  61. package/client/clientListe/Sortable-master/st/app.js +224 -0
  62. package/client/clientListe/Sortable-master/st/iframe/frame.html +32 -0
  63. package/client/clientListe/Sortable-master/st/iframe/index.html +49 -0
  64. package/client/clientListe/Sortable-master/st/logo.png +0 -0
  65. package/client/clientListe/Sortable-master/st/og-image.png +0 -0
  66. package/client/clientListe/Sortable-master/st/prettify/prettify.css +1 -0
  67. package/client/clientListe/Sortable-master/st/prettify/prettify.js +46 -0
  68. package/client/clientListe/Sortable-master/st/prettify/run_prettify.js +64 -0
  69. package/client/clientListe/Sortable-master/st/saucelabs.svg +1 -0
  70. package/client/clientListe/Sortable-master/st/theme.css +254 -0
  71. package/client/clientListe/Sortable-master/tests/Sortable.compat.test.js +39 -0
  72. package/client/clientListe/Sortable-master/tests/Sortable.test.js +386 -0
  73. package/client/clientListe/Sortable-master/tests/dual-list.html +34 -0
  74. package/client/clientListe/Sortable-master/tests/empty-list.html +30 -0
  75. package/client/clientListe/Sortable-master/tests/filter.html +27 -0
  76. package/client/clientListe/Sortable-master/tests/handles.html +27 -0
  77. package/client/clientListe/Sortable-master/tests/nested.html +67 -0
  78. package/client/clientListe/Sortable-master/tests/single-list.html +25 -0
  79. package/client/clientListe/Sortable-master/tests/style.css +18 -0
  80. package/client/clientListe/clientListe.html +148 -0
  81. package/client/clientListe/clientListe.js +1508 -0
  82. package/client/clientListe/clientListebundle.js +13164 -0
  83. package/client/clientListe/images/poubelle.png +0 -0
  84. package/client/clientListe/images/start.png +0 -0
  85. package/client/clientListe/images/stop.png +0 -0
  86. package/client/clientListe/images/submit.png +0 -0
  87. package/client/clientListe/sortable-theme-bootstrap.css +90 -0
  88. package/client/configurateur/configReact.js +273 -0
  89. package/client/configurateur/configReactbundle.js +295 -0
  90. package/client/configurateur/configurateur.css +95 -0
  91. package/client/configurateur/configurateur.html +48 -0
  92. package/client/configurateur/lib/jexcel.css +755 -0
  93. package/client/configurateur/lib/jexcel.js +14970 -0
  94. package/client/configurateur/lib/jsuites.css +2801 -0
  95. package/client/configurateur/lib/jsuites.js +11822 -0
  96. package/client/configurateur/lib/react-dom.production.min.js +239 -0
  97. package/client/configurateur/lib/react.production.min.js +32 -0
  98. package/client/configurateur/src/configReact.js +247 -0
  99. package/client/controleur/clientcontroleur.js +536 -0
  100. package/client/controleur/clientcontroleur.test.js +282 -0
  101. package/client/controleur/controleur.html +51 -0
  102. package/client/controleur/controleurbundle.js +565 -0
  103. package/client/controleur/stylecontroleur.css +236 -0
  104. package/client/controleurHH/controleurHH.html +71 -0
  105. package/client/controleurHH/controleurHH.js +252 -0
  106. package/client/controleurHH/styles/index.css +320 -0
  107. package/client/controleurHH/styles/material.css +11552 -0
  108. package/client/parametrage/paramReact.js +473 -0
  109. package/client/parametrage/paramReactbundle.js +500 -0
  110. package/client/parametrage/parametrage.css +111 -0
  111. package/client/parametrage/parametrage.html +163 -0
  112. package/client/parametrage/src/paramReact.js +459 -0
  113. package/client/score/hash.js +83 -0
  114. package/client/score/p5.min.js +3 -0
  115. package/client/score/parto1.js +1171 -0
  116. package/client/score/parto1bundle.js +1181 -0
  117. package/client/score/processing.min.js +431 -0
  118. package/client/score/score.html +15 -0
  119. package/client/score/score.js +34 -0
  120. package/client/simulateurListe/simulateurFork.js +750 -0
  121. package/client/simulateurListe/simulateurFork.mjs +681 -0
  122. package/client/simulateurListe/simulateurForkSansReorg.js +569 -0
  123. package/client/simulateurListe/simulateurListe.js +628 -0
  124. package/myReact/archive/Nodeemitvaluedlocal1.hh.js +52 -0
  125. package/myReact/archive/abort-parNode.js +79 -0
  126. package/myReact/archive/abroNode.js +169 -0
  127. package/myReact/archive/abroNode2.js +80 -0
  128. package/myReact/archive/atom.compile.hh.js +51 -0
  129. package/myReact/archive/await-countNode.js +67 -0
  130. package/myReact/archive/await-nowvalNode.js +44 -0
  131. package/myReact/archive/callHH.js +96 -0
  132. package/myReact/archive/emit-if2.hh.compiled.js +113 -0
  133. package/myReact/archive/every1Node.js +35 -0
  134. package/myReact/archive/if-runNode.js +74 -0
  135. package/myReact/archive/if1Node.js +43 -0
  136. package/myReact/archive/makeawait.js +0 -0
  137. package/myReact/archive/myReact.old.js +684 -0
  138. package/myReact/archive/orchestration.js +281 -0
  139. package/myReact/archive/orchestration1.js +132 -0
  140. package/myReact/archive/orchestration1.xml +465 -0
  141. package/myReact/archive/orchestration2.js +161 -0
  142. package/myReact/archive/orchestrationHH.mano.js +280 -0
  143. package/myReact/archive/orchestrationHHTest.js +428 -0
  144. package/myReact/archive/orchestrationHHTest.xml +234 -0
  145. package/myReact/archive/orchestrationHHTestRun.js +104 -0
  146. package/myReact/archive/orchestrationHHTestRun.xml +34 -0
  147. package/myReact/archive/orchestrationTest0.js +178 -0
  148. package/myReact/archive/orchestrationTest1.js +181 -0
  149. package/myReact/archive/orchestrationTest2.js +281 -0
  150. package/myReact/archive/run3pointsNode.js +59 -0
  151. package/myReact/archive/runNode.js +123 -0
  152. package/myReact/archive/runNode2.js +91 -0
  153. package/myReact/archive/testAwait1.js +141 -0
  154. package/myReact/archive/testAwait1.xml +86 -0
  155. package/myReact/archive/testEvery1.js +122 -0
  156. package/myReact/archive/testEvery1.xml +79 -0
  157. package/myReact/archive/testHH1.js +135 -0
  158. package/myReact/archive/testHH1.xml +86 -0
  159. package/myReact/archive/testHH1revu.js +104 -0
  160. package/myReact/archive/testHH2.js +122 -0
  161. package/myReact/archive/testHH2.xml +79 -0
  162. package/myReact/archive/testHH3.js +130 -0
  163. package/myReact/archive/testHH3.xml +86 -0
  164. package/myReact/archive/testHHabort.js +121 -0
  165. package/myReact/archive/testHHabort.xml +83 -0
  166. package/myReact/archive/testMakeawait.js +202 -0
  167. package/myReact/archive/testRun1.js +168 -0
  168. package/myReact/archive/testRun1.xml +142 -0
  169. package/myReact/archive/titi.js +28 -0
  170. package/myReact/archive/titi.xml +110 -0
  171. package/myReact/archive/toto.js +73 -0
  172. package/myReact/archive/toto.xml +198 -0
  173. package/myReact/archive/trap-await-parallelNode.js +123 -0
  174. package/myReact/inutiles/hiver2022.xml +804 -0
  175. package/myReact/inutiles/hopeNode.xml +459 -0
  176. package/myReact/inutiles/mars2022.xml +871 -0
  177. package/myReact/inutiles/mystique1.xml +318 -0
  178. package/myReact/inutiles/mystiqueOSC.xml +277 -0
  179. package/myReact/inutiles/opus5Node.xml +1271 -0
  180. package/myReact/inutiles/opus5NodeLinux.xml +1241 -0
  181. package/myReact/inutiles/orchestrationHH.xml +541 -0
  182. package/myReact/inutiles/orchestrationHH2.xml +547 -0
  183. package/myReact/inutiles/testHH.xml +95 -0
  184. package/myReact/inutiles/trouveLaPercuTenor.xml +349 -0
  185. package/myReact/myReact.js +744 -0
  186. package/myReact/myReact.min.js +1 -0
  187. package/myReact/orchestrationHH.js +311 -0
  188. package/myReact/orchestrationHH.mjs +436 -0
  189. package/myReact/orchestrationHH.mjs.map +1 -0
  190. package/package.json +46 -0
  191. package/serveur/OSCandMidi.mjs +361 -0
  192. package/serveur/computeScore.mjs +415 -0
  193. package/serveur/controleDAW.mjs +1149 -0
  194. package/serveur/defaultSession.csv +2 -0
  195. package/serveur/defaultSkiniParametres.js +119 -0
  196. package/serveur/gameOSC.mjs +96 -0
  197. package/serveur/groupeClientsSons.mjs +1014 -0
  198. package/serveur/ipConfig.json +24 -0
  199. package/serveur/ipConfig127.json +19 -0
  200. package/serveur/ipConfig75.json +17 -0
  201. package/serveur/ipConfigBH.json +19 -0
  202. package/serveur/ipConfigLocal.json +19 -0
  203. package/serveur/midiConfig.json +26 -0
  204. package/serveur/midiConfigBH.json +26 -0
  205. package/serveur/midiConfigVoid.json +3 -0
  206. package/serveur/midimix.mjs +570 -0
  207. package/serveur/saveParam.mjs +159 -0
  208. package/serveur/skiniParametres.good.js +132 -0
  209. package/serveur/skiniParametres.js +106 -0
  210. package/serveur/utilsHHSkini.hh.js +64 -0
  211. package/serveur/utilsSkini.mjs +137 -0
  212. package/serveur/websocketServer.mjs +2052 -0
  213. package/serveur/workerInterfaceZ.mjs +327 -0
  214. package/serveur/workerSynchro.mjs +49 -0
  215. package/skini.mjs +141 -0
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "nodeskini",
3
+ "version": "1.0.0",
4
+ "description": "Skini Tools for Interactive and Generative Music",
5
+ "main": "skini.mjs",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "contrhh": "node scripts/contrhh-cli.mjs --port 8080"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "ssh://srv-indes/user/berpetit/home/nodeskini.git"
13
+ },
14
+ "author": "Bertrand Petit-Hédelin",
15
+ "license": "GNU3.0",
16
+ "dependencies": {
17
+ "@hop/hiphop": "https://www-sop.inria.fr/members/Manuel.Serrano/software/npmx/hiphop-unstable.tgz",
18
+ "abletonlink": "^0.2.0-beta.0",
19
+ "babel-cli": "^6.26.0",
20
+ "babel-preset-react-app": "^3.1.2",
21
+ "browserify": "^17.0.0",
22
+ "csv-array": "^0.0.22",
23
+ "express": "^4.17.1",
24
+ "jazz-midi": "^1.7.9",
25
+ "jzz": "^1.5.0",
26
+ "jzz-midi-smf": "^1.8.3",
27
+ "midi": "^2.0.0",
28
+ "node-wav-player": "^0.2.0",
29
+ "osc-min": "^1.1.2",
30
+ "ws": "^7.4.5"
31
+ },
32
+ "devDependencies": {
33
+ "decache": "^4.6.0"
34
+ },
35
+ "files": [
36
+ "skini.mjs",
37
+ "serveur/",
38
+ "client/",
39
+ "myReact/"
40
+ ],
41
+ "directories": {
42
+ "doc": "doc",
43
+ "test": "tests"
44
+ },
45
+ "keywords": []
46
+ }
@@ -0,0 +1,361 @@
1
+ /**
2
+ * @fileOverview OSC and Midi control
3
+ * <BR> See: http://www.indiana.edu/~emusic/cntrlnumb.html,
4
+ * http://www.ccarh.org/courses/253/handout/controllers/
5
+ * @copyright (C) 2022-2024 Bertrand Petit-Hédelin
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ * @author Bertrand Petit-Hédelin <bertrand@hedelin.fr>
20
+ * @version 1.4
21
+ */
22
+ "use strict"
23
+ import { createRequire } from 'module';
24
+ const require = createRequire(import.meta.url);
25
+
26
+ var osc = require('osc-min');
27
+ import * as dgram from "dgram";
28
+ var udp = dgram.createSocket("udp4");
29
+
30
+ // Pour permettre le broadcast depuis node.js
31
+ udp.bind(function () { udp.setBroadcast(true); });
32
+
33
+ // Appelé à la fois par setParameters et reloadParameters dans websocketServer.js
34
+ // donc attention à startOSCandMIDI() et les variables globales.
35
+ var par;
36
+ export function setParameters(parameters) {
37
+ par = parameters;
38
+ startOSCandMIDI();
39
+ }
40
+
41
+ var ipConfig = require('./ipConfig');
42
+
43
+ var outportForMIDI = ipConfig.OutPortOSCMIDItoDAW;
44
+ var outportProcessing = ipConfig.outportProcessing;
45
+ var remoteIPAddressSound = ipConfig.remoteIPAddressSound;
46
+ var remoteIPAddressImage = ipConfig.remoteIPAddressImage;
47
+ var outportLumiere = ipConfig.outportLumiere;
48
+ var remoteIPAddressLumiere = ipConfig.remoteIPAddressLumiere;
49
+
50
+ var _getMidiPortClipToDAW, _initMidiOUT, _getMidiPortForClipToDAW;
51
+
52
+ export{
53
+ _initMidiOUT as initMidiOUT,
54
+ _getMidiPortClipToDAW as getMidiPortClipToDAW
55
+ }
56
+
57
+ var debug = false;
58
+ var debug1 = true;
59
+ var midiPortClipToDAW;
60
+ var directMidi = false;
61
+ var midiOutput;
62
+
63
+ // Pour commande direct de Skini en MIDI sans passer par une passerelle ====================
64
+ function startOSCandMIDI() {
65
+ // Par défaut on communique en OSC avec la DAW ou la passerelle
66
+ if (par.directMidiON !== undefined) {
67
+ directMidi = par.directMidiON;
68
+ }
69
+ if (directMidi) {
70
+ if (debug) console.log("OSCandMidi: commande MIDI depuis Skini");
71
+
72
+ var midiConfig = require("./midiConfig.json");
73
+ if(midiConfig[0] === undefined ){
74
+ console.log("WARN: Midi direct is ON, but no midi interfaces are declared in midiConfig.json");
75
+ return -1;
76
+ }
77
+
78
+ var midi = require('midi');
79
+
80
+ // Il ne faut pas recréer midiOutput, mais ceci sera à revoir
81
+ // si on veut changer de configuration Midi en cours de session
82
+ if (midiOutput === undefined) {
83
+ midiOutput = new midi.Output();
84
+ }
85
+
86
+ function getMidiPortForClipToDAW() {
87
+ for (var i = 0; i < midiConfig.length; i++) {
88
+ if (midiConfig[i].spec === "clipToDAW") {
89
+ for (var j = 0; j < midiOutput.getPortCount(); ++j) {
90
+ if (midiOutput.getPortName(j) === midiConfig[i].name) {
91
+ if (debug1) console.log("INFO: OSCandMIDI: getMidiPortForClipToDAW: Midi" +
92
+ midiConfig[i].type + ", usage:" + midiConfig[i].spec +
93
+ ", bus: " + midiOutput.getPortName(j) + ", " + midiConfig[i].comment);
94
+ return j;
95
+ }
96
+ }
97
+ }
98
+ }
99
+ return -1;
100
+ }
101
+ _getMidiPortForClipToDAW = getMidiPortForClipToDAW;
102
+ }
103
+
104
+ /**
105
+ * Initialise the Midi port according the configuration file
106
+ */
107
+ function initMidiOUT() {
108
+ midiPortClipToDAW = _getMidiPortForClipToDAW();
109
+
110
+ if (midiPortClipToDAW === -1) {
111
+ console.log("------------------------------------------------------")
112
+ console.log("ERR: initMidiOUT: no Midi port for controlling the DAW");
113
+ for (var j = 0; j < midiOutput.getPortCount(); ++j) {
114
+ console.log("INFO: initMidiOUT: Midi port available :" + midiOutput.getPortName(j));
115
+ }
116
+ console.log("------------------------------------------------------")
117
+ return;
118
+ }
119
+
120
+ midiOutput.openPort(midiPortClipToDAW);
121
+ if (debug1) console.log("INFO: OSCandMidi.js: initMidiOUT: midiPortClipToDAW ", midiPortClipToDAW, midiOutput.getPortName(midiPortClipToDAW));
122
+ }
123
+ _initMidiOUT = initMidiOUT;
124
+
125
+ function getMidiPortClipToDAW() {
126
+ return midiPortClipToDAW;
127
+ }
128
+ _getMidiPortClipToDAW = getMidiPortClipToDAW;
129
+ }
130
+
131
+ // VERS PROCESSING ==================================================
132
+ /**
133
+ * Send an OSC message to processing
134
+ * @param {string} message
135
+ * @param {number} value
136
+ */
137
+ export function sendProcessing(message, value) {
138
+ var buf;
139
+
140
+ if (debug) console.log("OSCandMidi: sends osc to processing :" + message + " " + value + " to " + outportProcessing);
141
+ buf = osc.toBuffer({ address: message, args: [value] });
142
+ return udp.send(buf, 0, buf.length, outportProcessing, remoteIPAddressImage);
143
+ };
144
+
145
+ /**
146
+ * Send an OSC message to processing with 2 values
147
+ * @param {string} message
148
+ * @param {number} val1
149
+ * @param {number} val2
150
+ */
151
+ export function sendOSCProcessing(message, val1, val2) {
152
+ var buf;
153
+
154
+ if (debug) console.log("sending osc messages to processing :" + message + " " + val1 + " " + val2);
155
+ buf = osc.toBuffer({ address: message, args: [val1, val2] });
156
+ return udp.send(buf, 0, buf.length, outportProcessing, remoteIPAddressImage);
157
+ }
158
+
159
+ /**
160
+ * Send a note on through OSC
161
+ * @param {number} bus
162
+ * @param {number} channel
163
+ * @param {number} note
164
+ * @param {number} velocity
165
+ */
166
+ export function sendNoteOn(bus, channel, note, velocity) {
167
+ if (directMidi) {
168
+ midiOutput.sendMessage([144 + channel, note, velocity]);
169
+ } else {
170
+ var buf;
171
+ if (debug) console.log("OSCandMidi : sending osc messages NoteOn " + note + " Bus :" + bus + " to channel " + channel);
172
+ buf = osc.toBuffer({ address: "/noteOn", args: [bus, channel, note, velocity] });
173
+
174
+ return udp.send(buf, 0, buf.length, outportForMIDI, remoteIPAddressSound,
175
+ function (err) { if (err !== null) console.log("OSCandMidi: Erreur udp send: ", err); });
176
+ }
177
+ };
178
+
179
+ /**
180
+ * Send a note off through OSC
181
+ * @param {number} bus
182
+ * @param {number} channel
183
+ * @param {number} note
184
+ * @param {number} velocity
185
+ */
186
+ export function sendNoteOff(bus, channel, note, velocity) {
187
+ var buf;
188
+
189
+ buf = osc.toBuffer({ address: "/noteOff", args: [bus, channel, note, velocity] });
190
+ return udp.send(buf, 0, buf.length, outportForMIDI, remoteIPAddressSound,
191
+ function (err) { if (err !== null) console.log("OSCandMidi: Erreur udp send: ", err); });
192
+ };
193
+
194
+ /**
195
+ * Send a program change through OSC
196
+ * @param {number} bus
197
+ * @param {number} channel
198
+ * @param {number} program
199
+ */
200
+ export function sendProgramChange(bus, channel, program) {
201
+ var buf;
202
+ // Le -1 sur program, channel est pour être en phase avec le num de preset dans les synthé
203
+ buf = osc.toBuffer({ address: "/programChange", args: [bus, channel - 1, program - 1] });
204
+ if (debug) console.log("sending osc messages programChange :" + program + " to channel: " + channel + " On bus: " + bus);
205
+ return udp.send(buf, 0, buf.length, outportForMIDI, remoteIPAddressSound,
206
+ function (err) { if (err !== null) console.log("OSCandMidi: Erreur udp send: ", err); });
207
+ };
208
+
209
+ /**
210
+ * Send a bank select through OSC
211
+ * @param {number} bus
212
+ * @param {number} channel
213
+ * @param {number} bank
214
+ */
215
+ export function sendBankSelect(bus, channel, bank) {
216
+ var buf;
217
+
218
+ buf = osc.toBuffer({ address: "/bankSelect", args: [bus, channel - 1, bank - 1] });
219
+ if (debug) console.log("sending osc messages bankSelect :" + bank + " to channel " + channel);
220
+ return udp.send(buf, 0, buf.length, outportForMIDI, remoteIPAddressSound,
221
+ function (err) { if (err !== null) console.log("OSCandMidi: Erreur udp send: ", err); });
222
+ };
223
+
224
+ /**
225
+ * Send a CC through OSC or Midi
226
+ * @param {number} bus
227
+ * @param {number} channel
228
+ * @param {number} controlChange
229
+ * @param {number} controlValue
230
+ */
231
+ export function sendControlChange(bus, channel, controlChange, controlValue) {
232
+ if (directMidi) {
233
+ if (debug) {
234
+ console.log("sending CC Midi: channel:", channel,
235
+ "controlChange :", controlChange,
236
+ " Value: ", controlValue,
237
+ " : ", midiPortClipToDAW);
238
+ }
239
+ midiOutput.sendMessage([176 + channel, controlChange, controlValue]);
240
+ } else {
241
+ var buf;
242
+ buf = osc.toBuffer({ address: "/controlChange", args: [bus, channel, controlChange, controlValue] });
243
+ if (debug1) console.log("sending osc messages bus:", bus, "controlChange :" + controlChange + " Value: " + controlValue);
244
+ return udp.send(buf, 0, buf.length, outportForMIDI, remoteIPAddressSound,
245
+ function (err) { if (err !== null) console.log("OSCandMidi: Erreur udp send: ", err); });
246
+ }
247
+ };
248
+
249
+ /**
250
+ * Send all note off through OSC
251
+ * @param {number} bus
252
+ * @param {number} channel
253
+ */
254
+ export function sendAllNoteOff(bus, channel) {
255
+ var buf;
256
+
257
+ buf = osc.toBuffer({ address: "/allNoteOff", args: [bus, channel] });
258
+ if (debug) console.log("sending ALL OFF");
259
+ return udp.send(buf, 0, buf.length, outportForMIDI, remoteIPAddressSound,
260
+ function (err) { if (err !== null) console.log("OSCandMidi: Erreur udp send: ", err); });
261
+
262
+ };
263
+
264
+ /// VERS LA LUMIERE (QLC+) ============================
265
+ /**
266
+ * To send message to QLC+ for light control
267
+ * @param {string} message
268
+ */
269
+ export function sendSceneLumiere(message) {
270
+ var buf;
271
+ var value = 123; // A priori inutile, mais QLC+ ne comprend pas les message OSC sans valeur
272
+
273
+ if (debug) console.log("OSCandMidi: sends osc to QLC + :" + message + " " + " to " + par.outportLumiere);
274
+ buf = osc.toBuffer({ address: message, args: [value] });
275
+ return udp.send(buf, 0, buf.length, outportLumiere, remoteIPAddressLumiere);
276
+ };
277
+
278
+ // VERS PLATEFORME DE JEU OU CONTOLEUR OSC ================================================
279
+ /**
280
+ * To send OSC message to a Game platfrom or an external device
281
+ * the OSC port is defined in the ipConfiguration by portOSCToGame
282
+ * @param {string} message
283
+ * @param {number} value
284
+ */
285
+ export function sendOSCGame(message, value) { // Value = table des données
286
+ var buf;
287
+ var commandeOSC = "/" + message;
288
+ if (debug) console.log("LogosOSCandMidi: sends osc to Game or controler :" + commandeOSC + " : " + value + " : " + ipConfig.portOSCToGame + " : " + ipConfig.remoteIPAddressGame);
289
+
290
+ //buf = osc.toBuffer({ address: commandeOSC, args: [value] });
291
+
292
+ // OSC Pour ESP 32
293
+ buf = osc.toBuffer({ address: commandeOSC, args: [{ type: 'integer', value: value }] });
294
+
295
+ return udp.send(buf, 0, buf.length, ipConfig.portOSCToGame, ipConfig.remoteIPAddressGame);
296
+ };
297
+
298
+ /**
299
+ * To play a buffer via OSC message in a Raspberry
300
+ * @param {string} message
301
+ * @param {number} buffer num
302
+ * @param {number} Udp port
303
+ * @param {string} IP address of the Raspberry
304
+ * @param {number} level of the pattern
305
+ */
306
+ export function playOSCRasp(message, bufferNum, port, IPaddress, level, duration) {
307
+ var buf;
308
+ var commandeOSC = "/" + message;
309
+ var commandeLevel = "/level"; // Temporairement en dur en attendant d'avoir le bon patch PureData
310
+ var defaultLevel = 70;
311
+
312
+ if (!isNaN(level)) {
313
+ defaultLevel = level;
314
+ }
315
+
316
+ /* // Pour le moment en deux commandes une de niveau et une de jouer le buffer
317
+ if (debug1) console.log("OSCandMidi: play osc to Rapsberry :"
318
+ + IPaddress + " : " + commandeLevel + " : " + level + " : " + level + ":" + duration);
319
+ buf = osc.toBuffer({
320
+ address: commandeLevel,
321
+ args: [
322
+ { type: 'integer', value: parseInt(level) },
323
+ //{ type: 'integer', value: duration },
324
+ //{ type: 'integer', value: 120 },
325
+ ]
326
+ });
327
+ udp.send(buf, 0, buf.length, port, IPaddress); */
328
+
329
+ if (debug1) console.log("OSCandMidi: play osc to Rapsberry :"
330
+ + IPaddress + " : " + commandeOSC + " : " + bufferNum + " : " + level);
331
+ buf = osc.toBuffer({
332
+ address: commandeOSC,
333
+ args: [
334
+ { type: 'integer', value: parseInt(bufferNum) },
335
+ { type: 'integer', value: level }
336
+ ]
337
+ });
338
+ return udp.send(buf, 0, buf.length, port, IPaddress);
339
+ };
340
+
341
+ /**
342
+ * To send a short OSC message with one parameter to a Raspberry
343
+ * @param {string} message
344
+ * @param {number} value
345
+ * @param {number} Udp port
346
+ * @param {string} IP address of the Raspberry
347
+ */
348
+ export function sendOSCRasp(message, value1, port, IPaddress) {
349
+ var buf;
350
+ var commandeOSC = "/" + message;
351
+
352
+ if (debug1) console.log("OSCandMidi: sends osc to Rapsberry :"
353
+ + IPaddress + " : " + port + " : " + commandeOSC + " : " + value1);
354
+ buf = osc.toBuffer({
355
+ address: commandeOSC,
356
+ args: [
357
+ { type: 'integer', value: parseInt(value1) }
358
+ ]
359
+ });
360
+ return udp.send(buf, 0, buf.length, port, IPaddress);
361
+ };