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

bitwig-multisamplegen

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitwig-multisamplegen - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

55

dist/index.js

@@ -277,5 +277,8 @@ #!/usr/bin/env node

const velocityMax = getVelocity(parsed);
const key = getNoteNumber(parsed);
const sample = {
name: parsed.fullname,
key: getNoteNumber(parsed),
key,
lowKey: key,
highKey: key,
velocityMin,

@@ -367,3 +370,3 @@ velocityMax

<sample file="${sample.name}" gain="0.00" parameter-1="0.0000" parameter-2="0.0000" parameter-3="0.0000" reverse="false" sample-start="0.000" sample-stop="-1" zone-logic="always-play">
<key low="${sample.key}" high="${sample.key}" root="${sample.key}" track="1.0000" tune="0.00"/>
<key low="${sample.lowKey}" high="${sample.highKey}" root="${sample.key}" track="1.0000" tune="0.00"/>
<velocity low="${sample.velocityMin}" high="${sample.velocityMax}" />

@@ -392,2 +395,47 @@ <select low="0" high="127"/>

const computeLowKey = (samples, sample, index) => {
if (index === 0) {
return { ...sample,
lowKey: 0
};
}
const previousSample = samples[index - 1];
const value = Math.trunc((sample.key - previousSample.key) / 2);
const lowKey = Math.max(0, sample.key - value + 1);
return { ...sample,
lowKey
};
};
const computeHighKey = (samples, sample, index) => {
if (index >= samples.length - 1) {
return { ...sample,
highKey: 127
};
}
const nextSample = samples[index + 1];
const value = Math.trunc((nextSample.key - sample.key + 1) / 2);
const highKey = Math.min(127, sample.key + value);
return { ...sample,
highKey
};
};
const transformSamples = allSamples => {
let result = [];
const groupedSamples = ramda.groupBy(x => String(x.velocityMax), allSamples);
Object.keys(groupedSamples).forEach(velocity => {
groupedSamples[velocity] = ramda.sortBy(sample => sample.key, groupedSamples[velocity]);
const samples = groupedSamples[velocity];
const nextSamples = groupedSamples[velocity].map((sample, index) => {
const computedSample = computeLowKey(samples, sample, index);
return computeHighKey(samples, computedSample, index);
});
result = [...result, ...nextSamples];
});
return result;
};
const generateZipFile = function (pathdir, samples, givenPackageName) {

@@ -465,4 +513,3 @@ try {

}])).then(function (info) {
const packageName = info.packageName;
return Promise.resolve(generateZipFile(pathdir, samples, packageName)).then(function () {});
return Promise.resolve(generateZipFile(pathdir, transformSamples(samples), info.packageName)).then(function () {});
});

@@ -469,0 +516,0 @@ });

2

package.json
{
"name": "bitwig-multisamplegen",
"version": "1.0.1",
"version": "1.1.0",
"description": "Generate multisample xml file from samples ",

@@ -5,0 +5,0 @@ "author": "guillaumearm",

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