xsound 2.27.0 → 3.0.0-alpha

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 +57 -29
  2. package/build/types/AudioModule/index.d.ts +198 -0
  3. package/build/types/AudioModule/index.d.ts.map +1 -0
  4. package/build/types/MIDI/index.d.ts +48 -0
  5. package/build/types/MIDI/index.d.ts.map +1 -0
  6. package/build/types/MML/Part.d.ts +78 -0
  7. package/build/types/MML/Part.d.ts.map +1 -0
  8. package/build/types/MML/Sequence.d.ts +66 -0
  9. package/build/types/MML/Sequence.d.ts.map +1 -0
  10. package/build/types/MML/Sequencer.d.ts +34 -0
  11. package/build/types/MML/Sequencer.d.ts.map +1 -0
  12. package/build/types/MML/Token.d.ts +40 -0
  13. package/build/types/MML/Token.d.ts.map +1 -0
  14. package/build/types/MML/Tokenizer.d.ts +21 -0
  15. package/build/types/MML/Tokenizer.d.ts.map +1 -0
  16. package/build/types/MML/Tree.d.ts +60 -0
  17. package/build/types/MML/Tree.d.ts.map +1 -0
  18. package/build/types/MML/TreeConstructor.d.ts +25 -0
  19. package/build/types/MML/TreeConstructor.d.ts.map +1 -0
  20. package/build/types/MML/index.d.ts +115 -0
  21. package/build/types/MML/index.d.ts.map +1 -0
  22. package/build/types/MediaModule/index.d.ts +223 -0
  23. package/build/types/MediaModule/index.d.ts.map +1 -0
  24. package/build/types/MixerModule/index.d.ts +99 -0
  25. package/build/types/MixerModule/index.d.ts.map +1 -0
  26. package/build/types/NoiseModule/index.d.ts +106 -0
  27. package/build/types/NoiseModule/index.d.ts.map +1 -0
  28. package/build/types/OneshotModule/index.d.ts +176 -0
  29. package/build/types/OneshotModule/index.d.ts.map +1 -0
  30. package/build/types/OscillatorModule/Glide.d.ts +47 -0
  31. package/build/types/OscillatorModule/Glide.d.ts.map +1 -0
  32. package/build/types/OscillatorModule/Oscillator.d.ts +77 -0
  33. package/build/types/OscillatorModule/Oscillator.d.ts.map +1 -0
  34. package/build/types/OscillatorModule/index.d.ts +138 -0
  35. package/build/types/OscillatorModule/index.d.ts.map +1 -0
  36. package/build/types/ProcessorModule/index.d.ts +124 -0
  37. package/build/types/ProcessorModule/index.d.ts.map +1 -0
  38. package/build/types/SoundModule/Analyser/FFT.d.ts +61 -0
  39. package/build/types/SoundModule/Analyser/FFT.d.ts.map +1 -0
  40. package/build/types/SoundModule/Analyser/Time.d.ts +54 -0
  41. package/build/types/SoundModule/Analyser/Time.d.ts.map +1 -0
  42. package/build/types/SoundModule/Analyser/TimeOverview.d.ts +132 -0
  43. package/build/types/SoundModule/Analyser/TimeOverview.d.ts.map +1 -0
  44. package/build/types/SoundModule/Analyser/Visualizer.d.ts +150 -0
  45. package/build/types/SoundModule/Analyser/Visualizer.d.ts.map +1 -0
  46. package/build/types/SoundModule/Analyser/index.d.ts +85 -0
  47. package/build/types/SoundModule/Analyser/index.d.ts.map +1 -0
  48. package/build/types/SoundModule/Effectors/Autopanner.d.ts +39 -0
  49. package/build/types/SoundModule/Effectors/Autopanner.d.ts.map +1 -0
  50. package/build/types/SoundModule/Effectors/Chorus.d.ts +51 -0
  51. package/build/types/SoundModule/Effectors/Chorus.d.ts.map +1 -0
  52. package/build/types/SoundModule/Effectors/Compressor.d.ts +43 -0
  53. package/build/types/SoundModule/Effectors/Compressor.d.ts.map +1 -0
  54. package/build/types/SoundModule/Effectors/Delay.d.ts +48 -0
  55. package/build/types/SoundModule/Effectors/Delay.d.ts.map +1 -0
  56. package/build/types/SoundModule/Effectors/Distortion.d.ts +90 -0
  57. package/build/types/SoundModule/Effectors/Distortion.d.ts.map +1 -0
  58. package/build/types/SoundModule/Effectors/Effector.d.ts +79 -0
  59. package/build/types/SoundModule/Effectors/Effector.d.ts.map +1 -0
  60. package/build/types/SoundModule/Effectors/EnvelopeGenerator.d.ts +90 -0
  61. package/build/types/SoundModule/Effectors/EnvelopeGenerator.d.ts.map +1 -0
  62. package/build/types/SoundModule/Effectors/Equalizer.d.ts +44 -0
  63. package/build/types/SoundModule/Effectors/Equalizer.d.ts.map +1 -0
  64. package/build/types/SoundModule/Effectors/Filter.d.ts +61 -0
  65. package/build/types/SoundModule/Effectors/Filter.d.ts.map +1 -0
  66. package/build/types/SoundModule/Effectors/Flanger.d.ts +51 -0
  67. package/build/types/SoundModule/Effectors/Flanger.d.ts.map +1 -0
  68. package/build/types/SoundModule/Effectors/Listener.d.ts +47 -0
  69. package/build/types/SoundModule/Effectors/Listener.d.ts.map +1 -0
  70. package/build/types/SoundModule/Effectors/Panner.d.ts +68 -0
  71. package/build/types/SoundModule/Effectors/Panner.d.ts.map +1 -0
  72. package/build/types/SoundModule/Effectors/Phaser.d.ts +55 -0
  73. package/build/types/SoundModule/Effectors/Phaser.d.ts.map +1 -0
  74. package/build/types/SoundModule/Effectors/PitchShifter.d.ts +42 -0
  75. package/build/types/SoundModule/Effectors/PitchShifter.d.ts.map +1 -0
  76. package/build/types/SoundModule/Effectors/Reverb.d.ts +81 -0
  77. package/build/types/SoundModule/Effectors/Reverb.d.ts.map +1 -0
  78. package/build/types/SoundModule/Effectors/Ringmodulator.d.ts +39 -0
  79. package/build/types/SoundModule/Effectors/Ringmodulator.d.ts.map +1 -0
  80. package/build/types/SoundModule/Effectors/Stereo.d.ts +45 -0
  81. package/build/types/SoundModule/Effectors/Stereo.d.ts.map +1 -0
  82. package/build/types/SoundModule/Effectors/Tremolo.d.ts +41 -0
  83. package/build/types/SoundModule/Effectors/Tremolo.d.ts.map +1 -0
  84. package/build/types/SoundModule/Effectors/VocalCanceler.d.ts +31 -0
  85. package/build/types/SoundModule/Effectors/VocalCanceler.d.ts.map +1 -0
  86. package/build/types/SoundModule/Effectors/Wah.d.ts +49 -0
  87. package/build/types/SoundModule/Effectors/Wah.d.ts.map +1 -0
  88. package/build/types/SoundModule/Recorder/Channel.d.ts +44 -0
  89. package/build/types/SoundModule/Recorder/Channel.d.ts.map +1 -0
  90. package/build/types/SoundModule/Recorder/Track.d.ts +36 -0
  91. package/build/types/SoundModule/Recorder/Track.d.ts.map +1 -0
  92. package/build/types/SoundModule/Recorder/index.d.ts +118 -0
  93. package/build/types/SoundModule/Recorder/index.d.ts.map +1 -0
  94. package/build/types/SoundModule/Session/Room.d.ts +69 -0
  95. package/build/types/SoundModule/Session/Room.d.ts.map +1 -0
  96. package/build/types/SoundModule/Session/index.d.ts +94 -0
  97. package/build/types/SoundModule/Session/index.d.ts.map +1 -0
  98. package/build/types/SoundModule/index.d.ts +147 -0
  99. package/build/types/SoundModule/index.d.ts.map +1 -0
  100. package/build/types/StreamModule/NoiseGate.d.ts +29 -0
  101. package/build/types/StreamModule/NoiseGate.d.ts.map +1 -0
  102. package/build/types/StreamModule/NoiseSuppressor.d.ts +30 -0
  103. package/build/types/StreamModule/NoiseSuppressor.d.ts.map +1 -0
  104. package/build/types/StreamModule/index.d.ts +175 -0
  105. package/build/types/StreamModule/index.d.ts.map +1 -0
  106. package/build/types/XSound/index.d.ts +155 -0
  107. package/build/types/XSound/index.d.ts.map +1 -0
  108. package/build/types/interfaces.d.ts +23 -0
  109. package/build/types/interfaces.d.ts.map +1 -0
  110. package/build/types/main.d.ts +117 -0
  111. package/build/types/main.d.ts.map +1 -0
  112. package/build/types/types.d.ts +10 -0
  113. package/build/types/types.d.ts.map +1 -0
  114. package/build/xsound.js +1 -1
  115. package/build/xsound.js.LICENSE.txt +1 -1
  116. package/build/xsound.js.map +1 -1
  117. package/build/xsound.min.js +3 -0
  118. package/build/xsound.min.js.LICENSE.txt +1 -0
  119. package/build/xsound.min.js.map +1 -0
  120. package/package.json +38 -33
  121. package/build/xsound.d.ts +0 -3
