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

@ryohey/wavelet

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ryohey/wavelet - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

1

.rollup.cache/C/Users/warinside/Documents/GitHub/wavelet/lib/dist/processor/SynthEventHandler.d.ts

@@ -13,2 +13,3 @@ import { ImmediateEvent, MIDIEventBody, SynthEvent } from "../SynthEvent";

handleDelayableEvent(e: MIDIEventBody): void;
private removeScheduledEvents;
}

24

.rollup.cache/C/Users/warinside/Documents/GitHub/wavelet/lib/dist/processor/SynthEventHandler.js

@@ -15,3 +15,3 @@ import { MIDIControlEvents } from "midifile-ts";

// handle in process
this.scheduledEvents.push({ ...e, receivedFrame: currentFrame });
this.scheduledEvents.unshift({ ...e, receivedFrame: currentFrame });
}

@@ -23,8 +23,8 @@ else {

processScheduledEvents() {
this.scheduledEvents = this.scheduledEvents.filter((e) => {
arrayRemove(this.scheduledEvents, (e) => {
if (e.receivedFrame + e.delayTime <= currentFrame) {
this.handleDelayableEvent(e.midi);
return false;
return true;
}
return true;
return false;
});

@@ -37,6 +37,2 @@ }

break;
case "stop":
this.scheduledEvents = [];
this.processor.stop();
break;
}

@@ -120,2 +116,3 @@ }

case MIDIControlEvents.ALL_SOUNDS_OFF:
this.removeScheduledEvents(e.channel);
this.processor.allSoundsOff(e.channel);

@@ -151,3 +148,14 @@ break;

}
removeScheduledEvents(channel) {
arrayRemove(this.scheduledEvents, (e) => e.midi.channel === channel);
}
}
function arrayRemove(arr, test) {
for (let i = arr.length - 1; i >= 0; i--) {
const ev = arr[i];
if (test(ev)) {
arr.splice(i, 1);
}
}
}
//# sourceMappingURL=SynthEventHandler.js.map

@@ -21,5 +21,4 @@ import { SampleData } from "../SynthEvent";

modulation(channel: number, value: number): void;
stop(): void;
private getChannelState;
process(_inputs: Float32Array[][], outputs: Float32Array[][]): boolean;
}

@@ -127,11 +127,2 @@ import { logger } from "./logger";

}
stop() {
for (const state of Object.values(this.channels)) {
for (const key in state.oscillators) {
for (const osc of state.oscillators[key]) {
osc.forceStop();
}
}
}
}
getChannelState(channel) {

@@ -138,0 +129,0 @@ const state = this.channels[channel];

@@ -1,2 +0,2 @@

import { AnyEvent } from "midifile-ts";
import { AnyChannelEvent } from "midifile-ts";
import { AmplitudeEnvelopeParameter } from "./processor/AmplitudeEnvelope";

@@ -30,6 +30,3 @@ import { DistributiveOmit } from "./types";

}
export interface StopEvent {
type: "stop";
}
export declare type MIDIEventBody = DistributiveOmit<AnyEvent, "deltaTime">;
export declare type MIDIEventBody = DistributiveOmit<AnyChannelEvent, "deltaTime">;
export declare type MIDIEvent = {

@@ -40,4 +37,4 @@ type: "midi";

};
export declare type ImmediateEvent = LoadSampleEvent | StopEvent;
export declare type ImmediateEvent = LoadSampleEvent;
export declare type SynthEvent = ImmediateEvent | MIDIEvent;
export declare const DrumInstrumentNumber = 128;

@@ -937,3 +937,3 @@ (function () {

// handle in process
this.scheduledEvents.push({ ...e, receivedFrame: currentFrame });
this.scheduledEvents.unshift({ ...e, receivedFrame: currentFrame });
}

@@ -945,8 +945,8 @@ else {

processScheduledEvents() {
this.scheduledEvents = this.scheduledEvents.filter((e) => {
arrayRemove(this.scheduledEvents, (e) => {
if (e.receivedFrame + e.delayTime <= currentFrame) {
this.handleDelayableEvent(e.midi);
return false;
return true;
}
return true;
return false;
});

@@ -959,6 +959,2 @@ }

break;
case "stop":
this.scheduledEvents = [];
this.processor.stop();
break;
}

@@ -1042,2 +1038,3 @@ }

case MIDIControlEvents_1.ALL_SOUNDS_OFF:
this.removeScheduledEvents(e.channel);
this.processor.allSoundsOff(e.channel);

@@ -1073,3 +1070,14 @@ break;

}
removeScheduledEvents(channel) {
arrayRemove(this.scheduledEvents, (e) => e.midi.channel === channel);
}
}
function arrayRemove(arr, test) {
for (let i = arr.length - 1; i >= 0; i--) {
const ev = arr[i];
if (test(ev)) {
arr.splice(i, 1);
}
}
}

