New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More →

node-sfx

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-sfx - npm Package Compare versions

Comparing version

to
0.2.0

@@ -45,14 +45,14 @@ const generator = require("audio-generator/stream");

const loop = (sheet, bpm = 192, effect = (time, base) => base) => {
let index = 0;
const loop = (sheet, bpm = 192) => {
const multiTrack = _.isArray(sheet[0]);
const length = multiTrack ? _.maxBy(sheet, s => s.length).length : sheet.length;
const beat = 60 / bpm;
setInterval(() => {
index++;
}, 60000 / bpm);
return time => {
const index = Math.trunc(time / beat) % length;
return time =>
compose(
sheet[index % sheet.length],
base => effect(time, base)
)(time);
return multiTrack
? sheet.map(s => s[index] || echo(0)).map(x => x(time))
: sheet[index](time);
};
};

@@ -80,2 +80,4 @@

multiply,
cross: multiply,
dot: multiply,
average,

@@ -82,0 +84,0 @@ avg: average,

{
"name": "node-sfx",
"version": "0.1.1",
"version": "0.2.0",
"description": "A library for composing and synthesizing sound for NodeJS programs",

@@ -5,0 +5,0 @@ "main": "./index.js",

@@ -26,19 +26,18 @@ <p align="center">

```javascript
const { synthesizer, loop, compose, map, passThrough, sum } = require("node-sfx/core");
const { a, b, c, d, e, f, g, triangle, } = require("node-sfx/waves");
const { lowPass, envelope } = require("node-sfx/filters");
const { synthesizer, loop, compose, map, scale } = require("node-sfx/core");
const { a, b, c, d, e, f, g } = require("node-sfx/waves");
const { lowPass } = require("node-sfx/filters");
const { listenForExit } = require("node-sfx/utils");
synthesizer(
loop(
[c(3), e(3), g(3), b(3), c(4), b(3), g(3), e(3)],
275,
compose(
map(
compose(triangle(4), lowPass("lp")(120)),
passThrough
),
sum,
envelope("e")(10, 2)
)
compose(
loop(
[
[c(4), e(4), g(4), b(4), c(5), b(4), g(4), e(4)],
[c(2), e(2), g(2), b(2), c(3), b(2), g(2), e(2)]
],
275
),
map(scale(0.5), scale(1)),
map(lowPass("l")(440), lowPass("r")(440))
)

@@ -45,0 +44,0 @@ ).play();