@blibliki/engine 0.1.26 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/README.md +252 -76
  2. package/dist/index.cjs +2 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +765 -0
  5. package/dist/index.d.ts +765 -0
  6. package/dist/index.js +2 -0
  7. package/dist/index.js.map +1 -0
  8. package/package.json +19 -31
  9. package/src/Engine.ts +158 -177
  10. package/src/core/IO/AudioIO.ts +72 -0
  11. package/src/core/IO/Base.ts +118 -0
  12. package/src/core/IO/Collection.ts +123 -47
  13. package/src/core/IO/MidiIO.ts +43 -0
  14. package/src/core/IO/PolyAudioIO.ts +115 -0
  15. package/src/core/IO/index.ts +7 -61
  16. package/src/core/Note/frequencyTable.ts +144 -144
  17. package/src/core/Note/index.ts +49 -59
  18. package/src/core/Route.ts +79 -0
  19. package/src/core/Timing/Scheduler.ts +37 -0
  20. package/src/core/Timing/Time.ts +103 -0
  21. package/src/core/Timing/Transport.ts +104 -0
  22. package/src/core/Timing/index.ts +16 -0
  23. package/src/core/index.ts +36 -0
  24. package/src/core/midi/{ComputerKeyboardInput.ts → ComputerKeyboardDevice.ts} +31 -11
  25. package/src/core/midi/MidiDevice.ts +38 -31
  26. package/src/core/midi/MidiDeviceManager.ts +54 -55
  27. package/src/core/midi/MidiEvent.ts +36 -60
  28. package/src/core/module/Module.ts +233 -0
  29. package/src/core/module/PolyModule.ts +246 -0
  30. package/src/core/module/VoiceScheduler.ts +121 -0
  31. package/src/core/module/index.ts +3 -0
  32. package/src/core/schema.ts +41 -0
  33. package/src/index.ts +31 -9
  34. package/src/modules/BiquadFilter.ts +162 -0
  35. package/src/modules/Constant.ts +72 -0
  36. package/src/modules/Envelope.ts +178 -0
  37. package/src/modules/Filter.ts +109 -104
  38. package/src/modules/Gain.ts +78 -0
  39. package/src/modules/Inspector.ts +59 -0
  40. package/src/modules/Master.ts +18 -21
  41. package/src/modules/MidiSelector.ts +50 -50
  42. package/src/modules/Oscillator.ts +202 -148
  43. package/src/modules/Scale.ts +79 -0
  44. package/src/modules/StepSequencer.ts +61 -0
  45. package/src/modules/VirtualMidi.ts +33 -49
  46. package/src/modules/index.ts +159 -74
  47. package/src/nodePolyfill.ts +25 -0
  48. package/src/processors/filter-processor.ts +82 -0
  49. package/src/processors/index.ts +28 -0
  50. package/src/processors/scale-processor.ts +81 -0
  51. package/dist/build/Engine.d.ts +0 -82
  52. package/dist/build/core/IO/AudioNode.d.ts +0 -35
  53. package/dist/build/core/IO/Collection.d.ts +0 -13
  54. package/dist/build/core/IO/ForwardNode/Base.d.ts +0 -18
  55. package/dist/build/core/IO/ForwardNode/index.d.ts +0 -27
  56. package/dist/build/core/IO/ForwardNode.d.ts +0 -38
  57. package/dist/build/core/IO/MidiNode.d.ts +0 -30
  58. package/dist/build/core/IO/Node.d.ts +0 -40
  59. package/dist/build/core/IO/index.d.ts +0 -21
  60. package/dist/build/core/Module/MonoModule.d.ts +0 -67
  61. package/dist/build/core/Module/PolyModule.d.ts +0 -61
  62. package/dist/build/core/Module/index.d.ts +0 -6
  63. package/dist/build/core/Note/frequencyTable.d.ts +0 -4
  64. package/dist/build/core/Note/index.d.ts +0 -28
  65. package/dist/build/core/midi/ComputerKeyboardInput.d.ts +0 -11
  66. package/dist/build/core/midi/MidiDevice.d.ts +0 -29
  67. package/dist/build/core/midi/MidiDeviceManager.d.ts +0 -14
  68. package/dist/build/core/midi/MidiEvent.d.ts +0 -21
  69. package/dist/build/core/midi/index.d.ts +0 -5
  70. package/dist/build/index.d.ts +0 -9
  71. package/dist/build/modules/BitCrusher.d.ts +0 -16
  72. package/dist/build/modules/Delay.d.ts +0 -19
  73. package/dist/build/modules/Distortion.d.ts +0 -16
  74. package/dist/build/modules/Effect.d.ts +0 -19
  75. package/dist/build/modules/Envelope/AmpEnvelope.d.ts +0 -18
  76. package/dist/build/modules/Envelope/Base.d.ts +0 -66
  77. package/dist/build/modules/Envelope/FreqEnvelope.d.ts +0 -25
  78. package/dist/build/modules/Envelope/index.d.ts +0 -3
  79. package/dist/build/modules/Filter.d.ts +0 -42
  80. package/dist/build/modules/LFO.d.ts +0 -44
  81. package/dist/build/modules/Master.d.ts +0 -11
  82. package/dist/build/modules/MidiSelector.d.ts +0 -21
  83. package/dist/build/modules/Oscillator.d.ts +0 -55
  84. package/dist/build/modules/Reverb.d.ts +0 -19
  85. package/dist/build/modules/Sequencer.d.ts +0 -42
  86. package/dist/build/modules/VirtualMidi.d.ts +0 -32
  87. package/dist/build/modules/VoiceScheduler.d.ts +0 -44
  88. package/dist/build/modules/Volume.d.ts +0 -26
  89. package/dist/build/modules/index.d.ts +0 -17
  90. package/dist/build/routes.d.ts +0 -18
  91. package/dist/build/types.d.ts +0 -5
  92. package/dist/build/utils.d.ts +0 -1
  93. package/dist/main.cjs.js +0 -25
  94. package/dist/main.cjs.js.map +0 -1
  95. package/dist/main.esm.js +0 -25
  96. package/dist/main.esm.js.map +0 -1
  97. package/src/core/IO/AudioNode.ts +0 -82
  98. package/src/core/IO/ForwardNode/Base.ts +0 -99
  99. package/src/core/IO/ForwardNode/index.ts +0 -60
  100. package/src/core/IO/MidiNode.ts +0 -67
  101. package/src/core/IO/Node.ts +0 -118
  102. package/src/core/Module/MonoModule.ts +0 -219
  103. package/src/core/Module/PolyModule.ts +0 -218
  104. package/src/core/Module/index.ts +0 -15
  105. package/src/core/midi/index.ts +0 -5
  106. package/src/modules/BitCrusher.ts +0 -45
  107. package/src/modules/Delay.ts +0 -53
  108. package/src/modules/Distortion.ts +0 -45
  109. package/src/modules/Effect.ts +0 -46
  110. package/src/modules/Envelope/AmpEnvelope.ts +0 -23
  111. package/src/modules/Envelope/Base.ts +0 -176
  112. package/src/modules/Envelope/FreqEnvelope.ts +0 -64
  113. package/src/modules/Envelope/index.ts +0 -3
  114. package/src/modules/LFO.ts +0 -149
  115. package/src/modules/Reverb.ts +0 -53
  116. package/src/modules/Sequencer.ts +0 -178
  117. package/src/modules/VoiceScheduler.ts +0 -145
  118. package/src/modules/Volume.ts +0 -72
  119. package/src/routes.ts +0 -49
  120. package/src/types.ts +0 -3
  121. package/src/utils.ts +0 -18
@@ -1,38 +0,0 @@
1
- import IONode, { IOType, IIONode } from "./Node";
2
- import Module, { Connectable, PolyModule } from "../Module";
3
- import { AnyObject } from "../../types";
4
- import { AnyInput, AnyOuput } from ".";
5
- export interface IForwardInput extends IIONode {
6
- ioType: IOType.ForwardInput;
7
- }
8
- export interface IForwardOutput extends IIONode {
9
- ioType: IOType.ForwardOutput;
10
- }
11
- export declare class ForwardInput extends IONode implements IForwardInput {
12
- plugableModule: PolyModule<Module<Connectable, AnyObject>, AnyObject>;
13
- ioType: IOType.ForwardInput;
14
- connections: ForwardOutput[];
15
- constructor(plugableModule: PolyModule<Module<Connectable, AnyObject>, AnyObject>, props: IForwardInput);
16
- get subInputs(): (import("./AudioNode").AudioInput | import("./MidiNode").MidiInput)[];
17
- get subModules(): Module<Connectable, AnyObject>[];
18
- subModule(voiceNo: number): Module<Connectable, AnyObject>;
19
- subInput(voiceNo: number): import("./AudioNode").AudioInput | import("./MidiNode").MidiInput;
20
- plug(io: AnyOuput, plugOther?: boolean): void;
21
- unPlug(io: AnyOuput, plugOther?: boolean): void;
22
- unPlugAll(): void;
23
- private checkNameValidity;
24
- }
25
- export declare class ForwardOutput extends IONode implements IForwardOutput {
26
- plugableModule: PolyModule<Module<Connectable, AnyObject>, AnyObject>;
27
- ioType: IOType.ForwardOutput;
28
- connections: ForwardInput[];
29
- constructor(plugableModule: PolyModule<Module<Connectable, AnyObject>, AnyObject>, props: IForwardOutput);
30
- get subOutputs(): (import("./AudioNode").AudioOutput | import("./MidiNode").MidiOutput)[];
31
- get subModules(): Module<Connectable, AnyObject>[];
32
- subModule(voiceNo: number): Module<Connectable, AnyObject>;
33
- subOutput(voiceNo: number): import("./AudioNode").AudioOutput | import("./MidiNode").MidiOutput;
34
- plug(io: AnyInput, plugOther?: boolean): void;
35
- unPlug(io: AnyInput, plugOther?: boolean): void;
36
- unPlugAll(): void;
37
- private checkNameValidity;
38
- }
@@ -1,30 +0,0 @@
1
- import { AnyMidiInput, AnyMidiOuput } from ".";
2
- import { AudioModule } from "../Module";
3
- import { MidiEvent } from "../midi";
4
- import IONode, { IOType, IIONode } from "./Node";
5
- export interface IMidiInput extends IIONode {
6
- ioType: IOType.MidiInput;
7
- onMidiEvent: (event: MidiEvent) => void;
8
- }
9
- export interface IMidiOutput extends IIONode {
10
- ioType: IOType.MidiOutput;
11
- }
12
- export declare class MidiInput extends IONode implements IMidiInput {
13
- ioType: IOType.MidiInput;
14
- connections: MidiOutput[];
15
- onMidiEvent: (event: MidiEvent) => void;
16
- constructor(plugableModule: AudioModule, props: IMidiInput);
17
- plug(io: AnyMidiOuput, plugOther?: boolean): void;
18
- unPlug(io: AnyMidiOuput, plugOther?: boolean): void;
19
- unPlugAll(): void;
20
- }
21
- export declare class MidiOutput extends IONode implements IMidiOutput {
22
- ioType: IOType.MidiOutput;
23
- connections: MidiInput[];
24
- constructor(plugableModule: AudioModule, props: IIONode);
25
- plug(io: AnyMidiInput, plugOther?: boolean): void;
26
- unPlug(io: AnyMidiInput, plugOther?: boolean): void;
27
- unPlugAll(): void;
28
- onMidiEvent: (event: MidiEvent) => void;
29
- private get midiConnections();
30
- }
@@ -1,40 +0,0 @@
1
- import { AudioModule } from "../Module";
2
- import { AnyIO } from ".";
3
- export interface IIONode {
4
- name: string;
5
- ioType: IOType;
6
- }
7
- export interface IIOSerialize {
8
- id: string;
9
- name: string;
10
- ioType: IOType;
11
- moduleId: string;
12
- moduleName: string;
13
- }
14
- export declare enum IOType {
15
- AudioInput = "audioInput",
16
- AudioOutput = "audioOutput",
17
- MidiInput = "midiInput",
18
- MidiOutput = "midiOutput",
19
- ForwardAudioInput = "forwardAudioInput",
20
- ForwardAudioOutput = "forwardAudioOutput"
21
- }
22
- export declare function plugCompatibleIO(io1: AnyIO, io2: AnyIO): void;
23
- export declare function unPlugCompatibleIO(io1: AnyIO, io2: AnyIO): void;
24
- export default abstract class IONode implements IIONode {
25
- id: string;
26
- ioType: IOType;
27
- name: string;
28
- plugableModule: AudioModule;
29
- connections: IONode[];
30
- static unPlugAll(io: IONode): void;
31
- constructor(plugableModule: AudioModule, props: IIONode);
32
- plug(io: IONode, plugOther?: boolean): void;
33
- unPlug(io: IONode, plugOther?: boolean): void;
34
- get isInput(): boolean;
35
- get isOutput(): boolean;
36
- get isAudio(): boolean;
37
- get isMidi(): boolean;
38
- abstract unPlugAll(): void;
39
- serialize(): IIOSerialize;
40
- }
@@ -1,21 +0,0 @@
1
- import { default as IOCollection } from "./Collection";
2
- import { IIONode, IOType, IIOSerialize } from "./Node";
3
- import { AudioInput, AudioOutput, IAudioInput, IAudioOutput } from "./AudioNode";
4
- import { IMidiInput, IMidiOutput, MidiInput, MidiOutput } from "./MidiNode";
5
- import { ForwardAudioInput, ForwardAudioOutput, IForwardAudioInput, IForwardAudioOutput } from "./ForwardNode";
6
- type AnyAudioInput = AudioInput | ForwardAudioInput;
7
- type AnyMidiInput = MidiInput;
8
- type AnyAudioOuput = AudioOutput | ForwardAudioOutput;
9
- type AnyMidiOuput = MidiOutput;
10
- type AnyInput = AnyAudioInput | AnyMidiInput;
11
- type AnyOuput = AnyAudioOuput | AnyMidiOuput;
12
- type AnyIO = AnyInput | AnyOuput;
13
- type IAnyAudioInput = IAudioInput | IForwardAudioInput;
14
- type IAnyMidiInput = IMidiInput;
15
- type IAnyAudioOuput = IAudioOutput | IForwardAudioOutput;
16
- type IAnyMidiOuput = IMidiOutput;
17
- type IAnyInput = IAnyAudioInput | IAnyMidiInput;
18
- type IAnyOutput = IAnyAudioOuput | IAnyMidiOuput;
19
- type IAnyIO = IAnyInput | IAnyOutput;
20
- export { IOCollection, IOType, AudioInput, AudioOutput, MidiInput, MidiOutput, ForwardAudioInput, ForwardAudioOutput, };
21
- export type { IAnyIO, IIONode, IAudioInput, IAudioOutput, IMidiInput, IMidiOutput, IForwardAudioInput, IForwardAudioOutput, IAnyInput, IAnyOutput, IIOSerialize, AnyAudioInput, AnyMidiInput, AnyAudioOuput, AnyMidiOuput, AnyInput, AnyOuput, AnyIO, };
@@ -1,67 +0,0 @@
1
- import { InputNode } from "tone";
2
- import { IOCollection, AudioInput, AudioOutput, MidiInput, IMidiInput, IAudioInput, IAudioOutput, MidiOutput, IMidiOutput } from "../IO";
3
- import { MidiEvent } from "../../core/midi";
4
- import { AudioModule } from "./index";
5
- import Note from "../../core/Note";
6
- import { AtLeast } from "../../types";
7
- export interface Startable {
8
- start(time: number): void;
9
- stop(time: number): void;
10
- }
11
- export interface Connectable {
12
- connect: (inputNode: InputNode) => void;
13
- disconnect: (inputNode?: InputNode) => void;
14
- dispose: () => void;
15
- }
16
- export interface Triggerable {
17
- triggerAttack: (note: Note, triggeredAt: number) => void;
18
- triggerRelease: (note: Note, triggeredAt: number) => void;
19
- }
20
- export interface ModuleInterface<PropsInterface> {
21
- id: string;
22
- name: string;
23
- props: PropsInterface;
24
- voiceNo?: number;
25
- }
26
- export declare class DummnyInternalModule implements Connectable {
27
- connect(): void;
28
- disconnect(): void;
29
- dispose(): void;
30
- }
31
- declare abstract class Module<InternalModule extends Connectable, PropsInterface> implements ModuleInterface<PropsInterface> {
32
- static readonly moduleName: string;
33
- readonly id: string;
34
- name: string;
35
- internalModule: InternalModule;
36
- inputs: IOCollection<AudioInput | MidiInput>;
37
- outputs: IOCollection<AudioOutput | MidiOutput>;
38
- readonly voiceNo?: number;
39
- updatedAt: Date;
40
- _props: PropsInterface;
41
- constructor(internalModule: InternalModule, props: AtLeast<ModuleInterface<PropsInterface>, "name">);
42
- set props(value: PropsInterface);
43
- get props(): PropsInterface;
44
- plug(audioModule: AudioModule, from: string, to: string): void;
45
- unPlugAll(): void;
46
- dispose(): void;
47
- triggerAttack: (note: Note, triggeredAt: number) => void;
48
- triggerRelease: (note: Note, triggeredAt: number) => void;
49
- onMidiEvent: (midiEvent: MidiEvent) => void;
50
- private triggerer;
51
- serialize(): {
52
- id: string;
53
- name: string;
54
- type: string;
55
- props: PropsInterface;
56
- inputs: import("../IO").IIOSerialize[];
57
- outputs: import("../IO").IIOSerialize[];
58
- };
59
- protected registerMidiInput(props: Omit<IMidiInput, "ioType">): MidiInput;
60
- protected registerAudioInput(props: Omit<IAudioInput, "ioType">): AudioInput;
61
- protected registerMidiOutput(props: Omit<IMidiOutput, "ioType">): MidiOutput;
62
- protected registerAudioOutput(props: Omit<IAudioOutput, "ioType">): AudioOutput;
63
- protected registerBasicOutputs(): void;
64
- protected registerBasicInputs(): void;
65
- protected registerDefaultMidiInput(): void;
66
- }
67
- export default Module;
@@ -1,61 +0,0 @@
1
- import { MidiEvent } from "../midi";
2
- import Module, { Connectable } from "./MonoModule";
3
- import { IOCollection, IMidiInput, IMidiOutput, MidiOutput, MidiInput, AnyInput, AnyOuput, ForwardAudioInput } from "../IO";
4
- import { AudioModule } from "./index";
5
- import { ForwardAudioOutput, IForwardAudioInput, IForwardAudioOutput } from "../IO/ForwardNode";
6
- interface PolyModuleInterface<MonoAudioModule, PropsInterface> {
7
- id?: string;
8
- name: string;
9
- numberOfVoices?: number;
10
- child: new (params: {
11
- id?: string;
12
- name: string;
13
- props: PropsInterface;
14
- }) => MonoAudioModule;
15
- props: PropsInterface;
16
- }
17
- export default abstract class PolyModule<MonoAudioModule extends Module<Connectable, PropsInterface>, PropsInterface> {
18
- static readonly moduleName: string;
19
- readonly id: string;
20
- readonly child: new (params: {
21
- id?: string;
22
- name: string;
23
- props: PropsInterface;
24
- }) => MonoAudioModule;
25
- _name: string;
26
- audioModules: MonoAudioModule[];
27
- inputs: IOCollection<AnyInput>;
28
- outputs: IOCollection<AnyOuput>;
29
- private _numberOfVoices;
30
- constructor(params: PolyModuleInterface<MonoAudioModule, PropsInterface>);
31
- get name(): string;
32
- set name(value: string);
33
- get props(): PropsInterface;
34
- set props(value: PropsInterface);
35
- get numberOfVoices(): number;
36
- set numberOfVoices(value: number);
37
- plug(audioModule: AudioModule, from: string, to: string): void;
38
- unPlugAll(): void;
39
- dispose(): void;
40
- onMidiEvent: (midiEvent: MidiEvent) => void;
41
- serialize(): {
42
- id: string;
43
- type: string;
44
- numberOfVoices: number;
45
- inputs: import("../IO").IIOSerialize[];
46
- outputs: import("../IO").IIOSerialize[];
47
- name: string;
48
- props: PropsInterface;
49
- };
50
- protected find(callback: (audioModule: MonoAudioModule) => boolean): MonoAudioModule;
51
- protected findVoice(voiceNo: number): MonoAudioModule | undefined;
52
- protected registerForwardAudioInput(props: Omit<IForwardAudioInput, "ioType">): ForwardAudioInput;
53
- protected registerForwardAudioOutput(props: Omit<IForwardAudioOutput, "ioType">): ForwardAudioOutput;
54
- protected registerMidiInput(props: Omit<IMidiInput, "ioType">): MidiInput;
55
- protected registerMidiOutput(props: Omit<IMidiOutput, "ioType">): MidiOutput;
56
- protected registerBasicOutputs(): void;
57
- protected registerBasicInputs(): void;
58
- protected registerMidiIn(): void;
59
- private adjustNumberOfModules;
60
- }
61
- export {};
@@ -1,6 +0,0 @@
1
- import Module, { Connectable } from "./MonoModule";
2
- import PolyModule from "./PolyModule";
3
- export { default, DummnyInternalModule } from "./MonoModule";
4
- export { default as PolyModule } from "./PolyModule";
5
- export type { ModuleInterface, Connectable, Triggerable, Startable, } from "./MonoModule";
6
- export type AudioModule = Module<Connectable, any> | PolyModule<Module<Connectable, any>, any>;
@@ -1,4 +0,0 @@
1
- declare const frequencyTable: {
2
- [key: string]: number;
3
- };
4
- export default frequencyTable;
@@ -1,28 +0,0 @@
1
- export interface INote {
2
- note: string;
3
- frequency: number;
4
- duration: string;
5
- velocity?: number;
6
- }
7
- export default class Note {
8
- static _notes: Note[];
9
- name: string;
10
- octave: number;
11
- velocity: number;
12
- duration: string;
13
- frequency: number;
14
- constructor(eventOrString: Partial<INote> | MIDIMessageEvent | string | number);
15
- static notes(octave?: number): Note[];
16
- get isSemi(): boolean;
17
- get fullName(): string;
18
- midiData(noteOn?: boolean): Uint8Array;
19
- get midiNumber(): number;
20
- get noteIndex(): number;
21
- adjustFrequency(range?: number, coarse?: number): number;
22
- valueOf(): string;
23
- serialize(): INote;
24
- private fromFrequency;
25
- private fromString;
26
- private fromEvent;
27
- private fromProps;
28
- }
@@ -1,11 +0,0 @@
1
- import { IMidiInput, TMidiPortState } from "./MidiDevice";
2
- import MidiEvent from "./MidiEvent";
3
- export default class ComputerKeyboardInput implements IMidiInput {
4
- id: string;
5
- name: string;
6
- state: TMidiPortState;
7
- onmidimessage: ((e: MidiEvent) => void) | null;
8
- constructor();
9
- onKeyTrigger: (noteOn: boolean) => (event: KeyboardEvent) => void;
10
- private extractNote;
11
- }
@@ -1,29 +0,0 @@
1
- import MidiEvent from "./MidiEvent";
2
- export type TMidiPortState = "connected" | "disconnected";
3
- export interface MidiDeviceInterface {
4
- id: string;
5
- name: string;
6
- state: TMidiPortState;
7
- }
8
- export interface IMidiInput extends MidiDeviceInterface {
9
- onmidimessage: ((e: MidiEvent) => void) | null;
10
- }
11
- export type EventListerCallback = (event: MidiEvent) => void;
12
- export default class MidiDevice implements MidiDeviceInterface {
13
- id: string;
14
- name: string;
15
- state: TMidiPortState;
16
- eventListerCallbacks: EventListerCallback[];
17
- private _midi;
18
- constructor(midi: IMidiInput);
19
- connect(): void;
20
- disconnect(): void;
21
- serialize(): {
22
- id: string;
23
- name: string;
24
- state: TMidiPortState;
25
- };
26
- addEventListener(callback: EventListerCallback): void;
27
- removeEventListener(callback: EventListerCallback): void;
28
- private processEvent;
29
- }
@@ -1,14 +0,0 @@
1
- import MidiDevice from "./MidiDevice";
2
- export default class MidiDeviceManager {
3
- devices: {
4
- [Key: string]: MidiDevice;
5
- };
6
- private initialized;
7
- private computerKeyboardInput;
8
- constructor();
9
- find(id: string): MidiDevice | null;
10
- onStateChange(callback: (device: MidiDevice) => void): void;
11
- private listenChanges;
12
- private initializeDevices;
13
- private inputs;
14
- }
@@ -1,21 +0,0 @@
1
- import { ISequence } from "../../modules";
2
- import Note, { INote } from "../Note";
3
- export type MidiEventType = "noteOn" | "noteOff" | "cc";
4
- export default class MidiEvent {
5
- note: Note;
6
- voiceNo?: number;
7
- readonly triggeredAt: number;
8
- _type: MidiEventType;
9
- private data;
10
- private event;
11
- static fromSequence(sequence: ISequence, triggeredAt: number): MidiEvent[];
12
- static fromNote(noteName: string | Note | INote, noteOn?: boolean, triggeredAt?: number): MidiEvent;
13
- static fromCC(cc: number, value: number, triggeredAt?: number): MidiEvent;
14
- constructor(event: MIDIMessageEvent, triggeredAt?: number);
15
- get statusByte(): number;
16
- get firstData(): number;
17
- get secondData(): number;
18
- get type(): MidiEventType;
19
- get isNote(): boolean;
20
- defineNotes(): void;
21
- }
@@ -1,5 +0,0 @@
1
- export { default as MidiEvent } from "./MidiEvent";
2
- export { default as MidiDevice } from "./MidiDevice";
3
- export { default as MidiDeviceManager } from "./MidiDeviceManager";
4
- export type { MidiDeviceInterface } from "./MidiDevice";
5
- export type { MidiEventType } from "./MidiEvent";
@@ -1,9 +0,0 @@
1
- export { default } from "./Engine";
2
- export { MidiDevice, MidiDeviceManager } from "./core/midi";
3
- export { default as Note } from "./core/Note";
4
- export type { MidiDeviceInterface } from "./core/midi";
5
- export type { INote } from "./core/Note";
6
- export type { ModuleInterface, AudioModule } from "./core/Module";
7
- export type { ISequence } from "./modules";
8
- export type { RouteInterface, RouteProps } from "./routes";
9
- export type { IIOSerialize as IOProps } from "./core/IO";
@@ -1,16 +0,0 @@
1
- import { BitCrusher as InternalBitCrasher } from "tone";
2
- import Effect, { EffectInterface } from "./Effect";
3
- interface BitCrusherInterface extends EffectInterface {
4
- bits: number;
5
- }
6
- export default class BitCrusher extends Effect<InternalBitCrasher, BitCrusherInterface> {
7
- static moduleName: string;
8
- constructor(params: {
9
- id?: string;
10
- name: string;
11
- props: Partial<BitCrusherInterface>;
12
- });
13
- get bits(): number;
14
- set bits(value: number);
15
- }
16
- export {};
@@ -1,19 +0,0 @@
1
- import { FeedbackDelay } from "tone";
2
- import Effect, { EffectInterface } from "./Effect";
3
- interface DelayInterface extends EffectInterface {
4
- delayTime: number;
5
- feedback: number;
6
- }
7
- export default class Delay extends Effect<FeedbackDelay, DelayInterface> {
8
- static moduleName: string;
9
- constructor(params: {
10
- id?: string;
11
- name: string;
12
- props: Partial<DelayInterface>;
13
- });
14
- get delayTime(): number;
15
- set delayTime(value: number);
16
- get feedback(): number;
17
- set feedback(value: number);
18
- }
19
- export {};
@@ -1,16 +0,0 @@
1
- import { Distortion as InternalDistortion } from "tone";
2
- import Effect, { EffectInterface } from "./Effect";
3
- interface DistortionInterface extends EffectInterface {
4
- drive: number;
5
- }
6
- export default class Distortion extends Effect<InternalDistortion, DistortionInterface> {
7
- static moduleName: string;
8
- constructor(params: {
9
- id?: string;
10
- name: string;
11
- props: Partial<DistortionInterface>;
12
- });
13
- get drive(): number;
14
- set drive(value: number);
15
- }
16
- export {};
@@ -1,19 +0,0 @@
1
- import { Signal } from "tone";
2
- import Module, { Connectable } from "../core/Module";
3
- interface EffectLike extends Connectable {
4
- wet: Signal<"normalRange">;
5
- }
6
- export interface EffectInterface {
7
- wet: number;
8
- }
9
- export default abstract class Effect<InternalEffect extends EffectLike, ModuleInterface extends EffectInterface> extends Module<InternalEffect, ModuleInterface> {
10
- constructor(params: {
11
- id?: string;
12
- name: string;
13
- internalModule: InternalEffect;
14
- props: Partial<ModuleInterface>;
15
- });
16
- get wet(): number;
17
- set wet(value: number);
18
- }
19
- export {};
@@ -1,18 +0,0 @@
1
- import { AmplitudeEnvelope } from "tone";
2
- import Base, { EnvelopeInterface, PolyBase } from "./Base";
3
- declare class MonoAmpEnvelope extends Base<AmplitudeEnvelope> {
4
- constructor(params: {
5
- id?: string;
6
- name: string;
7
- props: EnvelopeInterface;
8
- });
9
- }
10
- export default class AmpEnvelope extends PolyBase<MonoAmpEnvelope> {
11
- static moduleName: string;
12
- constructor(params: {
13
- id?: string;
14
- name: string;
15
- props: Partial<EnvelopeInterface>;
16
- });
17
- }
18
- export {};
@@ -1,66 +0,0 @@
1
- import { Envelope as Env } from "tone";
2
- import Module, { PolyModule, Connectable, Triggerable } from "../../core/Module";
3
- import Note from "../../core/Note";
4
- export declare const enum EnvelopeStages {
5
- Attack = "attack",
6
- Decay = "decay",
7
- Sustain = "sustain",
8
- Release = "release"
9
- }
10
- export interface EnvelopeInterface {
11
- attack: number;
12
- decay: number;
13
- sustain: number;
14
- release: number;
15
- }
16
- export default abstract class EnvelopeModule<EnvelopeLike extends Env> extends Module<EnvelopeLike, EnvelopeInterface> implements Triggerable {
17
- activeNote?: string;
18
- triggeredAt: number;
19
- constructor(params: {
20
- id?: string;
21
- name: string;
22
- internalModule: EnvelopeLike;
23
- props: EnvelopeInterface;
24
- });
25
- get attack(): number;
26
- set attack(value: number);
27
- get decay(): number;
28
- set decay(value: number);
29
- get sustain(): number;
30
- set sustain(value: number);
31
- get release(): number;
32
- set release(value: number);
33
- setStage(stage: EnvelopeStages, value: number): void;
34
- triggerAttack: (note: Note, triggeredAt: number) => void;
35
- triggerRelease: (note: Note, triggeredAt: number) => void;
36
- private maxTime;
37
- private minTime;
38
- }
39
- export declare abstract class PolyBase<EnvelopeModule extends Module<Connectable, EnvelopeInterface>> extends PolyModule<EnvelopeModule, EnvelopeInterface> {
40
- constructor(params: {
41
- id?: string;
42
- name: string;
43
- child: new (params: {
44
- id?: string;
45
- name: string;
46
- props: EnvelopeInterface;
47
- }) => EnvelopeModule;
48
- props: Partial<EnvelopeInterface>;
49
- });
50
- }
51
- declare class MonoEnvelope extends EnvelopeModule<Env> {
52
- constructor(params: {
53
- id?: string;
54
- name: string;
55
- props: EnvelopeInterface;
56
- });
57
- }
58
- export declare class Envelope extends PolyBase<MonoEnvelope> {
59
- static moduleName: string;
60
- constructor(params: {
61
- id?: string;
62
- name: string;
63
- props: Partial<EnvelopeInterface>;
64
- });
65
- }
66
- export {};
@@ -1,25 +0,0 @@
1
- import { FrequencyEnvelope } from "tone";
2
- import Filter from "../Filter";
3
- import Base, { EnvelopeInterface, PolyBase } from "./Base";
4
- export declare class MonoFreqEnvelope extends Base<FrequencyEnvelope> {
5
- private _frequency;
6
- private _amount;
7
- filter: Filter;
8
- constructor(params: {
9
- id?: string;
10
- name: string;
11
- props: EnvelopeInterface;
12
- });
13
- get frequency(): number;
14
- set frequency(value: number);
15
- get amount(): number;
16
- set amount(value: number);
17
- }
18
- export default class FreqEnvelope extends PolyBase<MonoFreqEnvelope> {
19
- static moduleName: string;
20
- constructor(params: {
21
- id?: string;
22
- name: string;
23
- props: Partial<EnvelopeInterface>;
24
- });
25
- }
@@ -1,3 +0,0 @@
1
- export { default, Envelope, EnvelopeStages } from "./Base";
2
- export { default as AmpEnvelope } from "./AmpEnvelope";
3
- export { default as FreqEnvelope, MonoFreqEnvelope } from "./FreqEnvelope";
@@ -1,42 +0,0 @@
1
- import { Filter as InternalFilter, FilterRollOff } from "tone";
2
- import Module, { PolyModule } from "../core/Module";
3
- interface FilterInterface {
4
- cutoff: number;
5
- filterType: BiquadFilterType;
6
- resonance: number;
7
- slope: FilterRollOff;
8
- envelopeAmount: number;
9
- }
10
- type FilterProps = Partial<FilterInterface>;
11
- declare class MonoFilter extends Module<InternalFilter, FilterInterface> {
12
- private _cutoff;
13
- private _amount;
14
- constructor(params: {
15
- id?: string;
16
- name: string;
17
- props: FilterProps;
18
- });
19
- get cutoff(): number;
20
- set cutoff(value: number);
21
- get filterType(): BiquadFilterType;
22
- set filterType(value: BiquadFilterType);
23
- get slope(): FilterRollOff;
24
- set slope(value: FilterRollOff);
25
- get frequency(): import("tone").Signal<"frequency">;
26
- get resonance(): number;
27
- set resonance(value: number);
28
- get envelopeAmount(): number;
29
- set envelopeAmount(value: number);
30
- private registerOutputs;
31
- private updateAmountFactor;
32
- }
33
- export default class Filter extends PolyModule<MonoFilter, FilterInterface> {
34
- static moduleName: string;
35
- constructor(params: {
36
- id?: string;
37
- name: string;
38
- props: Partial<FilterInterface>;
39
- });
40
- private registerOutputs;
41
- }
42
- export {};