@@ -1409,11 +1417,2 @@ var EnvelopePhase;

}
stop() {
for (const state of Object.values(this.channels)) {
for (const key in state.oscillators) {
for (const osc of state.oscillators[key]) {
osc.forceStop();
}
}
}
}
getChannelState(channel) {

@@ -1420,0 +1419,0 @@ const state = this.channels[channel];

@@ -13,2 +13,3 @@ import { ImmediateEvent, MIDIEventBody, SynthEvent } from "../SynthEvent";

handleDelayableEvent(e: MIDIEventBody): void;
private removeScheduledEvents;
}

@@ -21,5 +21,4 @@ import { SampleData } from "../SynthEvent";

modulation(channel: number, value: number): void;
stop(): void;
private getChannelState;
process(_inputs: Float32Array[][], outputs: Float32Array[][]): boolean;
}

@@ -1,2 +0,2 @@

import { AnyEvent } from "midifile-ts";
import { AnyChannelEvent } from "midifile-ts";
import { AmplitudeEnvelopeParameter } from "./processor/AmplitudeEnvelope";

@@ -30,6 +30,3 @@ import { DistributiveOmit } from "./types";

}
export interface StopEvent {
type: "stop";
}
export declare type MIDIEventBody = DistributiveOmit<AnyEvent, "deltaTime">;
export declare type MIDIEventBody = DistributiveOmit<AnyChannelEvent, "deltaTime">;
export declare type MIDIEvent = {

@@ -40,4 +37,4 @@ type: "midi";

};
export declare type ImmediateEvent = LoadSampleEvent | StopEvent;
export declare type ImmediateEvent = LoadSampleEvent;
export declare type SynthEvent = ImmediateEvent | MIDIEvent;
export declare const DrumInstrumentNumber = 128;
{
"name": "@ryohey/wavelet",
"version": "0.2.0",
"version": "0.3.0",
"description": "A wavetable synthesizer that never stops the UI thread created by AudioWorklet.",

@@ -15,3 +15,3 @@ "main": "dist/index.js",

"@ryohey/sf2parser": "^1.2.0",
"midifile-ts": "^1.3.1"
"midifile-ts": "^1.3.2"
},

@@ -18,0 +18,0 @@ "devDependencies": {

@@ -37,3 +37,3 @@ import { ControllerEvent, MIDIControlEvents } from "midifile-ts"

// handle in process
this.scheduledEvents.push({ ...e, receivedFrame: currentFrame })
this.scheduledEvents.unshift({ ...e, receivedFrame: currentFrame })
} else {

@@ -45,8 +45,8 @@ this.handleImmediateEvent(e)

processScheduledEvents() {
this.scheduledEvents = this.scheduledEvents.filter((e) => {
arrayRemove(this.scheduledEvents, (e) => {
if (e.receivedFrame + e.delayTime <= currentFrame) {
this.handleDelayableEvent(e.midi)
return false
return true
}
return true
return false
})

@@ -66,6 +66,2 @@ }

break
case "stop":
this.scheduledEvents = []
this.processor.stop()
break
}

@@ -153,2 +149,3 @@ }

case MIDIControlEvents.ALL_SOUNDS_OFF:
this.removeScheduledEvents(e.channel)
this.processor.allSoundsOff(e.channel)

@@ -184,2 +181,15 @@ break

}
private removeScheduledEvents(channel: number) {
arrayRemove(this.scheduledEvents, (e) => e.midi.channel === channel)
}
}
function arrayRemove<T>(arr: T[], test: (e: T) => boolean) {
for (let i = arr.length - 1; i >= 0; i--) {
const ev = arr[i]
if (test(ev)) {
arr.splice(i, 1)
}
}
}

@@ -185,12 +185,2 @@ import { SampleData, SynthEvent } from "../SynthEvent"

stop() {
for (const state of Object.values(this.channels)) {
for (const key in state.oscillators) {
for (const osc of state.oscillators[key]) {
osc.forceStop()
}
}
}
}
private getChannelState(channel: number): ChannelState {

@@ -197,0 +187,0 @@ const state = this.channels[channel]

@@ -1,2 +0,2 @@

import { AnyEvent } from "midifile-ts"
import { AnyChannelEvent } from "midifile-ts"
import { AmplitudeEnvelopeParameter } from "./processor/AmplitudeEnvelope"

@@ -37,8 +37,4 @@ import { DistributiveOmit } from "./types"

export interface StopEvent {
type: "stop"
}
export type MIDIEventBody = DistributiveOmit<AnyChannelEvent, "deltaTime">
export type MIDIEventBody = DistributiveOmit<AnyEvent, "deltaTime">
export type MIDIEvent = {

@@ -50,5 +46,5 @@ type: "midi"

export type ImmediateEvent = LoadSampleEvent | StopEvent
export type ImmediateEvent = LoadSampleEvent
export type SynthEvent = ImmediateEvent | MIDIEvent
export const DrumInstrumentNumber = 128

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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