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

audio-param-transform

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

audio-param-transform - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

25

index.js

@@ -29,3 +29,5 @@ var mergeTransforms = require('./merge_transforms')

set: function(value){
paramTransform.setValueAtTime(value, 0)
if (paramTransform.getValueAt(null) !== value){
paramTransform.setValueAtTime(value, 0)
}
}

@@ -48,3 +50,3 @@ }

var to = 0
var step = Infinity
var step = 0

@@ -63,3 +65,3 @@ // set from / to

}
if (!step || step > event.step){
if (event.step && (!step || step > event.step)){
step = event.step

@@ -76,6 +78,5 @@ }

this.setValueAtTime(result[0], from)
} else {
} else if (result.length > 1) {
this.setValueCurveAtTime(result, from, to-from)
}
}

@@ -102,3 +103,3 @@

var duration = endTime - startTime
var steps = this.param.context.sampleRate / duration
var steps = duration ? (this.param.context.sampleRate / duration) : 1

@@ -135,2 +136,6 @@ schedule(this, {

},
setTargetAtTime: function(targetValue, at, timeConstant){
//console.warn('setTargetAtTime not implemented on audio-param-transform, passing through')
this.param.setTargetAtTime(targetValue, at, timeConstant)
},
cancelScheduledValues: function(startTime){

@@ -218,3 +223,9 @@ schedule(this, {cancel: true, at: startTime || this.param.context.currentTime})

transform.param._pendingTransforms += 1
process.nextTick(transform.param._doSchedule)
if (event.from <= transform.param.context.currentTime + 0.001){
transform.param._doSchedule()
} else {
// attempt to batch the transform
process.nextTick(transform.param._doSchedule)
}
}

@@ -221,0 +232,0 @@

@@ -6,3 +6,4 @@ module.exports = mergeTransforms

var duration = to - from
var steps = (duration || 1) / (step || 1)
var steps = step ? duration / step : 1
var transformCount = transforms.length

@@ -49,6 +50,5 @@ var result = new Float32Array(steps)

var duration = (to - from) || 1
step = step || duration
var duration = to - from
var steps = duration / step
var steps = step ? duration / step : 1
var curve = new Float32Array(steps)

@@ -65,8 +65,7 @@

var event = events[i]
var eventStep = event.step || duration
var offset = Math.floor((event.from - from) / step)
var scale = eventStep / step
var offset = step ? Math.floor((event.from - from) / step) : 0
var scale = (event.step && step) ? event.step / step : 1
var newLength = Math.floor(event.curve.length * scale)
var newLength = Math.floor(steps * scale)

@@ -82,8 +81,9 @@ if (offset > start){

if (eventStep === step && offset>=0){
if (event.step === step && offset>=0 && event.curve.length + offset <= curve.length){
curve.set(event.curve, offset)
} else { // rescale if step doesn't match
for (var x=0,l=newLength;x<l;x++){
var pos = x+Math.max(0, offset)
var xi = Math.floor(x / scale) - Math.min(0, offset)
curve[x+Math.max(0, offset)] = event.curve[xi]
curve[pos] = event.curve[xi]
}

@@ -94,2 +94,4 @@ }

// fill remaining

@@ -96,0 +98,0 @@ for (var i=0;i<start;i++){

{
"name": "audio-param-transform",
"version": "0.0.2",
"version": "0.1.0",
"description": "Apply multiple transforms with custom functions to Web Audio API AudioParams.",

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

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