package/README.md CHANGED
@@ -4,7 +4,6 @@
4
4
  ![node-current](https://img.shields.io/node/v/xsound?color=brightgreen)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)
6
6
  [![npm](https://img.shields.io/npm/dt/xsound.svg)](https://www.npmjs.com/package/xsound)
7
- ![David Dev](https://img.shields.io/david/dev/Korilakkuma/XSound.svg)
8
7
  [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/xsound/badge)](https://www.jsdelivr.com/package/npm/xsound)
9
8
 
10
9
  ## Overview
@@ -37,7 +36,7 @@ XSound don't depend on other libraries or frameworks (For example, jQuery, React
37
36
  In the case of using as **full stack** (For example, use oscillator) ...
38
37
 
39
38
  ```JavaScript
40
- X('oscillator').setup(true).ready().start(440);
39
+ X('oscillator').setup([true, true, false, false]).ready().start([440, 880]);
41
40
  ```
42
41
 
43
42
  or, in the case of using as **module base** (For example, use chorus effector) ...
@@ -47,8 +46,7 @@ or, in the case of using as **module base** (For example, use chorus effector) .
47
46
  const context = X.get();
48
47
 
49
48
  // Create the instance of `Chorus` that is defined by XSound
50
- // (The 2nd argument is buffer size for `ScriptProcessorNode`)
51
- const chorus = new X.Chorus(context, 0);
49
+ const chorus = new X.Chorus(context);
52
50
 
53
51
  const oscillator = context.createOscillator();
54
52
 
@@ -65,7 +63,7 @@ chorus.param({
65
63
  });
66
64
 
67
65
  // Activate
68
- chorus.state(true);
66
+ chorus.activate();
69
67
 
70
68
  oscillator.start(0);
71
69
  ```
@@ -73,32 +71,32 @@ oscillator.start(0);
73
71
  XSound enable to using the following classes (Refer to [API Documentation](https://xsound.dev) for details).
74
72
 
75
73
  ```TypeScript
74
+ // These type aliases are defined by XSound
76
75
  type BufferSize = 0 | 256 | 512 | 1024 | 2048 | 4096 | 8192 | 16384;
76
+ type RecordType = 1 | 2; // Monaural | Stereo
77
+
78
+ X.Analyser(context: AudioContext);
79
+ X.Recorder(context: AudioContext, bufferSize: BufferSize, numberOfInputs: RecordType, numberOfOutputs: RecordType);
80
+ X.Session(context: AudioContext);
77
81
 
78
82
  // Effectors
79
- X.Autopanner(context: AudioContext, size: BufferSize);
80
- X.Chorus(context: AudioContext, size: BufferSize);
81
- X.Compressor(context: AudioContext, size: BufferSize);
82
- X.Delay(context: AudioContext, size: BufferSize);
83
- X.Distortion(context: AudioContext, size: BufferSize);
84
- X.Equalizer(context: AudioContext, size: BufferSize);
85
- X.Filter(context: AudioContext, size: BufferSize);
86
- X.Flanger(context: AudioContext, size: BufferSize);
87
- X.Listener(context: AudioContext, size: BufferSize);
88
- X.Panner(context: AudioContext, size: BufferSize);
89
- X.Phaser(context: AudioContext, size: BufferSize);
83
+ X.Autopanner(context: AudioContext);
84
+ X.Chorus(context: AudioContext);
85
+ X.Compressor(context: AudioContext);
86
+ X.Delay(context: AudioContext);
87
+ X.Distortion(context: AudioContext);
88
+ X.Equalizer(context: AudioContext);
89
+ X.Filter(context: AudioContext);
90
+ X.Flanger(context: AudioContext);
91
+ X.Listener(context: AudioContext);
92
+ X.Panner(context: AudioContext);
93
+ X.Phaser(context: AudioContext);
90
94
  X.PitchShifter(context: AudioContext, size: BufferSize);
91
- X.Reverb(context: AudioContext, size: BufferSize);
92
- X.Ringmodulator(context: AudioContext, size: BufferSize);
95
+ X.Reverb(context: AudioContext);
96
+ X.Ringmodulator(context: AudioContext);
93
97
  X.Stereo(context: AudioContext, size, size: BufferSize);
94
- X.Tremolo(context: AudioContext, size: BufferSize);
95
- X.Wah(context: AudioContext, size: BufferSize);
96
-
97
- X.Analyser(context: AudioContext);
98
-
99
- X.Recorder(context: AudioContext, size: BufferSize, numberOfInputs: number, numberOfOutputs: number);
100
-
101
- X.Session(context: AudioContext, size: BufferSize, numberOfInputs: number, numberOfOutputs, analyser: X.Analyser);
98
+ X.Tremolo(context: AudioContext);
99
+ X.Wah(context: AudioContext);
102
100
  ```
103
101
 
104
102
  ## Demo
@@ -106,8 +104,6 @@ X.Session(context: AudioContext, size: BufferSize, numberOfInputs: number, numbe
106
104
  The application that uses XSound is in the following URLs.
107
105
 
108
106
  - [XSound.app](https://xsound.app)
109
- - [x-piano](https://korilakkuma.github.io/x-piano/)
110
- - [Music V](https://weblike-curtaincall.ssl-lolipop.jp/portfolio-music-v/)
111
107
  - [Music Tweet](https://github.com/Korilakkuma/Music-Tweet)
112
108
  - [Chrome EQUALIZER](https://github.com/Korilakkuma/Chrome-EQUALIZER)
113
109
 
@@ -135,7 +131,7 @@ In the case of using CDN,
135
131
  <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/xsound@latest/build/xsound.min.js"></script>
136
132
  ```
137
133
 
138
- In the case of using ESModules for SSR ... etc,
134
+ In the case of using ES Modules for SSR ... etc,
139
135
 
140
136
  ```JavaScript
141
137
  import { XSound, X } from 'xsound';
@@ -168,6 +164,38 @@ $ open http://localhost:8080/playground/
168
164
 
169
165
  - [XSound API Documentation](https://xsound.dev)
170
166
 
167
+ ## Migration to v3
168
+
169
+ Please refer to [API Documentation](#api-documentation) for details.
170
+
171
+ ### Case sensitive
172
+
173
+ ```JavaScript
174
+ // Bad (v2 or earlier)
175
+ X('audio').module('panner').param({ coneinnerangle: 240 });
176
+
177
+ // Good (v3)
178
+ X('audio').module('panner').param({ coneInnerAngle: 240 });
179
+ ```
180
+
181
+ ### Use plain object if parameters setter
182
+
183
+ ```JavaScript
184
+ // Bad (v2 or earlier)
185
+ X('oscillator').get(0).param('type', 'sawtooth');
186
+
187
+ // Good (v3)
188
+ X('oscillator').get(0).param({ type: 'sawtooth' });
189
+ ```
190
+
191
+ ### Validate parameters on the application side
192
+
193
+ ```JavaScript
194
+ if ((type === 'sine') || (type === 'square') || (type === 'sawtooth') || (type === 'triangle')) {
195
+ X('oscillator').get(0).param({ type });
196
+ }
197
+ ```
198
+
171
199
  ## Pickups
172
200
 
173
201
  - [9 libraries to kickstart your Web Audio stuff - DEV Community](https://dev.to/areknawo/9-libraries-to-kickstart-your-web-audio-stuff-460p)
@@ -0,0 +1,198 @@
1
+ import { BufferSize } from '../types';
2
+ import { SoundModule, SoundModuleParams } from '../SoundModule';
3
+ import { Analyser } from '../SoundModule/Analyser';
4
+ import { Recorder } from '../SoundModule/Recorder';
5
+ import { Session } from '../SoundModule/Session';
6
+ import { Autopanner } from '../SoundModule/Effectors/Autopanner';
7
+ import { Chorus } from '../SoundModule/Effectors/Chorus';
8
+ import { Compressor } from '../SoundModule/Effectors/Compressor';
9
+ import { Delay } from '../SoundModule/Effectors/Delay';
10
+ import { Distortion } from '../SoundModule/Effectors/Distortion';
11
+ import { EnvelopeGenerator } from '../SoundModule/Effectors/EnvelopeGenerator';
12
+ import { Equalizer } from '../SoundModule/Effectors/Equalizer';
13
+ import { Filter } from '../SoundModule/Effectors/Filter';
14
+ import { Flanger } from '../SoundModule/Effectors/Flanger';
15
+ import { Listener } from '../SoundModule/Effectors/Listener';
16
+ import { Panner } from '../SoundModule/Effectors/Panner';
17
+ import { Phaser } from '../SoundModule/Effectors/Phaser';
18
+ import { PitchShifter } from '../SoundModule/Effectors/PitchShifter';
19
+ import { Reverb } from '../SoundModule/Effectors/Reverb';
20
+ import { Ringmodulator } from '../SoundModule/Effectors/Ringmodulator';
21
+ import { Stereo } from '../SoundModule/Effectors/Stereo';
22
+ import { Tremolo } from '../SoundModule/Effectors/Tremolo';
23
+ import { Wah } from '../SoundModule/Effectors/Wah';
24
+ import { VocalCanceler, VocalCancelerParams } from '../SoundModule/Effectors/VocalCanceler';
25
+ export declare type AudioBufferSprite = {
26
+ [spriteName: string]: AudioBuffer;
27
+ };
28
+ export declare type AudioModuleParams = SoundModuleParams & {
29
+ vocalcanceler: VocalCancelerParams;
30
+ playbackRate?: number;
31
+ detune?: number;
32
+ loop?: boolean;
33
+ currentTime?: number;
34
+ readonly duration?: number;
35
+ readonly sampleRate?: number;
36
+ readonly numberOfChannels?: number;
37
+ };
38
+ declare type Params = Partial<Pick<AudioModuleParams, 'mastervolume' | 'playbackRate' | 'detune' | 'loop' | 'currentTime' | 'duration' | 'sampleRate' | 'numberOfChannels'>>;
39
+ /**
40
+ * This subclass is for playing single audio.
41
+ * This class enables to create audio player that has higher features than `HTMLAudioElement`.
42
+ * But, this class is disadvantage to play many one shot audios.
43
+ * In that case, developer should use `OneshotModule`.
44
+ * @constructor
45
+ * @extends {SoundModule}
46
+ */
47
+ export declare class AudioModule extends SoundModule {
48
+ private source;
49
+ private buffer;
50
+ private vocalcanceler;
51
+ private currentTime;
52
+ private stopped;
53
+ private decodeCallback;
54
+ private updateCallback;
55
+ private endedCallback;
56
+ private errorCallback;
57
+ /**
58
+ * @param {AudioContext} context This argument is in order to use the interfaces of Web Audio API.
59
+ * @param {BufferSize} bufferSize This argument is buffer size for `ScriptProcessorNode`.
60
+ */
61
+ constructor(context: AudioContext, bufferSize: BufferSize);
62
+ /**
63
+ * This method sets up envelope generator for fade-in and fade-out.
64
+ * @return {AudioModule} Return value is for method chain.
65
+ */
66
+ setup(callbacks?: {
67
+ decodeCallback?(buffer: AudioBuffer): void;
68
+ updateCallback?(source: AudioBufferSourceNode, currentTime: number): void;
69
+ endedCallback?(source: AudioBufferSourceNode, currentTime: number): void;
70
+ errorCallback?(error: Error): void;
71
+ }): AudioModule;
72
+ /**
73
+ * This method decodes instance of `ArrayBuffer` to `ArrayBuffer` or sets instanceof `AudioBuffer`.
74
+ * @param {ArrayBuffer|AudioBuffer} buffer This argument is instance of `ArrayBuffer` or `AudioBuffer`.
75
+ * If this is `ArrayBuffer`, this method executes decode.
76
+ * @return {AudioModule} Return value is for method chain.
77
+ */
78
+ ready(buffer: ArrayBuffer | AudioBuffer): AudioModule;
79
+ /**
80
+ * This method starts audio from designated time.
81
+ * @param {number} startTime This argument is time that audio is started at. The default value is `0`.
82
+ * @param {number} endTime This argument is time that audio is ended at. The default value is audio duration.
83
+ * @return {AudioModule} This is returned for method chain.
84
+ */
85
+ start(startTime?: number, endTime?: number): AudioModule;
86
+ /**
87
+ * This method stops audio.
88
+ * @return {AudioModule} Return value is for method chain.
89
+ */
90
+ stop(): AudioModule;
91
+ /**
92
+ * This method gets or sets parameters for audio module.
93
+ * This method is overloaded for type interface and type check.
94
+ * @param {keyof Params|Params} params This argument is string if getter. Otherwise, setter.
95
+ * @return {Params[keyof Params]|Params} Return value is parameter for audio module if getter.
96
+ * Otherwise, return value is for method chain.
97
+ */
98
+ param(params: 'mastervolume'): number;
99
+ param(params: 'playbackRate'): number;
100
+ param(params: 'detune'): number;
101
+ param(params: 'loop'): boolean;
102
+ param(params: 'currentTime'): number;
103
+ param(params: 'duration'): number;
104
+ param(params: 'sampleRate'): number;
105
+ param(params: 'numberOfChannels'): number;
106
+ param(params: 'numberOfChannels'): number;
107
+ param(params: Params): AudioModule;
108
+ /**
109
+ * This method gets instance of `AudioBufferSourceNode`.
110
+ * @return {AudioBufferSourceNode}
111
+ */
112
+ get(): AudioBufferSourceNode;
113
+ /**
114
+ * This method rewinds audio.
115
+ * @return {AudioModule} Return value is for method chain.
116
+ */
117
+ end(): AudioModule;
118
+ /**
119
+ * This method determines whether instance of `AudioBuffer` exists.
120
+ * @return {boolean} If instance of `AudioBuffer` already exists, this value is `true`. Otherwise, this value is `false`.
121
+ */
122
+ has(): boolean;
123
+ /**
124
+ * This method determines whether audio is paused.
125
+ * @return {boolean} If audio is paused, this value is `true`. Otherwise, this value is `false`.
126
+ */
127
+ paused(): boolean;
128
+ /**
129
+ * This method gets or sets fade-in time.
130
+ * @param {number} time This argument is fade-in time. If this argument is omitted, this method is getter.
131
+ * @return {number|AudioModule} Return value is fade-in time. Otherwise, return value is for method chain.
132
+ */
133
+ fadeIn(time?: number): number | AudioModule;
134
+ /**
135
+ * This method gets or sets fade-out time.
136
+ * @param {number} time This argument is fade-out time. If this argument is omitted, this method is getter.
137
+ * @return {number|AudioModule} Return value is fade-out time. Otherwise, return value is for method chain.
138
+ */
139
+ fadeOut(time?: number): number | AudioModule;
140
+ /**
141
+ * This method slices instance of `AudioBuffer`.
142
+ * @param {number} startTime This argument is start time [sec] on `AudioBuffer`.
143
+ * @param {number} endTime This argument is end time [sec] on `AudioBuffer`.
144
+ * @return {AudioBuffer} Return value is sliced `AudioBuffer`.
145
+ */
146
+ slice(startTime?: number, endTime?: number): AudioBuffer | null;
147
+ /**
148
+ * This method sprites audio.
149
+ * @param {Object<string, Array<number>>} sprites This argument is associative array that contains sprite times.
150
+ * @return {AudioBufferSprite} Return value is associative array that contains sprited `AudioBuffer`.
151
+ */
152
+ sprite(sprites: {
153
+ [spriteName: string]: [number, number];
154
+ }): AudioBufferSprite | null;
155
+ /**
156
+ * This method gets instance of `Module` (Analyser, Recorder, Effector ... etc).
157
+ * @param {ModuleName|'vocalcanceler'} moduleName This argument selects module.
158
+ * @return {Module|VocalCanceler}
159
+ */
160
+ module(moduleName: 'analyser'): Analyser;
161
+ module(moduleName: 'recorder'): Recorder;
162
+ module(moduleName: 'session'): Session;
163
+ module(moduleName: 'autopanner'): Autopanner;
164
+ module(moduleName: 'chorus'): Chorus;
165
+ module(moduleName: 'compressor'): Compressor;
166
+ module(moduleName: 'delay'): Delay;
167
+ module(moduleName: 'distortion'): Distortion;
168
+ module(moduleName: 'equalizer'): Equalizer;
169
+ module(moduleName: 'filter'): Filter;
170
+ module(moduleName: 'flanger'): Flanger;
171
+ module(moduleName: 'listener'): Listener;
172
+ module(moduleName: 'panner'): Panner;
173
+ module(moduleName: 'phaser'): Phaser;
174
+ module(moduleName: 'pitchshifter'): PitchShifter;
175
+ module(moduleName: 'reverb'): Reverb;
176
+ module(moduleName: 'ringmodulator'): Ringmodulator;
177
+ module(moduleName: 'stereo'): Stereo;
178
+ module(moduleName: 'tremolo'): Tremolo;
179
+ module(moduleName: 'wah'): Wah;
180
+ module(moduleName: 'envelopegenerator'): EnvelopeGenerator;
181
+ module(moduleName: 'vocalcanceler'): VocalCanceler;
182
+ /** @override */
183
+ resize(bufferSize: BufferSize): AudioModule;
184
+ /** @override */
185
+ on(startTime?: number): AudioModule;
186
+ /** @override */
187
+ off(stopTime?: number): AudioModule;
188
+ /** @override */
189
+ suspend(): AudioModule;
190
+ /**
191
+ * This method gets audio module parameters as associative array.
192
+ * @return {AudioModuleParams}
193
+ * @override
194
+ */
195
+ params(): AudioModuleParams;
196
+ }
197
+ export {};
198
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/AudioMod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AM,CAAC,UAAU,EAAE,KAAK,GAAG,GAAG;IAC9B,MAAM,CAAC,UAAU,EAAE,mBAAmB,GAAG,iBAAiB;IAC1D,MAAM,CAAC,UAAU,EAAE,eAAe,GAAG,aAAa;IAoDzD,gBAAgB;IACA,MAAM,CAAC,UAAU,EAAE,UAAU,GAAG,WAAW;IAK3D,gBAAgB;IACA,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,WAAW;IAKnD,gBAAgB;IACA,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW;IAKnD,gBAAgB;IACA,OAAO,IAAI,WAAW;IAKtC;;;;OAIG;IACa,MAAM,IAAI,iBAAiB;CAe5C"}
@@ -0,0 +1,48 @@
1
+ export interface MIDIOptions {
2
+ sysex: boolean;
3
+ }
4
+ export interface MIDIMessageEvent {
5
+ data: Uint8Array;
6
+ receivedTime: number;
7
+ }
8
+ export interface MIDIInput {
9
+ onmidimessage(event: MIDIMessageEvent): void;
10
+ }
11
+ export interface MIDIOutput {
12
+ clear(): void;
13
+ send(data: Uint8Array, timestamp?: number): void;
14
+ }
15
+ export interface MIDIAccess {
16
+ inputs: Map<string, MIDIInput>;
17
+ outputs: Map<string, MIDIOutput>;
18
+ onstatechang(): void;
19
+ sysexEnabled: boolean;
20
+ }
21
+ /**
22
+ * This class is for using Web MIDI API.
23
+ * @constructor
24
+ */
25
+ export declare class MIDI {
26
+ private midiAccess;
27
+ private inputs;
28
+ private outputs;
29
+ constructor();
30
+ /**
31
+ * This method invokes `requestMIDIAccess` and gets instance of `MIDIAccess`.
32
+ * @param {MIDIOptions} options This argument is object based on `MIDIOptions` dictionary.
33
+ * @param {function} successCallback This argument is invoked on `requestMIDIAccess` success.
34
+ * @param {function} errorCallback This argument is invoked on `requestMIDIAccess` failure.
35
+ * @return {Promise<MIDIAccess|void>} Return value is `Promise` that `requestMIDIAccess` method returns.
36
+ */
37
+ setup(params: {
38
+ options?: MIDIOptions;
39
+ successCallback?(midiAccess: MIDIAccess, midiInputs: MIDIInput[], midiOutputs: MIDIOutput[]): void;
40
+ errorCallback?(error: Error): void;
41
+ }): Promise<MIDIAccess | void>;
42
+ /**
43
+ * This method gets instance of `MIDIAccess`.
44
+ * @return {MIDIAccess|null}
45
+ */
46
+ get(): MIDIAccess | null;
47
+ }
48
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/MIDI/index.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,UAAU,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,aAAa,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC9C;AAGD,MAAM,WAAW,UAAU;IACzB,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClD;AAGD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC/B,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACjC,YAAY,IAAI,IAAI,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,qBAAa,IAAI;IACf,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,OAAO,CAAoB;;IAMnC;;;;;;OAMG;IACI,KAAK,CAAC,MAAM,EAAE;QACnB,OAAO,CAAC,EAAE,WAAW,CAAC;QACtB,eAAe,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QACnG,aAAa,CAAC,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;KACpC,GAAG,OAAO,CAAC,UAAU,GAAC,IAAI,CAAC;IAmC5B;;;OAGG;IACI,GAAG,IAAI,UAAU,GAAG,IAAI;CAGhC"}
@@ -0,0 +1,78 @@
1
+ import { OscillatorModule } from '../OscillatorModule';
2
+ import { OneshotModule } from '../OneshotModule';
3
+ import { NoiseModule } from '../NoiseModule';
4
+ import { MMLSyntaxError } from './Tree';
5
+ import { Sequence } from './Sequence';
6
+ /**
7
+ * This class starts and stops each MML part.
8
+ * @constructor
9
+ */
10
+ export declare class Part {
11
+ private sequences;
12
+ private source;
13
+ private mml;
14
+ private previous;
15
+ private timerId;
16
+ private currentIndex;
17
+ private currentPosition;
18
+ private offset;
19
+ private startCallback;
20
+ private stopCallback;
21
+ private endedCallback;
22
+ private errorCallback;
23
+ /**
24
+ * @param {OscillatorModule|OneshotModule|NoiseModule} source This argument selects sound source.
25
+ * @param {string} mml This argument is MML string.
26
+ * @param {number} offset This argument corrects index of one-shot audio.
27
+ * @param {function} startCallback This argument is invoked on start musical note.
28
+ * @param {function} stopCallback This argument is invoked on stop musical note.
29
+ * @param {function} endedCallback This argument is invoked on ended.
30
+ * @param {function} errorCallback This argument is invoked on syntax error.
31
+ */
32
+ constructor(params: {
33
+ source: OscillatorModule | OneshotModule | NoiseModule;
34
+ mml: string;
35
+ offset?: number;
36
+ startCallback?(sequence: Sequence, offset?: number): void;
37
+ stopCallback?(sequence: Sequence, offset?: number): void;
38
+ endedCallback?(): void;
39
+ errorCallback?(error: MMLSyntaxError): void;
40
+ });
41
+ /**
42
+ * This method starts MML. Moreover, this method schedules next sequence.
43
+ * @param {boolean} highlight This argument is `true` in case of surrounding by `span.x-highlight` HTML.
44
+ */
45
+ start(highlight: boolean): void;
46
+ /**
47
+ * This method stops MML.
48
+ */
49
+ stop(): void;
50
+ /**
51
+ * This method is getter for MML string.
52
+ */
53
+ getMML(): string;
54
+ /**
55
+ * This method is getter for array that contains sequence.
56
+ */
57
+ getSequences(): Sequence[];
58
+ /**
59
+ * This method determines whether sequence exists.
60
+ * @return {boolean} If sequence exists, this value is `true`. Otherwise, this value is `false`.
61
+ */
62
+ has(): boolean;
63
+ /**
64
+ * This method determines whether MML part is paused.
65
+ * @return {boolean} If MML part are paused, this value is `true`. Otherwise, this value is `false`.
66
+ */
67
+ paused(): boolean;
68
+ /**
69
+ * This method is getter for current sequence index.
70
+ */
71
+ getCurrentIndex(): number;
72
+ /**
73
+ * This method is setter for current sequence index.
74
+ * @param {number} index This argument is new sequence index.
75
+ */
76
+ setCurrentIndex(index: number): void;
77
+ }
78
+ //# sourceMappingURL=Part.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Part.d.ts","sourceRoot":"","sources":["../../../src/MML/Part.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAIxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;GAGG;AACH,qBAAa,IAAI;IACf,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,MAAM,CAA6C;IAC3D,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,aAAa;IAErB;;;;;;;;OAQG;gBACS,MAAM,EAAE;QAClB,MAAM,EAAE,gBAAgB,GAAG,aAAa,GAAG,WAAW,CAAC;QACvD,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,aAAa,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1D,YAAY,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzD,aAAa,CAAC,IAAI,IAAI,CAAC;QACvB,aAAa,CAAC,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;KAC7C;IA6CD;;;OAGG;IACI,KAAK,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;IA8EtC;;OAEG;IACI,IAAI,IAAI,IAAI;IAoCnB;;OAEG;IACI,MAAM,IAAI,MAAM;IAIvB;;OAEG;IACI,YAAY,IAAI,QAAQ,EAAE;IAIjC;;;OAGG;IACI,GAAG,IAAI,OAAO;IAIrB;;;OAGG;IACI,MAAM,IAAI,OAAO;IAIxB;;OAEG;IACI,eAAe,IAAI,MAAM;IAIhC;;;OAGG;IACI,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAK5C"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * This class is entity for sequence that has musical note.
3
+ * @constructor
4
+ */
5
+ export declare class Sequence {
6
+ private _id;
7
+ private _note;
8
+ private _indexes;
9
+ private _frequencies;
10
+ private _start;
11
+ private _stop;
12
+ private _duration;
13
+ /**
14
+ * @param {string} id This argument is string that identifies sequence.
15
+ * @param {string} note This argument is string that corresponds to MML token.
16
+ * @param {Array<number>} indexes This argument is array that contains index that corresponds to 12 equal temperament.
17
+ * @param {Array<number>} frequencies This argument is array that contains frequency.
18
+ * @param {number} start This argument is start time.
19
+ * @param {number} stop This argument is stop time.
20
+ * @param {number} duration This argument is duration.
21
+ */
22
+ constructor(params: {
23
+ id: string;
24
+ note: string;
25
+ indexes: number[];
26
+ frequencies: number[];
27
+ start: number;
28
+ stop: number;
29
+ duration: number;
30
+ });
31
+ /**
32
+ * This method concatenates sequence in case of tie.
33
+ * @param {Sequence} sequence This argument is instance of `Sequence`.
34
+ * @return {Sequence} Return value is new instance of `Sequence` that concatenates previous sequence.
35
+ */
36
+ concat(sequence: Sequence): Sequence;
37
+ /**
38
+ * This method is getter for musical note as MML token.
39
+ */
40
+ get note(): string;
41
+ /**
42
+ * This method is getter for array that contains index that corresponds to 12 equal temperament.
43
+ */
44
+ get indexes(): number[];
45
+ /**
46
+ * This method is getter for array that contains frequency.
47
+ */
48
+ get frequencies(): number[];
49
+ /**
50
+ * This method is getter for start time.
51
+ */
52
+ get start(): number;
53
+ /**
54
+ * This method is getter for stop time.
55
+ */
56
+ get stop(): number;
57
+ /**
58
+ * This method is getter for duration,
59
+ */
60
+ get duration(): number;
61
+ /**
62
+ * This method returns fields that `Sequence` has as JSON.
63
+ */
64
+ toString(): string;
65
+ }
66
+ //# sourceMappingURL=Sequence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sequence.d.ts","sourceRoot":"","sources":["../../../src/MML/Sequence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,YAAY,CAAW;IAC/B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAS;IAE1B;;;;;;;;OAQG;gBACS,MAAM,EAAE;QAClB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;KAClB;IAYD;;;;OAIG;IACI,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IAY3C;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,OAAO,IAAI,MAAM,EAAE,CAE7B;IAED;;OAEG;IACH,IAAW,WAAW,IAAI,MAAM,EAAE,CAEjC;IAED;;OAEG;IACH,IAAW,KAAK,IAAI,MAAM,CAEzB;IAED;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED;;OAEG;IACI,QAAQ,IAAI,MAAM;CAW1B"}
@@ -0,0 +1,34 @@
1
+ import { MMLSyntaxError } from './Tree';
2
+ import { TreeConstructor } from './TreeConstructor';
3
+ import { Sequence } from './Sequence';
4
+ /**
5
+ * This class converts syntax tree to array that contains musical note.
6
+ * @constructor
7
+ */
8
+ export declare class Sequencer {
9
+ private sequences;
10
+ private treeConstructor;
11
+ private timeOf4note;
12
+ private octave;
13
+ private currentTime;
14
+ /**
15
+ * @param {TreeConstructor} treeConstructor This argument is instance of `TreeConstructor`.
16
+ */
17
+ constructor(treeConstructor: TreeConstructor);
18
+ /**
19
+ * This method calculates pitch and music time from Parse Tree.
20
+ * @return {Array<Sequence>|MMLSyntaxError} Return value is array that contains instance of `Sequence`.
21
+ * If error occurs, return value is `MMLSyntaxError`.
22
+ */
23
+ get(): Sequence[] | MMLSyntaxError;
24
+ /**
25
+ * This method constructs syntax tree.
26
+ * @param {Tree|null} tree This argument is instance of `Tree` that is added to syntax tree.
27
+ */
28
+ private push;
29
+ /**
30
+ * This method concatenates previous sequence and current sequence in case of tie.
31
+ */
32
+ private concat;
33
+ }
34
+ //# sourceMappingURL=Sequencer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sequencer.d.ts","sourceRoot":"","sources":["../../../src/MML/Sequencer.ts"],"names":[],"mappings":"AAWA,OAAO,EAAQ,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;GAGG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,eAAe,CAAkB;IAEzC,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,WAAW,CAAK;IAExB;;OAEG;gBACS,eAAe,EAAE,eAAe;IAI5C;;;;OAIG;IACI,GAAG,IAAI,QAAQ,EAAE,GAAG,cAAc;IAgFzC;;;OAGG;IACH,OAAO,CAAC,IAAI;IAwKZ;;OAEG;IACH,OAAO,CAAC,MAAM;CAQf"}
@@ -0,0 +1,40 @@
1
+ export declare type TokenType = 'TEMPO' | 'OCTAVE' | 'NOTE' | 'REST' | 'NUMBER' | 'TIE' | 'SPACE' | 'EOS' | 'UNKNOWN';
2
+ /**
3
+ * MML characters are corresponds to tokens by this map.
4
+ * Namely, this map is definitions of MML Tokens.
5
+ */
6
+ export declare const TokenMap: Map<string | undefined, TokenType>;
7
+ /**
8
+ * This class is entity for MML token.
9
+ * This class has token type, token data and token value if token is number.
10
+ * @constructor
11
+ */
12
+ export declare class Token {
13
+ private _id;
14
+ private _type;
15
+ private _token;
16
+ private _value;
17
+ /**
18
+ * @param {string} id This argument is string that identifies MML token.
19
+ * @param {TokenType} type This argument is one of 'TEMPO', 'OCTAVE', 'NOTE', 'REST', 'NUMBER', 'TIE', 'SPACE', 'EOS', 'UNKNOWN'.
20
+ * @param {string|undefined} token This argument is string that constructs of token.
21
+ */
22
+ constructor(id: string, type: TokenType, token: string | undefined);
23
+ /**
24
+ * This method is getter for token type.
25
+ */
26
+ get type(): TokenType;
27
+ /**
28
+ * This method is getter for token.
29
+ */
30
+ get token(): string | undefined;
31
+ /**
32
+ * This method is getter for token value if token is number.
33
+ */
34
+ get value(): number;
35
+ /**
36
+ * This method returns fields that `Token` has as JSON.
37
+ */
38
+ toString(): string;
39
+ }
40
+ //# sourceMappingURL=Token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Token.d.ts","sourceRoot":"","sources":["../../../src/MML/Token.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;AAE9G;;;GAGG;AACH,eAAO,MAAM,QAAQ,oCA4BnB,CAAC;AAEH;;;;GAIG;AACH,qBAAa,KAAK;IAChB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,MAAM,CAAS;IAEvB;;;;OAIG;gBACS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS;IAOlE;;OAEG;IACH,IAAW,IAAI,IAAI,SAAS,CAE3B;IAED;;OAEG;IACH,IAAW,KAAK,IAAI,MAAM,GAAG,SAAS,CAErC;IAED;;OAEG;IACH,IAAW,KAAK,IAAI,MAAM,CAEzB;IAED;;OAEG;IACI,QAAQ,IAAI,MAAM;CAQ1B"}
@@ -0,0 +1,21 @@
1
+ import { Token } from './Token';
2
+ /**
3
+ * This class is for MML Tokenization.
4
+ * @constructor
5
+ */
6
+ export declare class Tokenizer {
7
+ static id: number;
8
+ private tokens;
9
+ private notes;
10
+ private numbers;
11
+ /**
12
+ * @param {string} mml This argument is MML string.
13
+ */
14
+ constructor(mml: string);
15
+ /**
16
+ * This method executes tokenization from MML.
17
+ * @return {Token|null} Return value is instance of `Token`.
18
+ */
19
+ get(): Token | null;
20
+ }
21
+ //# sourceMappingURL=Tokenizer.d.ts.map