Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-red-contrib-soundweb

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-soundweb - npm Package Compare versions

Comparing version 0.0.4 to 1.0.0

examples/ex_soundweb-compressor.json

175

lib/bss_lib.js

@@ -1,2 +0,7 @@

exports.byteSubstitute = function(buf) {
/**
* Returns a byte subsitituted buffer, removing illegal bytes.
* @param {Buffer} buf - Buffer to be transformed
* @returns {Buffer} Transformed Buffer
*/
exports.byteSubstitute = function (buf) {
let temp = [];

@@ -33,2 +38,7 @@ for (let i = 0; i < buf.length; i++) {

/**
* Returns a Buffer in its original form.
* @param {Buffer} buf - Buffer with illegal bytes subsituted
* @returns {Buffer} Buffer in original form
*/
exports.byteUnsubstitute = function(buf) {

@@ -64,2 +74,7 @@ let temp = [];

/**
* Returns checksum.
* @param {Buffer} buf - Buffer to be used for calculation
* @returns {Buffer} Checksum (as a Buffer)
*/
exports.calculateChecksum = function(buf) {

@@ -73,7 +88,13 @@ let chk = 0

/**
* Returns an encapsulated command ready to be transmitted to Soundweb device.
* The following operations are rolled up into this function:
* - Generate checksum.
* - Build command string with checksum.
* - Byte substitute illegal characters.
* - build command string with STX and ETX bytes.
* @param {Buffer} buf - Command as a Buffer to be encapsulated
* @returns {Buffer} Encapsulated command as a Buffer
*/
exports.encapsulateCommand = function(buf) {
// generate checksum.
// build command string with checksum.
// byte substitute illegal characters.
// build command string with STX and ETX bytes and return to caller.
let checksum = this.calculateChecksum(buf);

@@ -85,11 +106,17 @@ let temp = Buffer.concat([buf, checksum]);

/**
* Returns a decapsulated command.
* The following operations are rolled up into this function:
* - Strip off STX and ETX.
* - Unsubstitute illegal characters.
* - Remove command portion
* - Remove checksum portion.
* - Calculate the checksum.
* - Compare checksum in the command and the calculated checksum.
* - If checksums match, return command to caller.
* - If checksums don't match, return null to caller.
* @param {Buffer} buf - Encapsulated command as a buffer
* @returns {Buffer} Decapsulated command
*/
exports.decapsulateCommand = function(buf) {
// strip off STX and ETX.
// unsubstitute illegal characters.
// remove command portion
// remove checksum portion.
// calculate the checksum.
// compare the received checksum and the calculated checksum.
// if checksums match, return command to caller.
// if checksums don't match, return null to caller.
let temp = buf.subarray(1, buf.length - 1);

@@ -108,2 +135,7 @@ temp = this.byteUnsubstitute(temp);

/**
* Returns the command ID of a decapsualted command Buffer.
* @param {Buffer} buf - Decapsulated command
* @returns {Buffer} Command ID (1 byte Buffer)
*/
exports.getCommandIdBuffer = function(buf) {

@@ -113,2 +145,7 @@ return buf.subarray(0, 1);

/**
* Returns address portion of a decapsulated command Buffer.
* @param {Buffer} buf - Decapsulated command
* @returns {Buffer} Address (8 byte Buffer)
*/
exports.getAddressBuffer = function(buf) {

@@ -118,2 +155,7 @@ return buf.subarray(1, 9);

/**
* Returns data portion of a decapsulated command buffer.
* @param {Buffer} buf - Decapsulated command
* @returns {Buffer} Data (4 byte Buffer)
*/
exports.getDataBuffer = function(buf) {

@@ -123,3 +165,8 @@ return buf.subarray(9);

exports.intToBuffer = function (int) {
/**
* Returns a 4 byte buffer representation of an number.
* @param {number} int - Data as an integer
* @returns {Buffer} integer as a 4 byte Buffer
*/
exports.encDiscrete = function (int) {
return Buffer.from([(int >> 24) & 0xff,

@@ -131,18 +178,35 @@ (int >> 16) & 0xff,

exports.bufferToInt = function (buf) {
/**
* Converts a 4 byte Buffer into a number.
* @param {Buffer} buf - Data as a 4 byte Buffer
* @returns {number} Data as a number
*/
exports.decDiscrete = function (buf) {
return (buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3];
}
exports.setDataPercent = function(value) {
let int = (value * 65536);
return this.intToBuffer(int);
/**
* Returns a 4 byte data Buffer representation of a percentage value
* @param {number} value - Percentage value
* @returns {Buffer} Data as a Buffer
*/
exports.encPercent = function(value) {
return this.encDiscrete(value * 65536);
}
exports.getDataPercent = function(buf) {
let int = this.bufferToInt(buf);
int = int / 65536;
return int;
/**
* Returns a number between 0 and 100
* @param {Buffer} buf - 4 byte Buffer representation of a percentage value
* @returns {number} Number between 0 and 100
*/
exports.decPercent = function(buf) {
return this.decDiscrete(buf) / 65536;
}
exports.setDataDB = function(dbValue) {
/**
* Returns a 4 byte Buffer representation of a dB value
* @param {number} dbValue - dB value
* @returns {Buffer} 4 byte Buffer representation of a dB value
*/
exports.encGain = function(dbValue) {
let value;

@@ -157,7 +221,12 @@

return this.intToBuffer(value);
return this.encDiscrete(value);
}
exports.getDataDB = function(buf) {
let value = this.bufferToInt(buf);
/**
* Returns a dB value
* @param {Buffer} buf - 4 byte Buffer representation of a dB value
* @returns {number} dB value
*/
exports.decGain = function(buf) {
let value = this.decDiscrete(buf);
if (value >= -100000) {

@@ -169,2 +238,56 @@ return value / 10000;

}
}
/**
* Retruns a 4 byte Buffer of a scalar linear scaled number
* @param {number} val - number
* @returns {Buffer} 4 byte Buffer representation of a number
*/
exports.encScalarLinear = function (val) {
return this.encDiscrete(val * 10000);
}
/**
* Returns a scalar linear scaled number
* @param {Buffer} buf - 4 byte Buffer representation of a number
* @returns {number} number
*/
exports.decScalarLinear = function (buf) {
return this.decDiscrete(buf) / 10000;
}
/**
* Returns a 4 byte Buffer representation of a ms value
* @param {number} val - ms delay
* @returns {Buffer} - 4 byte Buffer representation of a ms number
*/
exports.encDelay = function (val) {
return this.encDiscrete(val * 96000 / 1000);
}
/**
* Returns a ms value
* @param {Buffer} buf - 4 byte Buffer representation of a ms number
* @returns {number} ms value
*/
exports.decDelay = function (buf) {
return this.decDiscrete(buf) * 1000 / 96000;
}
/**
* Returns a 4 byte Buffer representation of a Frequency or Speed scaled value
* @param {number} val - Hz or ms value
* @returns {Buffer} 4 byte Buffer representation of a Hz or ms value
*/
exports.encFrequencyOrSpeed = function (val) {
return this.encDiscrete(Math.log10(val) * 1000000);
}
/**
* Returns a Frequency or Speed value
* @param {Buffer} buf - 4 byte Buffer representation of a Hz or ms value
* @returns {number} Hz or ms value
*/
exports.decFrequencyOrSpeed = function (buf) {
return Math.pow(10, this.decDiscrete(buf) / 1000000);
}

34

lib/soundweb-dbGain.js
module.exports = function(RED) {
"use strict";
function LevelControl(config) {
function dbGain(config) {
RED.nodes.createNode(this,config);
let node = this;
let lastMsg;

@@ -20,3 +19,3 @@ let topic = null;

node.status({ fill: "red", shape: "ring", text: "disconnected" });
this.status({ fill: "red", shape: "ring", text: "disconnected" });

@@ -27,16 +26,16 @@ /****************************************************

this.server.socket.on('ready', function() {
node.status({ fill: "green", shape: "dot", text: "connected" });
this.server.socket.on('ready', () => {
this.status({ fill: "green", shape: "dot", text: "connected" });
// subscribe to object
var cmd = Buffer.concat([Buffer.from([0x89]), address, Buffer.from([0, 0, 0, 0])]);
node.server.socket.write(node.server.bssLib.encapsulateCommand(cmd));
this.server.socket.write(this.server.bssLib.encapsulateCommand(cmd));
});
this.server.socket.on('error', function() {
node.status({ fill: "red", shape: "ring", text: "error" });
this.server.socket.on('error', (err) => {
this.status({ fill: "red", shape: "ring", text: "error" });
});
this.server.socket.on('timeout', function() {
node.status({ fill: "red", shape: "dot", text: "error" });
this.server.socket.on('timeout', () => {
this.status({ fill: "red", shape: "dot", text: "error" });
});

@@ -48,3 +47,3 @@

this.server.on('rxData', function(rx) {
this.server.on('rxData', (rx) => {
if (Buffer.compare(rx.address, address) == 0 && Buffer.compare(rx.cmd_id, cmd_id) == 0) {

@@ -59,4 +58,4 @@ let msg = lastMsg || {

}
msg.payload = node.server.bssLib.getDataDB(rx.data);
node.send(msg);
msg.payload = this.server.bssLib.decGain(rx.data);
this.send(msg);
}

@@ -69,9 +68,10 @@ });

this.on('input', function(msg) {
if (typeof msg.payload == 'number' && msg.payload >= -80 && msg.payload <= 10) {
this.on('input', (msg) => {
if (typeof msg.payload == 'number') {
lastMsg = msg;
var data = node.server.bssLib.setDataDB(msg.payload);
var data = this.server.bssLib.encGain(msg.payload);
var cmd = Buffer.concat([cmd_id, address, data]);
this.server.socket.write(this.server.bssLib.encapsulateCommand(cmd));
this.log('[TX$] {cmd_id: ' + cmd_id.toString('hex') + ', address: ' + address.toString('hex') + ', data: ' + data.toString('hex') + '}')
}

@@ -81,3 +81,3 @@ });

RED.nodes.registerType("soundweb-dbGain", LevelControl);
RED.nodes.registerType("soundweb-dbGain", dbGain);
}
module.exports = function(RED) {
"use strict";
function LevelControl(config) {
function ParameterPresets(config) {
RED.nodes.createNode(this,config);

@@ -42,6 +42,6 @@ let node = this;

this.on('input', function(msg) {
if (typeof msg.payload == 'number' && msg.payload >= 0) {
if (typeof msg.payload == 'number') {
lastMsg = msg;
var data = node.server.bssLib.intToBuffer(msg.payload);
var data = node.server.bssLib.encDiscrete(msg.payload);
var cmd = Buffer.concat([cmd_id, data]);

@@ -53,3 +53,3 @@ this.server.socket.write(this.server.bssLib.encapsulateCommand(cmd));

RED.nodes.registerType("soundweb-parameterPresets", LevelControl);
RED.nodes.registerType("soundweb-parameterPresets", ParameterPresets);
}
module.exports = function(RED) {
"use strict";
function LevelControl(config) {
function Percent(config) {
RED.nodes.createNode(this,config);
let node = this;
let lastMsg;

@@ -20,3 +19,3 @@ let topic = null;

node.status({ fill: "red", shape: "ring", text: "disconnected" });
this.status({ fill: "red", shape: "ring", text: "disconnected" });

@@ -27,16 +26,16 @@ /****************************************************

this.server.socket.on('ready', function() {
node.status({ fill: "green", shape: "dot", text: "connected" });
this.server.socket.on('ready', () => {
this.status({ fill: "green", shape: "dot", text: "connected" });
// subscribe to object
var cmd = Buffer.concat([Buffer.from([0x8e]), address, Buffer.from([0, 0, 0, 0])]);
node.server.socket.write(node.server.bssLib.encapsulateCommand(cmd));
this.server.socket.write(this.server.bssLib.encapsulateCommand(cmd));
});
this.server.socket.on('error', function() {
node.status({ fill: "red", shape: "ring", text: "error" });
this.server.socket.on('error', () => {
this.status({ fill: "red", shape: "ring", text: "error" });
});
this.server.socket.on('timeout', function() {
node.status({ fill: "red", shape: "dot", text: "error" });
this.server.socket.on('timeout', () => {
this.status({ fill: "red", shape: "dot", text: "error" });
});

@@ -48,3 +47,3 @@

this.server.on('rxData', function(rx) {
this.server.on('rxData', (rx) => {
if (Buffer.compare(rx.address, address) == 0 && Buffer.compare(rx.cmd_id, cmd_id) == 0) {

@@ -59,4 +58,4 @@ let msg = lastMsg || {

}
msg.payload = node.server.bssLib.getDataPercent(rx.data);
node.send(msg);
msg.payload = this.server.bssLib.decPercent(rx.data);
this.send(msg);
}

@@ -69,9 +68,10 @@ });

this.on('input', function(msg) {
if (typeof msg.payload == 'number' && msg.payload >= 0 && msg.payload <= 100) {
this.on('input', (msg) => {
if (typeof msg.payload == 'number') {
lastMsg = msg;
var data = node.server.bssLib.setDataPercent(msg.payload);
var data = this.server.bssLib.encPercent(msg.payload);
var cmd = Buffer.concat([cmd_id, address, data]);
this.server.socket.write(this.server.bssLib.encapsulateCommand(cmd));
this.log('[TX$] {cmd_id: ' + cmd_id.toString('hex') + ', address: ' + address.toString('hex') + ', data: ' + data.toString('hex') + '}');
}

@@ -81,3 +81,3 @@ });

RED.nodes.registerType("soundweb-percent", LevelControl);
RED.nodes.registerType("soundweb-percent", Percent);
}

@@ -12,10 +12,13 @@ var net = require('net');

let port = n.port;
let node = this;
this.socket = net.connect(port, host);
this.bssLib = bssLib;
this.socket.on('data', function(data) {
/***************************************************************************
* Socket Event Listeners
***************************************************************************/
/**
* On DATA
*/
this.socket.on('data', (data) => {
let rxBuf = [];

@@ -27,4 +30,4 @@

let rx = node.bssLib.decapsulateCommand(Buffer.from(rxBuf));
let rx = this.bssLib.decapsulateCommand(Buffer.from(rxBuf));
if (rx) {

@@ -36,6 +39,8 @@ let temp = {

}
temp.cmd_id = node.bssLib.getCommandIdBuffer(rx);
temp.address = node.bssLib.getAddressBuffer(rx);
temp.data = node.bssLib.getDataBuffer(rx);
node.emit('rxData', temp);
temp.cmd_id = this.bssLib.getCommandIdBuffer(rx);
temp.address = this.bssLib.getAddressBuffer(rx);
temp.data = this.bssLib.getDataBuffer(rx);
this.emit('rxData', temp);
this.log('[RX$] {cmd_id: ' + temp.cmd_id.toString('hex') + ', address: ' + temp.address.toString('hex') + ', data: ' + temp.data.toString('hex') + '}');
}

@@ -51,7 +56,65 @@

this.socket.on('error', function (err) {
console.info('[soundweb-server]', err.toString());
/**
* On ERROR
*/
this.socket.on('error', (err) => {
this.error(err.toString());
});
/**
* On CONNECT
*/
this.socket.on('connect', () => {
this.log('socket connected');
});
/**
* On CLOSE
*/
this.socket.on('close', () => {
this.log('socket closed');
});
/**
* On DRAIN
*/
this.socket.on('drain', () => {
this.log('write buffer cleared');
});
/**
* On END
*/
this.socket.on('end', () => {
this.log('server ended transmission');
});
/**
* On READY
*/
this.socket.on('ready', () => {
this.log('socket ready');
});
/**
* On TIMEOUT
*/
this.socket.on('timeout', () => {
this.log('socket timeout');
});
/***************************************************************************
* Node Event Listeners
***************************************************************************/
this.on('close', (removed, done) => {
if (removed) {
this.socket.destroy();
}
else {
this.socket.end();
}
done();
});
}
RED.nodes.registerType("soundweb-server", SoundwebServerNode);
}

@@ -6,3 +6,2 @@ module.exports = function(RED) {

RED.nodes.createNode(this,config);
let node = this;
let lastMsg;

@@ -21,3 +20,3 @@ let topic = null;

node.status({ fill: "red", shape: "ring", text: "disconnected" });
this.status({ fill: "red", shape: "ring", text: "disconnected" });

@@ -28,16 +27,16 @@ /****************************************************

this.server.socket.on('ready', function() {
node.status({ fill: "green", shape: "dot", text: "connected" });
this.server.socket.on('ready', () => {
this.status({ fill: "green", shape: "dot", text: "connected" });
// subscribe to object
var cmd = Buffer.concat([Buffer.from([0x89]), address, Buffer.from([0, 0, 0, 0])]);
node.server.socket.write(node.server.bssLib.encapsulateCommand(cmd));
this.server.socket.write(this.server.bssLib.encapsulateCommand(cmd));
});
this.server.socket.on('error', function() {
node.status({ fill: "red", shape: "ring", text: "error" });
this.server.socket.on('error', () => {
this.status({ fill: "red", shape: "ring", text: "error" });
});
this.server.socket.on('timeout', function() {
node.status({ fill: "red", shape: "dot", text: "error" });
this.server.socket.on('timeout', () => {
this.status({ fill: "red", shape: "dot", text: "error" });
});

@@ -49,3 +48,3 @@

this.server.on('rxData', function(rx) {
this.server.on('rxData', (rx) => {
if (Buffer.compare(rx.address, address) == 0 && Buffer.compare(rx.cmd_id, cmd_id) == 0) {

@@ -60,4 +59,4 @@ let msg = lastMsg || {

}
msg.payload = node.server.bssLib.bufferToInt(rx.data);
node.send(msg);
msg.payload = this.server.bssLib.decDiscrete(rx.data);
this.send(msg);
}

@@ -70,9 +69,10 @@ });

this.on('input', function(msg) {
if (typeof msg.payload == 'number' && msg.payload >= 0) {
this.on('input', (msg) => {
if (typeof msg.payload == 'number') {
lastMsg = msg;
var data = node.server.bssLib.intToBuffer(msg.payload);
var data = this.server.bssLib.encDiscrete(msg.payload);
var cmd = Buffer.concat([cmd_id, address, data]);
this.server.socket.write(this.server.bssLib.encapsulateCommand(cmd));
this.log('[TX$] {cmd_id: ' + cmd_id.toString('hex') + ', address: ' + address.toString('hex') + ', data: ' + data.toString('hex') + '}');
}

@@ -79,0 +79,0 @@ });

{
"name": "node-red-contrib-soundweb",
"version": "0.0.4",
"version": "1.0.0",
"description": "A collection of nodes for controlling BSS soundweb devices.",

@@ -38,4 +38,10 @@ "main": "soundweb-server.js",

"soundweb-percent": "lib/soundweb-percent.js",
"soundweb-variable": "lib/soundweb-variable.js",
"soundweb-parameterPresets": "lib/soundweb-parameterPresets.js"
"soundweb-discrete": "lib/soundweb-discrete.js",
"soundweb-scalarLinear": "lib/soundweb-scalarLinear.js",
"soundweb-delay": "lib/soundweb-delay.js",
"soundweb-frequency": "lib/soundweb-frequency.js",
"soundweb-speed": "lib/soundweb-speed.js",
"soundweb-venuePresets": "lib/soundweb-venuePresets.js",
"soundweb-parameterPresets": "lib/soundweb-parameterPresets.js",
"soundweb-variable": "lib/soundweb-variable.js"
}

@@ -42,0 +48,0 @@ },

@@ -34,2 +34,10 @@ # node-red-contrib-soundweb

## Feature Requests
Any feature requests can be submitted to the repository's [discussions/ideas](https://github.com/dudest/node-red-contrib-soundweb/discussions/categories/ideas) section.
## Bug Reporting
Please report any bugs or issues to the repository [here](https://github.com/dudest/node-red-contrib-soundweb/issues).
---

@@ -45,3 +53,3 @@

All nodes except the `soundweb-Preset` node require an address be specified. The address property is a buffer of exactly 8 bytes. it is comprised of:
All nodes except `soudweb-venuePresets` and `soundweb-parameterPreset` node require an address be specified. The address property is a buffer of exactly 8 bytes. it is comprised of:

@@ -76,40 +84,20 @@ - Node Address (2 bytes)

## soundweb-dbGain
![soundweb-example](images/ex_soundweb.png)
Control a level fader using dB value.
### Gain Control Example
![soundweb-dbGain](images/ex_soundweb-dbGain.png)
```
[{"id":"b808bfbecab9467d","type":"tab","label":"soundweb-dbGain","disabled":false,"info":""},{"id":"039149f2e96d9e36","type":"junction","z":"b808bfbecab9467d","x":260,"y":180,"wires":[["01d5502d15917b77"]]},{"id":"75be45758a7b2fa9","type":"debug","z":"b808bfbecab9467d","name":"soundweb-dbGain","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":610,"y":180,"wires":[]},{"id":"01d5502d15917b77","type":"soundweb-dbGain","z":"b808bfbecab9467d","name":"","topic":"","server":"5360e8d16d24bed6","address":"[0,9,3,0,1,0,0,0]","addressType":"bin","x":390,"y":180,"wires":[["75be45758a7b2fa9"]]},{"id":"32b96062ce029306","type":"inject","z":"b808bfbecab9467d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-50","payloadType":"num","x":150,"y":100,"wires":[["039149f2e96d9e36"]]},{"id":"a6646a6c14e240f8","type":"inject","z":"b808bfbecab9467d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":150,"y":180,"wires":[["039149f2e96d9e36"]]},{"id":"1bf5690f659c3e4f","type":"inject","z":"b808bfbecab9467d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"5","payloadType":"num","x":150,"y":260,"wires":[["039149f2e96d9e36"]]},{"id":"49c758e4300cb68e","type":"comment","z":"b808bfbecab9467d","name":"Control a level fader","info":"","x":390,"y":100,"wires":[]},{"id":"5360e8d16d24bed6","type":"soundweb-server","host":"10.0.0.234","port":"1023"}]
[{"id":"d2ab3aa4da536f58","type":"tab","label":"Gain","disabled":false,"info":"","env":[]},{"id":"399a64d5ae2b8c7e","type":"soundweb-dbGain","z":"d2ab3aa4da536f58","name":"gain","topic":"","server":"452ed4c5da9c7ed8","address":"[0,9,3,0,1,0,0,0]","addressType":"bin","x":310,"y":120,"wires":[["6e72a5ecec720faa"]]},{"id":"6e72a5ecec720faa","type":"ui_slider","z":"d2ab3aa4da536f58","name":"Gain","label":"","tooltip":"","group":"bf3bb3f9d639b54c","order":1,"width":"6","height":"1","passthru":false,"outs":"all","topic":"topic","topicType":"msg","min":"-80","max":10,"step":"0.1","className":"","x":130,"y":120,"wires":[["399a64d5ae2b8c7e"]]},{"id":"40f8dd5453eb9d33","type":"ui_switch","z":"d2ab3aa4da536f58","name":"","label":"mute","tooltip":"","group":"bf3bb3f9d639b54c","order":4,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","animate":false,"className":"","x":130,"y":320,"wires":[["a361ce18cb3c1fc7"]]},{"id":"a361ce18cb3c1fc7","type":"soundweb-discrete","z":"d2ab3aa4da536f58","name":"mute","topic":"","server":"452ed4c5da9c7ed8","address":"[0,9,3,0,1,0,0,1]","addressType":"bin","x":310,"y":320,"wires":[["40f8dd5453eb9d33"]]},{"id":"767604665854ba1a","type":"ui_button","z":"d2ab3aa4da536f58","name":"","group":"bf3bb3f9d639b54c","order":2,"width":"3","height":"1","passthru":false,"label":"<","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"1","payloadType":"num","topic":"topic","topicType":"msg","x":130,"y":200,"wires":[["9d3cd3eefa8363ed"]]},{"id":"85bda79e383fdd8d","type":"ui_button","z":"d2ab3aa4da536f58","name":"","group":"bf3bb3f9d639b54c","order":3,"width":"3","height":"1","passthru":false,"label":">","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"1","payloadType":"num","topic":"topic","topicType":"msg","x":130,"y":260,"wires":[["93b01d722d9ce4e4"]]},{"id":"93b01d722d9ce4e4","type":"soundweb-discrete","z":"d2ab3aa4da536f58","name":"bump up","topic":"","server":"452ed4c5da9c7ed8","address":"[0,9,3,0,1,0,0,3]","addressType":"bin","x":300,"y":260,"wires":[[]]},{"id":"9d3cd3eefa8363ed","type":"soundweb-discrete","z":"d2ab3aa4da536f58","name":"bump down","topic":"","server":"452ed4c5da9c7ed8","address":"[0,9,3,0,1,0,0,4]","addressType":"bin","x":310,"y":200,"wires":[[]]},{"id":"7e4ad2b79ea59383","type":"soundweb-dbGain","z":"d2ab3aa4da536f58","name":"meter","topic":"","server":"452ed4c5da9c7ed8","address":"[0,9,3,0,1,3,0,0]","addressType":"bin","x":150,"y":400,"wires":[["47e949c5acc19ece"]]},{"id":"47e949c5acc19ece","type":"ui_gauge","z":"d2ab3aa4da536f58","name":"","group":"bf3bb3f9d639b54c","order":5,"width":0,"height":0,"gtype":"gage","title":"","label":"dBu","format":"{{value}}","min":"-30","max":"20","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","diff":false,"className":"","x":310,"y":400,"wires":[]},{"id":"699ebebb1763f7a4","type":"comment","z":"d2ab3aa4da536f58","name":"Gain example","info":"","x":210,"y":60,"wires":[]},{"id":"452ed4c5da9c7ed8","type":"soundweb-server","host":"10.0.0.234","port":"1023"},{"id":"bf3bb3f9d639b54c","type":"ui_group","name":"Gain","tab":"7d1e9ef79062113d","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"7d1e9ef79062113d","type":"ui_tab","name":"BSS Soundweb","icon":"dashboard","disabled":false,"hidden":false}]
```
## soundweb-precent
### Compressor Control Example
Control a parameter using a percentage value.
![soundweb-percent](images/ex_soundweb-percent.png)
```
[{"id":"dcc82e90063b7d69","type":"tab","label":"soundweb-percent","disabled":false,"info":"","env":[]},{"id":"2b7b9d58a4add5c4","type":"junction","z":"dcc82e90063b7d69","x":360,"y":220,"wires":[["64a22bbbf00e6043"]]},{"id":"64a22bbbf00e6043","type":"soundweb-percent","z":"dcc82e90063b7d69","name":"","topic":"","server":"5360e8d16d24bed6","address":"[0,9,3,0,1,0,78,32]","addressType":"bin","x":490,"y":220,"wires":[["192ce9168c51052f"]]},{"id":"412b5ff477d8a695","type":"inject","z":"dcc82e90063b7d69","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":250,"y":160,"wires":[["2b7b9d58a4add5c4"]]},{"id":"192ce9168c51052f","type":"debug","z":"dcc82e90063b7d69","name":"soundweb-percent","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":710,"y":220,"wires":[]},{"id":"d974b7ba0d93822b","type":"inject","z":"dcc82e90063b7d69","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"50","payloadType":"num","x":250,"y":220,"wires":[["2b7b9d58a4add5c4"]]},{"id":"97031a3c7731d82f","type":"inject","z":"dcc82e90063b7d69","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"100","payloadType":"num","x":250,"y":280,"wires":[["2b7b9d58a4add5c4"]]},{"id":"c7ee133cd1f32866","type":"comment","z":"dcc82e90063b7d69","name":"Control by setting a percentage value","info":"","x":530,"y":160,"wires":[]},{"id":"5360e8d16d24bed6","type":"soundweb-server","host":"10.0.0.234","port":"1023"}]
[{"id":"72d99cfa03d040a3","type":"tab","label":"Compressor","disabled":false,"info":"","env":[]},{"id":"4640b6d3fa5c7984","type":"soundweb-scalarLinear","z":"72d99cfa03d040a3","name":"threshold","topic":"","server":"452ed4c5da9c7ed8","address":"[0,9,3,0,1,2,0,1]","addressType":"bin","x":300,"y":220,"wires":[["8003c160ed4c1730"]]},{"id":"df6dae7a035bd8ea","type":"soundweb-speed","z":"72d99cfa03d040a3","name":"attack","topic":"","server":"452ed4c5da9c7ed8","address":"[0,9,3,0,1,2,0,3]","addressType":"bin","x":290,"y":440,"wires":[["238e57e7792123e4"]]},{"id":"10baba041c3f615c","type":"soundweb-speed","z":"72d99cfa03d040a3","name":"release","topic":"","server":"452ed4c5da9c7ed8","address":"[0,9,3,0,1,2,0,4]","addressType":"bin","x":300,"y":540,"wires":[["3c5907ced2b6d0b4"]]},{"id":"67a3f1da0d7f6b7a","type":"soundweb-scalarLinear","z":"72d99cfa03d040a3","name":"ratio","topic":"","server":"452ed4c5da9c7ed8","address":"[0,9,3,0,1,2,0,2]","addressType":"bin","x":290,"y":340,"wires":[["ea7aed5e085daafb"]]},{"id":"fcc71a001ef1cbc3","type":"soundweb-scalarLinear","z":"72d99cfa03d040a3","name":"gain","topic":"","server":"452ed4c5da9c7ed8","address":"[0,9,3,0,1,2,0,7]","addressType":"bin","x":290,"y":660,"wires":[["c2572c4ee547c0b3"]]},{"id":"425427fe67356d05","type":"soundweb-discrete","z":"72d99cfa03d040a3","name":"auto release","topic":"","server":"452ed4c5da9c7ed8","address":"[0,9,3,0,1,2,0,8]","addressType":"bin","x":310,"y":780,"wires":[["59148c1f7d63927e"]]},{"id":"de53533a8d22545e","type":"soundweb-discrete","z":"72d99cfa03d040a3","name":"bypass","topic":"","server":"452ed4c5da9c7ed8","address":"[0,9,3,0,1,2,0,0]","addressType":"bin","x":300,"y":120,"wires":[["8f3feb89ea5dc13f"]]},{"id":"8f3feb89ea5dc13f","type":"ui_switch","z":"72d99cfa03d040a3","name":"","label":"Bypass","tooltip":"","group":"63eb1d6b748fc43d","order":1,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","animate":false,"className":"","x":120,"y":120,"wires":[["de53533a8d22545e"]]},{"id":"8003c160ed4c1730","type":"ui_numeric","z":"72d99cfa03d040a3","name":"","label":"Threshold","tooltip":"","group":"63eb1d6b748fc43d","order":2,"width":0,"height":0,"wrap":false,"passthru":false,"topic":"topic","topicType":"msg","format":"{{value}}dBu","min":"-30","max":"20","step":"0.1","className":"","x":120,"y":220,"wires":[["4640b6d3fa5c7984"]]},{"id":"ea7aed5e085daafb","type":"ui_numeric","z":"72d99cfa03d040a3","name":"","label":"Ratio","tooltip":"","group":"63eb1d6b748fc43d","order":3,"width":0,"height":0,"wrap":false,"passthru":false,"topic":"topic","topicType":"msg","format":"{{value}}:1","min":"1.02","max":"20.1","step":"0.01","className":"","x":110,"y":340,"wires":[["67a3f1da0d7f6b7a"]]},{"id":"238e57e7792123e4","type":"ui_numeric","z":"72d99cfa03d040a3","name":"","label":"Attack","tooltip":"","group":"63eb1d6b748fc43d","order":4,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"topic","topicType":"msg","format":"{{value}}ms","min":"50","max":"200","step":1,"className":"","x":110,"y":440,"wires":[["df6dae7a035bd8ea"]]},{"id":"3c5907ced2b6d0b4","type":"ui_numeric","z":"72d99cfa03d040a3","name":"","label":"Release","tooltip":"","group":"63eb1d6b748fc43d","order":5,"width":0,"height":0,"wrap":false,"passthru":false,"topic":"topic","topicType":"msg","format":"{{value}}ms","min":"5","max":"500","step":1,"className":"","x":120,"y":540,"wires":[["10baba041c3f615c"]]},{"id":"c2572c4ee547c0b3","type":"ui_numeric","z":"72d99cfa03d040a3","name":"","label":"Gain","tooltip":"","group":"63eb1d6b748fc43d","order":6,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"topic","topicType":"msg","format":"{{value}}dB","min":"-20","max":"20","step":1,"className":"","x":110,"y":660,"wires":[["fcc71a001ef1cbc3"]]},{"id":"59148c1f7d63927e","type":"ui_switch","z":"72d99cfa03d040a3","name":"","label":"Auto Release","tooltip":"","group":"63eb1d6b748fc43d","order":7,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","animate":false,"className":"","x":140,"y":780,"wires":[["425427fe67356d05"]]},{"id":"98e02e3390500d63","type":"comment","z":"72d99cfa03d040a3","name":"Compressor example","info":"","x":160,"y":40,"wires":[]},{"id":"452ed4c5da9c7ed8","type":"soundweb-server","host":"10.0.0.234","port":"1023"},{"id":"63eb1d6b748fc43d","type":"ui_group","name":"Compressor","tab":"7d1e9ef79062113d","order":2,"disp":true,"width":"6","collapse":false,"className":""},{"id":"7d1e9ef79062113d","type":"ui_tab","name":"BSS Soundweb","icon":"dashboard","disabled":false,"hidden":false}]
```
## soundweb-variable
### Preset Recall Example
Control a non scaled value; i.e. mute button, source selector, etc.
![soundweb-variable](images/ex_soundweb-variable.png)
```
[{"id":"e2465d3b8b923c86","type":"tab","label":"soundweb-variable","disabled":false,"info":"","env":[]},{"id":"a95660a4ff2ed021","type":"comment","z":"e2465d3b8b923c86","name":"Set a variable; i.e. mute, source selector, etc.","info":"","x":430,"y":140,"wires":[]},{"id":"330e7234148567cf","type":"soundweb-variable","z":"e2465d3b8b923c86","name":"","topic":"","server":"5360e8d16d24bed6","address":"[0,9,3,0,1,0,0,1]","addressType":"bin","x":350,"y":200,"wires":[["cd7df45776dc28aa"]]},{"id":"cd7df45776dc28aa","type":"debug","z":"e2465d3b8b923c86","name":"soundweb-variable","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":590,"y":200,"wires":[]},{"id":"555d7e3c31b55735","type":"inject","z":"e2465d3b8b923c86","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":150,"y":180,"wires":[["330e7234148567cf"]]},{"id":"7adee4c287332b92","type":"inject","z":"e2465d3b8b923c86","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":150,"y":260,"wires":[["330e7234148567cf"]]},{"id":"5360e8d16d24bed6","type":"soundweb-server","host":"10.0.0.234","port":"1023"}]
```
## soundweb-parameterPresets
Recall a parameter preset
![soundweb-parameterPresets](images/ex_soundweb-parameterPresets.png)
```
[{"id":"7cf2b46d3c74f8f9","type":"tab","label":"soundweb-parameterPresets","disabled":false,"info":"","env":[]},{"id":"9ca6fdc63a758c1c","type":"junction","z":"7cf2b46d3c74f8f9","x":320,"y":100,"wires":[["5265b61696c0d77c"]]},{"id":"c84978d953990924","type":"inject","z":"7cf2b46d3c74f8f9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":210,"y":80,"wires":[["9ca6fdc63a758c1c"]]},{"id":"2401fd9804bc171c","type":"inject","z":"7cf2b46d3c74f8f9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":210,"y":140,"wires":[["9ca6fdc63a758c1c"]]},{"id":"5265b61696c0d77c","type":"soundweb-parameterPresets","z":"7cf2b46d3c74f8f9","name":"","topic":"","server":"5360e8d16d24bed6","x":500,"y":100,"wires":[]},{"id":"5360e8d16d24bed6","type":"soundweb-server","host":"10.0.0.234","port":"1023"}]
[{"id":"748242db03ab0c24","type":"tab","label":"Presets","disabled":false,"info":"","env":[]},{"id":"2661d2125651aeb9","type":"junction","z":"748242db03ab0c24","x":200,"y":220,"wires":[["d468009d0f201754"]]},{"id":"1c3ad718a0a58de4","type":"junction","z":"748242db03ab0c24","x":200,"y":360,"wires":[["3adde43106b84b26"]]},{"id":"d468009d0f201754","type":"soundweb-parameterPresets","z":"748242db03ab0c24","name":"","topic":"","server":"452ed4c5da9c7ed8","x":360,"y":220,"wires":[]},{"id":"a56686efc5886604","type":"ui_button","z":"748242db03ab0c24","name":"","group":"468ac21e0d32a8e4","order":0,"width":0,"height":0,"passthru":false,"label":"Preset 0","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"0","payloadType":"num","topic":"topic","topicType":"msg","x":80,"y":160,"wires":[["2661d2125651aeb9"]]},{"id":"900fcf928c3cb316","type":"ui_button","z":"748242db03ab0c24","name":"","group":"468ac21e0d32a8e4","order":0,"width":0,"height":0,"passthru":false,"label":"Preset 1","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"1","payloadType":"num","topic":"topic","topicType":"msg","x":80,"y":200,"wires":[["2661d2125651aeb9"]]},{"id":"d2973e477450d7ec","type":"ui_button","z":"748242db03ab0c24","name":"","group":"468ac21e0d32a8e4","order":0,"width":0,"height":0,"passthru":false,"label":"Preset 2","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"2","payloadType":"num","topic":"topic","topicType":"msg","x":80,"y":240,"wires":[["2661d2125651aeb9"]]},{"id":"68dd21b95d7593be","type":"ui_button","z":"748242db03ab0c24","name":"","group":"468ac21e0d32a8e4","order":0,"width":0,"height":0,"passthru":false,"label":"Preset 3","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"3","payloadType":"num","topic":"topic","topicType":"msg","x":80,"y":280,"wires":[["2661d2125651aeb9"]]},{"id":"3adde43106b84b26","type":"soundweb-venuePresets","z":"748242db03ab0c24","name":"","topic":"","server":"452ed4c5da9c7ed8","x":350,"y":360,"wires":[]},{"id":"1b8914ed86493b5e","type":"ui_button","z":"748242db03ab0c24","name":"","group":"62bb4bb26496d012","order":0,"width":0,"height":0,"passthru":false,"label":"Preset 0","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"0","payloadType":"num","topic":"topic","topicType":"msg","x":80,"y":340,"wires":[["1c3ad718a0a58de4"]]},{"id":"5721f58c69d98aee","type":"ui_button","z":"748242db03ab0c24","name":"","group":"62bb4bb26496d012","order":0,"width":0,"height":0,"passthru":false,"label":"Preset 1","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"1","payloadType":"num","topic":"topic","topicType":"msg","x":80,"y":380,"wires":[["1c3ad718a0a58de4"]]},{"id":"78173526ceb28fa8","type":"comment","z":"748242db03ab0c24","name":"Preset example","info":"","x":280,"y":100,"wires":[]},{"id":"452ed4c5da9c7ed8","type":"soundweb-server","host":"10.0.0.234","port":"1023"},{"id":"468ac21e0d32a8e4","type":"ui_group","name":"Parameter Presets","tab":"7d1e9ef79062113d","order":3,"disp":true,"width":"6","collapse":false,"className":""},{"id":"62bb4bb26496d012","type":"ui_group","name":"Venue Presets","tab":"7d1e9ef79062113d","order":4,"disp":true,"width":"6","collapse":false,"className":""},{"id":"7d1e9ef79062113d","type":"ui_tab","name":"BSS Soundweb","icon":"dashboard","disabled":false,"hidden":false}]
```

@@ -67,6 +67,22 @@ const assert = require('assert');

});
describe('setDataPercent', function() {
describe('encDiscrete', function () {
it('10 should return <buffer 00 00 00 0a>',
function () {
var actual = bssLib.encDiscrete(10);
var expected = Buffer.from([0x00, 0x00, 0x00, 0x0a]);
assert.deepEqual(actual, expected);
});
});
describe('decDiscrete', function () {
it('<buffer 00 00 00 0b> should return 11',
function () {
var actual = bssLib.decDiscrete(Buffer.from([0x00, 0x00, 0x00, 0x0b]));
var expected = 11;
assert.deepEqual(actual, expected);
});
});
describe('encPercent', function() {
it ('12.5 should return <buffer 00 0c 80 00>',
function() {
var actual = bssLib.setDataPercent(12.5);
var actual = bssLib.encPercent(12.5);
var expected = Buffer.from([0x00,0x0c,0x80,0x00]);

@@ -76,6 +92,6 @@ assert.deepEqual(actual, expected);

});
describe('getDataPercent', function() {
describe('decPercent', function() {
it ('<buffer 00 0c 80 00> should return 12.5',
function() {
var actual = bssLib.getDataPercent(Buffer.from([0x00,0x0c,0x80,0x00]));
var actual = bssLib.decPercent(Buffer.from([0x00,0x0c,0x80,0x00]));
var expected = 12.5;

@@ -85,6 +101,6 @@ assert.deepEqual(actual, expected);

});
describe('setDataDB', function() {
describe('encGain', function() {
it ('-15dB should return <buffer ff fd ef ce>',
function() {
var actual = bssLib.setDataDB(-15);
var actual = bssLib.encGain(-15);
var expected = Buffer.from([0xff,0xfd,0xef,0xce]);

@@ -94,6 +110,6 @@ assert.deepEqual(actual, expected);

});
describe('getDataDB', function() {
it ('<buffer ff fd ef ce> should return -15dB',
describe('decGain', function() {
it('<buffer ff fd ef ce> should return roughly -15dB (-14.999956513820392)',
function() {
var actual = bssLib.getDataDB(Buffer.from([0xff,0xfd,0xef,0xce]));
var actual = bssLib.decGain(Buffer.from([0xff,0xfd,0xef,0xce]));
var expected = -14.999956513820392;

@@ -103,18 +119,50 @@ assert.deepEqual(actual, expected);

});
describe('intToBuffer', function() {
it ('10 should return <buffer 00 00 00 0a>',
describe('encScalaLinear', function() {
it ('5 should return <buffer 00 00 c3 50>',
function() {
var actual = bssLib.intToBuffer(10);
var expected = Buffer.from([0x00,0x00,0x00,0x0a]);
var actual = bssLib.encScalarLinear(5);
var expected = Buffer.from([0x00,0x00,0xc3,0x50]);
assert.deepEqual(actual, expected);
});
});
describe('bufferToInt', function() {
it ('<buffer 00 00 00 0b> should return 11',
describe('decScalarLinear', function() {
it ('<buffer 00 00 c3 50> should return 5',
function() {
var actual = bssLib.bufferToInt(Buffer.from([0x00,0x00,0x00,0x0b]));
var expected = 11;
var actual = bssLib.decScalarLinear(Buffer.from([0x00,0x00,0xc3,0x50]));
var expected = 5;
assert.deepEqual(actual, expected);
});
});
describe('encDelay', function () {
it('5 should return <buffer 00 00 01 e0>',
function () {
var actual = bssLib.encDelay(5);
var expected = Buffer.from([0x00, 0x00, 0x01, 0xe0]);
assert.deepEqual(actual, expected);
});
});
describe('decDelay', function () {
it('<buffer 00 00 01 e0> should return 5',
function () {
var actual = bssLib.decDelay(Buffer.from([0x00, 0x00, 0x01, 0xe0]));
var expected = 5;
assert.deepEqual(actual, expected);
});
});
describe('encFrequencyOrSpeed', function () {
it('5 should return <buffer 00 0a aa 5a>',
function () {
var actual = bssLib.encFrequencyOrSpeed(5);
var expected = Buffer.from([0x00, 0x0a, 0xaa, 0x5a]);
assert.deepEqual(actual, expected);
});
});
describe('decFrequencyOrSpeed', function () {
it('<buffer 00 0a aa 5a> should return roughly 5 (4.999999950079738)',
function () {
var actual = bssLib.decFrequencyOrSpeed(Buffer.from([0x00, 0x0a, 0xaa, 0x5a]));
var expected = 4.999999950079738;
assert.deepEqual(actual, expected);
});
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc