@blibliki/engine 0.1.27 → 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 (123) 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 -19484
  7. package/dist/index.js.map +1 -0
  8. package/package.json +16 -27
  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 +203 -158
  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/index.umd.cjs +0 -227
  52. package/dist/src/Engine.d.ts +0 -83
  53. package/dist/src/core/IO/AudioNode.d.ts +0 -36
  54. package/dist/src/core/IO/Collection.d.ts +0 -14
  55. package/dist/src/core/IO/ForwardNode/Base.d.ts +0 -19
  56. package/dist/src/core/IO/ForwardNode/index.d.ts +0 -28
  57. package/dist/src/core/IO/MidiNode.d.ts +0 -31
  58. package/dist/src/core/IO/Node.d.ts +0 -41
  59. package/dist/src/core/IO/index.d.ts +0 -22
  60. package/dist/src/core/Module/MonoModule.d.ts +0 -68
  61. package/dist/src/core/Module/PolyModule.d.ts +0 -62
  62. package/dist/src/core/Module/index.d.ts +0 -7
  63. package/dist/src/core/Note/frequencyTable.d.ts +0 -4
  64. package/dist/src/core/Note/index.d.ts +0 -28
  65. package/dist/src/core/midi/ComputerKeyboardInput.d.ts +0 -12
  66. package/dist/src/core/midi/MidiDevice.d.ts +0 -30
  67. package/dist/src/core/midi/MidiDeviceManager.d.ts +0 -15
  68. package/dist/src/core/midi/MidiEvent.d.ts +0 -22
  69. package/dist/src/core/midi/index.d.ts +0 -5
  70. package/dist/src/index.d.ts +0 -9
  71. package/dist/src/main.d.ts +0 -0
  72. package/dist/src/modules/BitCrusher.d.ts +0 -17
  73. package/dist/src/modules/Delay.d.ts +0 -20
  74. package/dist/src/modules/Distortion.d.ts +0 -17
  75. package/dist/src/modules/Effect.d.ts +0 -20
  76. package/dist/src/modules/Envelope/AmpEnvelope.d.ts +0 -19
  77. package/dist/src/modules/Envelope/Base.d.ts +0 -67
  78. package/dist/src/modules/Envelope/FreqEnvelope.d.ts +0 -26
  79. package/dist/src/modules/Envelope/index.d.ts +0 -3
  80. package/dist/src/modules/Filter.d.ts +0 -43
  81. package/dist/src/modules/LFO.d.ts +0 -45
  82. package/dist/src/modules/Master.d.ts +0 -12
  83. package/dist/src/modules/MidiSelector.d.ts +0 -22
  84. package/dist/src/modules/Oscillator.d.ts +0 -56
  85. package/dist/src/modules/Reverb.d.ts +0 -20
  86. package/dist/src/modules/Sequencer.d.ts +0 -43
  87. package/dist/src/modules/VirtualMidi.d.ts +0 -33
  88. package/dist/src/modules/VoiceScheduler.d.ts +0 -45
  89. package/dist/src/modules/Volume.d.ts +0 -27
  90. package/dist/src/modules/index.d.ts +0 -18
  91. package/dist/src/routes.d.ts +0 -19
  92. package/dist/src/types.d.ts +0 -5
  93. package/dist/src/utils.d.ts +0 -1
  94. package/dist/test/MockingModules.d.ts +0 -22
  95. package/dist/test/Module/Oscillator.test.d.ts +0 -1
  96. package/dist/test/core/IO.test.d.ts +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/main.ts +0 -1
  107. package/src/modules/BitCrusher.ts +0 -45
  108. package/src/modules/Delay.ts +0 -53
  109. package/src/modules/Distortion.ts +0 -45
  110. package/src/modules/Effect.ts +0 -46
  111. package/src/modules/Envelope/AmpEnvelope.ts +0 -23
  112. package/src/modules/Envelope/Base.ts +0 -176
  113. package/src/modules/Envelope/FreqEnvelope.ts +0 -64
  114. package/src/modules/Envelope/index.ts +0 -3
  115. package/src/modules/LFO.ts +0 -149
  116. package/src/modules/Reverb.ts +0 -53
  117. package/src/modules/Sequencer.ts +0 -178
  118. package/src/modules/VoiceScheduler.ts +0 -145
  119. package/src/modules/Volume.ts +0 -72
  120. package/src/routes.ts +0 -49
  121. package/src/types.ts +0 -3
  122. package/src/utils.ts +0 -18
  123. package/src/vite-env.d.ts +0 -1
@@ -1,83 +0,0 @@
1
- import { AnyObject, Optional } from './types';
2
- import { RouteInterface } from './routes';
3
- import { AudioModule } from './core/Module';
4
- import { MidiDeviceManager } from './core/midi';
5
-
6
- type LatencyHint = "interactive" | "playback" | "balanced";
7
- interface ContextInterface {
8
- latencyHint: LatencyHint;
9
- lookAhead: number;
10
- }
11
- interface InitializeInterface {
12
- context?: Partial<ContextInterface>;
13
- }
14
- export interface UpdateModuleProps {
15
- id: string;
16
- changes: {
17
- name?: string;
18
- numberOfVoices?: number;
19
- props?: AnyObject;
20
- };
21
- }
22
- declare class Engine {
23
- midiDeviceManager: MidiDeviceManager;
24
- private static instance;
25
- private context;
26
- private propsUpdateCallbacks;
27
- private _isStarted;
28
- modules: {
29
- [Identifier: string]: AudioModule;
30
- };
31
- routes: {
32
- [Identifier: string]: RouteInterface;
33
- };
34
- private constructor();
35
- static getInstance(): Engine;
36
- initialize(props: InitializeInterface): Promise<unknown>;
37
- addModule(params: {
38
- id?: string;
39
- name: string;
40
- numberOfVoices?: number;
41
- type: string;
42
- props?: AnyObject;
43
- }): {
44
- id: string;
45
- name: string;
46
- type: string;
47
- props: any;
48
- inputs: import('.').IOProps[];
49
- outputs: import('.').IOProps[];
50
- };
51
- removeModule(id: string): string[];
52
- updateModule(params: UpdateModuleProps): {
53
- id: string;
54
- name: string;
55
- type: string;
56
- props: any;
57
- inputs: import('.').IOProps[];
58
- outputs: import('.').IOProps[];
59
- };
60
- onPropsUpdate(callback: (id: string, props: AnyObject) => void): void;
61
- _triggerPropsUpdate(id: string, props: AnyObject): void;
62
- addRoute(props: Optional<RouteInterface, "id">): {
63
- id: string;
64
- sourceId: string;
65
- sourceIOId: string;
66
- destinationId: string;
67
- destinationIOId: string;
68
- };
69
- validRoute(props: Optional<RouteInterface, "id">): boolean;
70
- removeRoute(id: string): void;
71
- triggerVirtualMidi(id: string, noteName: string, type: "noteOn" | "noteOff"): void;
72
- dispose(): void;
73
- findById(id: string): AudioModule;
74
- get isStarted(): boolean;
75
- start(): void;
76
- stop(): void;
77
- get bpm(): number;
78
- set bpm(value: number);
79
- updateRoutes(): void;
80
- private moduleRouteIds;
81
- }
82
- declare const _default: Engine;
83
- export default _default;
@@ -1,36 +0,0 @@
1
- import { AnyAudioInput, AnyAudioOuput } from '.';
2
- import { AnyObject } from '../../types';
3
- import { default as MonoModule, Connectable } from '../Module/index';
4
- import { default as IONode, IOType, IIONode } from './Node';
5
- import { InputNode } from 'tone';
6
-
7
- export type AudioIO = AudioInput | AudioOutput;
8
- export interface IAudioInput extends IIONode {
9
- ioType: IOType.AudioInput;
10
- internalModule: InputNode;
11
- }
12
- export interface IAudioOutput extends IIONode {
13
- ioType: IOType.AudioOutput;
14
- internalModule: IInternalModule;
15
- }
16
- interface IInternalModule extends Connectable {
17
- }
18
- export declare class AudioInput extends IONode implements IAudioInput {
19
- ioType: IOType.AudioInput;
20
- internalModule: InputNode;
21
- connections: AudioOutput[];
22
- constructor(plugableModule: MonoModule<Connectable, AnyObject>, props: IAudioInput);
23
- plug(io: AnyAudioOuput, plugOther?: boolean): void;
24
- unPlug(io: AnyAudioOuput, plugOther?: boolean): void;
25
- unPlugAll(): void;
26
- }
27
- export declare class AudioOutput extends IONode implements IAudioOutput {
28
- ioType: IOType.AudioOutput;
29
- internalModule: IInternalModule;
30
- connections: AudioInput[];
31
- constructor(plugableModule: MonoModule<Connectable, AnyObject>, props: IAudioOutput);
32
- plug(io: AnyAudioInput, plugOther?: boolean): void;
33
- unPlug(io: AnyAudioInput, plugOther?: boolean): void;
34
- unPlugAll(): void;
35
- }
36
- export {};
@@ -1,14 +0,0 @@
1
- import { IAnyIO } from '.';
2
- import { default as IO } from './Node';
3
- import { AudioModule } from '../Module';
4
-
5
- export default class IOCollection<AnyIO extends IO> {
6
- plugableModule: AudioModule;
7
- collection: AnyIO[];
8
- constructor(plugableModule: AudioModule);
9
- add<CurrentIO extends AnyIO>(props: IAnyIO): CurrentIO;
10
- unPlugAll(): void;
11
- find(id: string): AnyIO | undefined;
12
- findByName(name: string): AnyIO | undefined;
13
- serialize(): import('./Node').IIOSerialize[];
14
- }
@@ -1,19 +0,0 @@
1
- import { AnyIO } from '..';
2
- import { AnyObject } from '../../../types';
3
- import { default as Module, Connectable, PolyModule } from '../../Module';
4
- import { default as IONode, IIONode } from '../Node';
5
-
6
- export default class ForwardBaseNode extends IONode {
7
- plugableModule: PolyModule<Module<Connectable, AnyObject>, AnyObject>;
8
- constructor(plugableModule: PolyModule<Module<Connectable, AnyObject>, AnyObject>, props: IIONode);
9
- get voices(): number;
10
- get subModules(): Module<Connectable, AnyObject>[];
11
- subModule(voiceNo: number): Module<Connectable, AnyObject>;
12
- get subIOs(): IONode[];
13
- subIO(voiceNo: number): import('..').AudioInput | import('..').MidiInput | import('..').AudioOutput | import('..').MidiOutput;
14
- plug(io: AnyIO, plugOther?: boolean): void;
15
- unPlug(io: AnyIO, plugOther?: boolean): void;
16
- unPlugAll(): void;
17
- private plugUnplug;
18
- private checkNameValidity;
19
- }
@@ -1,28 +0,0 @@
1
- import { default as ForwardBaseNode } from './Base';
2
- import { AnyAudioInput, AnyAudioOuput, AnyInput, AnyOuput } from '..';
3
- import { AnyObject } from '../../../types';
4
- import { default as Module, Connectable, PolyModule } from '../../Module';
5
- import { IOType, IIONode } from '../Node';
6
-
7
- export interface IForwardAudioInput extends IIONode {
8
- ioType: IOType.ForwardAudioInput;
9
- }
10
- export interface IForwardAudioOutput extends IIONode {
11
- ioType: IOType.ForwardAudioOutput;
12
- }
13
- export declare class ForwardAudioInput extends ForwardBaseNode implements IForwardAudioInput {
14
- plugableModule: PolyModule<Module<Connectable, AnyObject>, AnyObject>;
15
- ioType: IOType.ForwardAudioInput;
16
- connections: AnyAudioOuput[];
17
- constructor(plugableModule: PolyModule<Module<Connectable, AnyObject>, AnyObject>, props: IForwardAudioInput);
18
- plug(io: AnyOuput, plugOther?: boolean): void;
19
- unPlug(io: AnyOuput, plugOther?: boolean): void;
20
- }
21
- export declare class ForwardAudioOutput extends ForwardBaseNode implements IForwardAudioOutput {
22
- plugableModule: PolyModule<Module<Connectable, AnyObject>, AnyObject>;
23
- ioType: IOType.ForwardAudioOutput;
24
- connections: AnyAudioInput[];
25
- constructor(plugableModule: PolyModule<Module<Connectable, AnyObject>, AnyObject>, props: IForwardAudioOutput);
26
- plug(io: AnyInput, plugOther?: boolean): void;
27
- unPlug(io: AnyInput, plugOther?: boolean): void;
28
- }
@@ -1,31 +0,0 @@
1
- import { default as IONode, IOType, IIONode } from './Node';
2
- import { MidiEvent } from '../midi';
3
- import { AudioModule } from '../Module';
4
- import { AnyMidiInput, AnyMidiOuput } from '.';
5
-
6
- export interface IMidiInput extends IIONode {
7
- ioType: IOType.MidiInput;
8
- onMidiEvent: (event: MidiEvent) => void;
9
- }
10
- export interface IMidiOutput extends IIONode {
11
- ioType: IOType.MidiOutput;
12
- }
13
- export declare class MidiInput extends IONode implements IMidiInput {
14
- ioType: IOType.MidiInput;
15
- connections: MidiOutput[];
16
- onMidiEvent: (event: MidiEvent) => void;
17
- constructor(plugableModule: AudioModule, props: IMidiInput);
18
- plug(io: AnyMidiOuput, plugOther?: boolean): void;
19
- unPlug(io: AnyMidiOuput, plugOther?: boolean): void;
20
- unPlugAll(): void;
21
- }
22
- export declare class MidiOutput extends IONode implements IMidiOutput {
23
- ioType: IOType.MidiOutput;
24
- connections: MidiInput[];
25
- constructor(plugableModule: AudioModule, props: IIONode);
26
- plug(io: AnyMidiInput, plugOther?: boolean): void;
27
- unPlug(io: AnyMidiInput, plugOther?: boolean): void;
28
- unPlugAll(): void;
29
- onMidiEvent: (event: MidiEvent) => void;
30
- private get midiConnections();
31
- }
@@ -1,41 +0,0 @@
1
- import { AnyIO } from '.';
2
- import { AudioModule } from '../Module';
3
-
4
- export interface IIONode {
5
- name: string;
6
- ioType: IOType;
7
- }
8
- export interface IIOSerialize {
9
- id: string;
10
- name: string;
11
- ioType: IOType;
12
- moduleId: string;
13
- moduleName: string;
14
- }
15
- export declare enum IOType {
16
- AudioInput = "audioInput",
17
- AudioOutput = "audioOutput",
18
- MidiInput = "midiInput",
19
- MidiOutput = "midiOutput",
20
- ForwardAudioInput = "forwardAudioInput",
21
- ForwardAudioOutput = "forwardAudioOutput"
22
- }
23
- export declare function plugCompatibleIO(io1: AnyIO, io2: AnyIO): void;
24
- export declare function unPlugCompatibleIO(io1: AnyIO, io2: AnyIO): void;
25
- export default abstract class IONode implements IIONode {
26
- id: string;
27
- ioType: IOType;
28
- name: string;
29
- plugableModule: AudioModule;
30
- connections: IONode[];
31
- static unPlugAll(io: IONode): void;
32
- constructor(plugableModule: AudioModule, props: IIONode);
33
- plug(io: IONode, plugOther?: boolean): void;
34
- unPlug(io: IONode, plugOther?: boolean): void;
35
- get isInput(): boolean;
36
- get isOutput(): boolean;
37
- get isAudio(): boolean;
38
- get isMidi(): boolean;
39
- abstract unPlugAll(): void;
40
- serialize(): IIOSerialize;
41
- }
@@ -1,22 +0,0 @@
1
- import { ForwardAudioInput, ForwardAudioOutput, IForwardAudioInput, IForwardAudioOutput } from './ForwardNode';
2
- import { IMidiInput, IMidiOutput, MidiInput, MidiOutput } from './MidiNode';
3
- import { AudioInput, AudioOutput, IAudioInput, IAudioOutput } from './AudioNode';
4
- import { IIONode, IOType, IIOSerialize } from './Node';
5
- import { default as IOCollection } from './Collection';
6
-
7
- type AnyAudioInput = AudioInput | ForwardAudioInput;
8
- type AnyMidiInput = MidiInput;
9
- type AnyAudioOuput = AudioOutput | ForwardAudioOutput;
10
- type AnyMidiOuput = MidiOutput;
11
- type AnyInput = AnyAudioInput | AnyMidiInput;
12
- type AnyOuput = AnyAudioOuput | AnyMidiOuput;
13
- type AnyIO = AnyInput | AnyOuput;
14
- type IAnyAudioInput = IAudioInput | IForwardAudioInput;
15
- type IAnyMidiInput = IMidiInput;
16
- type IAnyAudioOuput = IAudioOutput | IForwardAudioOutput;
17
- type IAnyMidiOuput = IMidiOutput;
18
- type IAnyInput = IAnyAudioInput | IAnyMidiInput;
19
- type IAnyOutput = IAnyAudioOuput | IAnyMidiOuput;
20
- type IAnyIO = IAnyInput | IAnyOutput;
21
- export { IOCollection, IOType, AudioInput, AudioOutput, MidiInput, MidiOutput, ForwardAudioInput, ForwardAudioOutput, };
22
- export type { IAnyIO, IIONode, IAudioInput, IAudioOutput, IMidiInput, IMidiOutput, IForwardAudioInput, IForwardAudioOutput, IAnyInput, IAnyOutput, IIOSerialize, AnyAudioInput, AnyMidiInput, AnyAudioOuput, AnyMidiOuput, AnyInput, AnyOuput, AnyIO, };
@@ -1,68 +0,0 @@
1
- import { AtLeast } from '../../types';
2
- import { default as Note } from '../../core/Note';
3
- import { AudioModule } from './index';
4
- import { MidiEvent } from '../../core/midi';
5
- import { IOCollection, AudioInput, AudioOutput, MidiInput, IMidiInput, IAudioInput, IAudioOutput, MidiOutput, IMidiOutput } from '../IO';
6
- import { InputNode } from 'tone';
7
-
8
- export interface Startable {
9
- start(time: number): void;
10
- stop(time: number): void;
11
- }
12
- export interface Connectable {
13
- connect: (inputNode: InputNode) => void;
14
- disconnect: (inputNode?: InputNode) => void;
15
- dispose: () => void;
16
- }
17
- export interface Triggerable {
18
- triggerAttack: (note: Note, triggeredAt: number) => void;
19
- triggerRelease: (note: Note, triggeredAt: number) => void;
20
- }
21
- export interface ModuleInterface<PropsInterface> {
22
- id: string;
23
- name: string;
24
- props: PropsInterface;
25
- voiceNo?: number;
26
- }
27
- export declare class DummnyInternalModule implements Connectable {
28
- connect(): void;
29
- disconnect(): void;
30
- dispose(): void;
31
- }
32
- declare abstract class Module<InternalModule extends Connectable, PropsInterface> implements ModuleInterface<PropsInterface> {
33
- static readonly moduleName: string;
34
- readonly id: string;
35
- name: string;
36
- internalModule: InternalModule;
37
- inputs: IOCollection<AudioInput | MidiInput>;
38
- outputs: IOCollection<AudioOutput | MidiOutput>;
39
- readonly voiceNo?: number;
40
- updatedAt: Date;
41
- _props: PropsInterface;
42
- constructor(internalModule: InternalModule, props: AtLeast<ModuleInterface<PropsInterface>, "name">);
43
- set props(value: PropsInterface);
44
- get props(): PropsInterface;
45
- plug(audioModule: AudioModule, from: string, to: string): void;
46
- unPlugAll(): void;
47
- dispose(): void;
48
- triggerAttack: (note: Note, triggeredAt: number) => void;
49
- triggerRelease: (note: Note, triggeredAt: number) => void;
50
- onMidiEvent: (midiEvent: MidiEvent) => void;
51
- private triggerer;
52
- serialize(): {
53
- id: string;
54
- name: string;
55
- type: string;
56
- props: PropsInterface;
57
- inputs: import('../IO').IIOSerialize[];
58
- outputs: import('../IO').IIOSerialize[];
59
- };
60
- protected registerMidiInput(props: Omit<IMidiInput, "ioType">): MidiInput;
61
- protected registerAudioInput(props: Omit<IAudioInput, "ioType">): AudioInput;
62
- protected registerMidiOutput(props: Omit<IMidiOutput, "ioType">): MidiOutput;
63
- protected registerAudioOutput(props: Omit<IAudioOutput, "ioType">): AudioOutput;
64
- protected registerBasicOutputs(): void;
65
- protected registerBasicInputs(): void;
66
- protected registerDefaultMidiInput(): void;
67
- }
68
- export default Module;
@@ -1,62 +0,0 @@
1
- import { ForwardAudioOutput, IForwardAudioInput, IForwardAudioOutput } from '../IO/ForwardNode';
2
- import { AudioModule } from './index';
3
- import { IOCollection, IMidiInput, IMidiOutput, MidiOutput, MidiInput, AnyInput, AnyOuput, ForwardAudioInput } from '../IO';
4
- import { default as Module, Connectable } from './MonoModule';
5
- import { MidiEvent } from '../midi';
6
-
7
- interface PolyModuleInterface<MonoAudioModule, PropsInterface> {
8
- id?: string;
9
- name: string;
10
- numberOfVoices?: number;
11
- child: new (params: {
12
- id?: string;
13
- name: string;
14
- props: PropsInterface;
15
- }) => MonoAudioModule;
16
- props: PropsInterface;
17
- }
18
- export default abstract class PolyModule<MonoAudioModule extends Module<Connectable, PropsInterface>, PropsInterface> {
19
- static readonly moduleName: string;
20
- readonly id: string;
21
- readonly child: new (params: {
22
- id?: string;
23
- name: string;
24
- props: PropsInterface;
25
- }) => MonoAudioModule;
26
- _name: string;
27
- audioModules: MonoAudioModule[];
28
- inputs: IOCollection<AnyInput>;
29
- outputs: IOCollection<AnyOuput>;
30
- private _numberOfVoices;
31
- constructor(params: PolyModuleInterface<MonoAudioModule, PropsInterface>);
32
- get name(): string;
33
- set name(value: string);
34
- get props(): PropsInterface;
35
- set props(value: PropsInterface);
36
- get numberOfVoices(): number;
37
- set numberOfVoices(value: number);
38
- plug(audioModule: AudioModule, from: string, to: string): void;
39
- unPlugAll(): void;
40
- dispose(): void;
41
- onMidiEvent: (midiEvent: MidiEvent) => void;
42
- serialize(): {
43
- id: string;
44
- type: string;
45
- numberOfVoices: number;
46
- inputs: import('../IO').IIOSerialize[];
47
- outputs: import('../IO').IIOSerialize[];
48
- name: string;
49
- props: PropsInterface;
50
- };
51
- protected find(callback: (audioModule: MonoAudioModule) => boolean): MonoAudioModule;
52
- protected findVoice(voiceNo: number): MonoAudioModule | undefined;
53
- protected registerForwardAudioInput(props: Omit<IForwardAudioInput, "ioType">): ForwardAudioInput;
54
- protected registerForwardAudioOutput(props: Omit<IForwardAudioOutput, "ioType">): ForwardAudioOutput;
55
- protected registerMidiInput(props: Omit<IMidiInput, "ioType">): MidiInput;
56
- protected registerMidiOutput(props: Omit<IMidiOutput, "ioType">): MidiOutput;
57
- protected registerBasicOutputs(): void;
58
- protected registerBasicInputs(): void;
59
- protected registerMidiIn(): void;
60
- private adjustNumberOfModules;
61
- }
62
- export {};
@@ -1,7 +0,0 @@
1
- import { default as PolyModule } from './PolyModule';
2
- import { default as Module, Connectable } from './MonoModule';
3
-
4
- export { default, DummnyInternalModule } from './MonoModule';
5
- export { default as PolyModule } from './PolyModule';
6
- export type { ModuleInterface, Connectable, Triggerable, Startable, } from './MonoModule';
7
- 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,12 +0,0 @@
1
- import { default as MidiEvent } from './MidiEvent';
2
- import { IMidiInput, TMidiPortState } from './MidiDevice';
3
-
4
- export default class ComputerKeyboardInput implements IMidiInput {
5
- id: string;
6
- name: string;
7
- state: TMidiPortState;
8
- onmidimessage: ((e: MidiEvent) => void) | null;
9
- constructor();
10
- onKeyTrigger: (noteOn: boolean) => (event: KeyboardEvent) => void;
11
- private extractNote;
12
- }
@@ -1,30 +0,0 @@
1
- import { default as MidiEvent } from './MidiEvent';
2
-
3
- export type TMidiPortState = "connected" | "disconnected";
4
- export interface MidiDeviceInterface {
5
- id: string;
6
- name: string;
7
- state: TMidiPortState;
8
- }
9
- export interface IMidiInput extends MidiDeviceInterface {
10
- onmidimessage: ((e: MidiEvent) => void) | null;
11
- }
12
- export type EventListerCallback = (event: MidiEvent) => void;
13
- export default class MidiDevice implements MidiDeviceInterface {
14
- id: string;
15
- name: string;
16
- state: TMidiPortState;
17
- eventListerCallbacks: EventListerCallback[];
18
- private _midi;
19
- constructor(midi: IMidiInput);
20
- connect(): void;
21
- disconnect(): void;
22
- serialize(): {
23
- id: string;
24
- name: string;
25
- state: TMidiPortState;
26
- };
27
- addEventListener(callback: EventListerCallback): void;
28
- removeEventListener(callback: EventListerCallback): void;
29
- private processEvent;
30
- }
@@ -1,15 +0,0 @@
1
- import { default as MidiDevice } from './MidiDevice';
2
-
3
- export default class MidiDeviceManager {
4
- devices: {
5
- [Key: string]: MidiDevice;
6
- };
7
- private initialized;
8
- private computerKeyboardInput;
9
- constructor();
10
- find(id: string): MidiDevice | null;
11
- onStateChange(callback: (device: MidiDevice) => void): void;
12
- private listenChanges;
13
- private initializeDevices;
14
- private inputs;
15
- }
@@ -1,22 +0,0 @@
1
- import { default as Note, INote } from '../Note';
2
- import { ISequence } from '../../modules';
3
-
4
- export type MidiEventType = "noteOn" | "noteOff" | "cc";
5
- export default class MidiEvent {
6
- note: Note;
7
- voiceNo?: number;
8
- readonly triggeredAt: number;
9
- _type: MidiEventType;
10
- private data;
11
- private event;
12
- static fromSequence(sequence: ISequence, triggeredAt: number): MidiEvent[];
13
- static fromNote(noteName: string | Note | INote, noteOn?: boolean, triggeredAt?: number): MidiEvent;
14
- static fromCC(cc: number, value: number, triggeredAt?: number): MidiEvent;
15
- constructor(event: MIDIMessageEvent, triggeredAt?: number);
16
- get statusByte(): number;
17
- get firstData(): number;
18
- get secondData(): number;
19
- get type(): MidiEventType;
20
- get isNote(): boolean;
21
- defineNotes(): void;
22
- }
@@ -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';
File without changes
@@ -1,17 +0,0 @@
1
- import { default as Effect, EffectInterface } from './Effect';
2
- import { BitCrusher as InternalBitCrasher } from 'tone';
3
-
4
- interface BitCrusherInterface extends EffectInterface {
5
- bits: number;
6
- }
7
- export default class BitCrusher extends Effect<InternalBitCrasher, BitCrusherInterface> {
8
- static moduleName: string;
9
- constructor(params: {
10
- id?: string;
11
- name: string;
12
- props: Partial<BitCrusherInterface>;
13
- });
14
- get bits(): number;
15
- set bits(value: number);
16
- }
17
- export {};
@@ -1,20 +0,0 @@
1
- import { default as Effect, EffectInterface } from './Effect';
2
- import { FeedbackDelay } from 'tone';
3
-
4
- interface DelayInterface extends EffectInterface {
5
- delayTime: number;
6
- feedback: number;
7
- }
8
- export default class Delay extends Effect<FeedbackDelay, DelayInterface> {
9
- static moduleName: string;
10
- constructor(params: {
11
- id?: string;
12
- name: string;
13
- props: Partial<DelayInterface>;
14
- });
15
- get delayTime(): number;
16
- set delayTime(value: number);
17
- get feedback(): number;
18
- set feedback(value: number);
19
- }
20
- export {};
@@ -1,17 +0,0 @@
1
- import { default as Effect, EffectInterface } from './Effect';
2
- import { Distortion as InternalDistortion } from 'tone';
3
-
4
- interface DistortionInterface extends EffectInterface {
5
- drive: number;
6
- }
7
- export default class Distortion extends Effect<InternalDistortion, DistortionInterface> {
8
- static moduleName: string;
9
- constructor(params: {
10
- id?: string;
11
- name: string;
12
- props: Partial<DistortionInterface>;
13
- });
14
- get drive(): number;
15
- set drive(value: number);
16
- }
17
- export {};
@@ -1,20 +0,0 @@
1
- import { default as Module, Connectable } from '../core/Module';
2
- import { Signal } from 'tone';
3
-
4
- interface EffectLike extends Connectable {
5
- wet: Signal<"normalRange">;
6
- }
7
- export interface EffectInterface {
8
- wet: number;
9
- }
10
- export default abstract class Effect<InternalEffect extends EffectLike, ModuleInterface extends EffectInterface> extends Module<InternalEffect, ModuleInterface> {
11
- constructor(params: {
12
- id?: string;
13
- name: string;
14
- internalModule: InternalEffect;
15
- props: Partial<ModuleInterface>;
16
- });
17
- get wet(): number;
18
- set wet(value: number);
19
- }
20
- export {};
@@ -1,19 +0,0 @@
1
- import { default as Base, EnvelopeInterface, PolyBase } from './Base';
2
- import { AmplitudeEnvelope } from 'tone';
3
-
4
- declare class MonoAmpEnvelope extends Base<AmplitudeEnvelope> {
5
- constructor(params: {
6
- id?: string;
7
- name: string;
8
- props: EnvelopeInterface;
9
- });
10
- }
11
- export default class AmpEnvelope extends PolyBase<MonoAmpEnvelope> {
12
- static moduleName: string;
13
- constructor(params: {
14
- id?: string;
15
- name: string;
16
- props: Partial<EnvelopeInterface>;
17
- });
18
- }
19
- export {};