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

gameboy-sound

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gameboy-sound - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

37

lib/gameboy-sound.js

@@ -6,2 +6,3 @@ window.AudioContext = window.AudioContext || window.webkitAudioContext;

const ctx = new AudioContext();
export const audioContext = ctx;

@@ -23,16 +24,6 @@ export function allow() {

}
globalVolumeNode.connect(ctx.destination);
// filters to make it sound nicer?
const less = ctx.createGain();
less.gain.setValueAtTime(.25, ctx.currentTime);
const biquadFilter = ctx.createBiquadFilter();
biquadFilter.type = "lowshelf";
biquadFilter.frequency.setValueAtTime(500, ctx.currentTime);
biquadFilter.gain.setValueAtTime(25, ctx.currentTime);
export const audioNode = globalVolumeNode;
// connect it all together
globalVolumeNode.connect(less);
less.connect(biquadFilter);
biquadFilter.connect(ctx.destination);
function baseChannel(ctx, dest=ctx.destination) {

@@ -80,3 +71,3 @@ const gainNode = ctx.createGain();

if (fade === 0) break;
t1 += (1/64)*fade;
t1 += (1/64)*Math.abs(fade);
volume -= Math.sign(fade);

@@ -132,12 +123,11 @@ }

if (sweepFactor < 0) {
const lastShadowFreq = shadowFreq;
shadowFreq -= shadowFreq >> Math.abs(sweepFactor);
if (shadowFreq === lastShadowFreq) break;
} else {
shadowFreq += shadowFreq >> Math.abs(sweepFactor);
if (shadowFreq + (shadowFreq>>Math.abs(sweepFactor)) >= 2048) {
rateChanges.push({ time: t1, rate: null });
break;
}
const lastShadowFreq = shadowFreq;
const dFreq = Math.sign(sweepFactor) * shadowFreq >> Math.abs(sweepFactor);
shadowFreq += dFreq;
if (shadowFreq === lastShadowFreq) break;
if (shadowFreq + dFreq >= 2048) {
rateChanges.push({ time: t1, rate: null });
break;
}

@@ -264,2 +254,3 @@

node.loopStart = loopStart;
node.loopEnd = node.buffer.duration;
}

@@ -266,0 +257,0 @@ cb({ node, n, nextNoteAfter });

{
"name": "gameboy-sound",
"version": "0.1.0",
"version": "0.1.1",
"description": "Easy 3 kB library for 98% accurate Gameboy audio",

@@ -5,0 +5,0 @@ "main": "lib/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