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

scratch-audio

Package Overview
Dependencies
Maintainers
1
Versions
445
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scratch-audio - npm Package Compare versions

Comparing version 0.1.0-prerelease.1511362862 to 0.1.0-prerelease.1513803406

2

package.json
{
"name": "scratch-audio",
"version": "0.1.0-prerelease.1511362862",
"version": "0.1.0-prerelease.1513803406",
"description": "audio engine for scratch 3.0",

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

@@ -8,7 +8,8 @@ /**

/**
* @param {AudioContext} audioContext - a webAudio context
* @param {AudioEngine} audioEngine - the audio engine.
* @constructor
*/
constructor (audioContext) {
this.audioContext = audioContext;
constructor (audioEngine) {
this.audioEngine = audioEngine;
this.audioContext = this.audioEngine.audioContext;
this.value = 0;

@@ -41,4 +42,7 @@

// See e.g. https://docs.cycling74.com/max7/tutorials/13_panningchapter01
this.leftGain.gain.value = Math.cos(p * Math.PI / 2);
this.rightGain.gain.value = Math.sin(p * Math.PI / 2);
const leftVal = Math.cos(p * Math.PI / 2);
const rightVal = Math.sin(p * Math.PI / 2);
this.leftGain.gain.setTargetAtTime(leftVal, 0, this.audioEngine.DECAY_TIME);
this.rightGain.gain.setTargetAtTime(rightVal, 0, this.audioEngine.DECAY_TIME);
}

@@ -45,0 +49,0 @@

@@ -31,3 +31,3 @@ const StartAudioContext = require('startaudiocontext');

this.pitchEffect = new PitchEffect();
this.panEffect = new PanEffect(this.audioEngine.audioContext);
this.panEffect = new PanEffect(this.audioEngine);

@@ -125,3 +125,4 @@ // Chain the audio effects together

this.pitchEffect.set(0, this.activeSoundPlayers);
this.effectsNode.gain.value = 1;
if (this.audioEngine === null) return;
this.effectsNode.gain.setTargetAtTime(1.0, 0, this.audioEngine.DECAY_TIME);
}

@@ -134,3 +135,4 @@

setVolume (value) {
this.effectsNode.gain.value = value / 100;
if (this.audioEngine === null) return;
this.effectsNode.gain.setTargetAtTime(value / 100, 0, this.audioEngine.DECAY_TIME);
}

@@ -171,2 +173,12 @@ }

/**
* A short duration, for use as a time constant for exponential audio parameter transitions.
* See:
* https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/setTargetAtTime
* @const {number}
*/
get DECAY_TIME () {
return 0.001;
}
/**
* Decode a sound, decompressing it into audio samples.

@@ -173,0 +185,0 @@ * Store a reference to it the sound in the audioBuffers dictionary, indexed by soundId

Sorry, the diff of this file is too big to display

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