xsound 2.28.1 → 3.0.0-rc
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.
- package/README.md +71 -38
- package/build/types/AudioModule/index.d.ts +206 -0
- package/build/types/AudioModule/index.d.ts.map +1 -0
- package/build/types/MIDI/index.d.ts +48 -0
- package/build/types/MIDI/index.d.ts.map +1 -0
- package/build/types/MML/Part.d.ts +78 -0
- package/build/types/MML/Part.d.ts.map +1 -0
- package/build/types/MML/Sequence.d.ts +66 -0
- package/build/types/MML/Sequence.d.ts.map +1 -0
- package/build/types/MML/Sequencer.d.ts +34 -0
- package/build/types/MML/Sequencer.d.ts.map +1 -0
- package/build/types/MML/Token.d.ts +40 -0
- package/build/types/MML/Token.d.ts.map +1 -0
- package/build/types/MML/Tokenizer.d.ts +21 -0
- package/build/types/MML/Tokenizer.d.ts.map +1 -0
- package/build/types/MML/Tree.d.ts +60 -0
- package/build/types/MML/Tree.d.ts.map +1 -0
- package/build/types/MML/TreeConstructor.d.ts +25 -0
- package/build/types/MML/TreeConstructor.d.ts.map +1 -0
- package/build/types/MML/index.d.ts +115 -0
- package/build/types/MML/index.d.ts.map +1 -0
- package/build/types/MediaModule/index.d.ts +231 -0
- package/build/types/MediaModule/index.d.ts.map +1 -0
- package/build/types/MixerModule/index.d.ts +116 -0
- package/build/types/MixerModule/index.d.ts.map +1 -0
- package/build/types/NoiseModule/index.d.ts +113 -0
- package/build/types/NoiseModule/index.d.ts.map +1 -0
- package/build/types/OneshotModule/index.d.ts +183 -0
- package/build/types/OneshotModule/index.d.ts.map +1 -0
- package/build/types/OscillatorModule/Glide.d.ts +47 -0
- package/build/types/OscillatorModule/Glide.d.ts.map +1 -0
- package/build/types/OscillatorModule/Oscillator.d.ts +77 -0
- package/build/types/OscillatorModule/Oscillator.d.ts.map +1 -0
- package/build/types/OscillatorModule/index.d.ts +145 -0
- package/build/types/OscillatorModule/index.d.ts.map +1 -0
- package/build/types/ProcessorModule/index.d.ts +131 -0
- package/build/types/ProcessorModule/index.d.ts.map +1 -0
- package/build/types/SoundModule/Analyser/FFT.d.ts +62 -0
- package/build/types/SoundModule/Analyser/FFT.d.ts.map +1 -0
- package/build/types/SoundModule/Analyser/Time.d.ts +55 -0
- package/build/types/SoundModule/Analyser/Time.d.ts.map +1 -0
- package/build/types/SoundModule/Analyser/TimeOverview.d.ts +133 -0
- package/build/types/SoundModule/Analyser/TimeOverview.d.ts.map +1 -0
- package/build/types/SoundModule/Analyser/Visualizer.d.ts +150 -0
- package/build/types/SoundModule/Analyser/Visualizer.d.ts.map +1 -0
- package/build/types/SoundModule/Analyser/index.d.ts +85 -0
- package/build/types/SoundModule/Analyser/index.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Autopanner.d.ts +39 -0
- package/build/types/SoundModule/Effectors/Autopanner.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Chorus.d.ts +51 -0
- package/build/types/SoundModule/Effectors/Chorus.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Compressor.d.ts +43 -0
- package/build/types/SoundModule/Effectors/Compressor.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Delay.d.ts +48 -0
- package/build/types/SoundModule/Effectors/Delay.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Distortion.d.ts +157 -0
- package/build/types/SoundModule/Effectors/Distortion.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Effector.d.ts +76 -0
- package/build/types/SoundModule/Effectors/Effector.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/EnvelopeGenerator.d.ts +90 -0
- package/build/types/SoundModule/Effectors/EnvelopeGenerator.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Equalizer.d.ts +44 -0
- package/build/types/SoundModule/Effectors/Equalizer.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Filter.d.ts +61 -0
- package/build/types/SoundModule/Effectors/Filter.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Flanger.d.ts +51 -0
- package/build/types/SoundModule/Effectors/Flanger.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Listener.d.ts +49 -0
- package/build/types/SoundModule/Effectors/Listener.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Panner.d.ts +68 -0
- package/build/types/SoundModule/Effectors/Panner.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Phaser.d.ts +55 -0
- package/build/types/SoundModule/Effectors/Phaser.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/PitchShifter.d.ts +42 -0
- package/build/types/SoundModule/Effectors/PitchShifter.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Reverb.d.ts +80 -0
- package/build/types/SoundModule/Effectors/Reverb.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Ringmodulator.d.ts +39 -0
- package/build/types/SoundModule/Effectors/Ringmodulator.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Stereo.d.ts +45 -0
- package/build/types/SoundModule/Effectors/Stereo.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Tremolo.d.ts +41 -0
- package/build/types/SoundModule/Effectors/Tremolo.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/VocalCanceler.d.ts +31 -0
- package/build/types/SoundModule/Effectors/VocalCanceler.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Wah.d.ts +49 -0
- package/build/types/SoundModule/Effectors/Wah.d.ts.map +1 -0
- package/build/types/SoundModule/Recorder/Channel.d.ts +44 -0
- package/build/types/SoundModule/Recorder/Channel.d.ts.map +1 -0
- package/build/types/SoundModule/Recorder/Track.d.ts +36 -0
- package/build/types/SoundModule/Recorder/Track.d.ts.map +1 -0
- package/build/types/SoundModule/Recorder/index.d.ts +120 -0
- package/build/types/SoundModule/Recorder/index.d.ts.map +1 -0
- package/build/types/SoundModule/Session/Room.d.ts +69 -0
- package/build/types/SoundModule/Session/Room.d.ts.map +1 -0
- package/build/types/SoundModule/Session/index.d.ts +95 -0
- package/build/types/SoundModule/Session/index.d.ts.map +1 -0
- package/build/types/SoundModule/index.d.ts +163 -0
- package/build/types/SoundModule/index.d.ts.map +1 -0
- package/build/types/StreamModule/NoiseGate.d.ts +29 -0
- package/build/types/StreamModule/NoiseGate.d.ts.map +1 -0
- package/build/types/StreamModule/NoiseSuppressor.d.ts +30 -0
- package/build/types/StreamModule/NoiseSuppressor.d.ts.map +1 -0
- package/build/types/StreamModule/index.d.ts +183 -0
- package/build/types/StreamModule/index.d.ts.map +1 -0
- package/build/types/XSound/index.d.ts +155 -0
- package/build/types/XSound/index.d.ts.map +1 -0
- package/build/types/interfaces.d.ts +21 -0
- package/build/types/interfaces.d.ts.map +1 -0
- package/build/types/main.d.ts +121 -0
- package/build/types/main.d.ts.map +1 -0
- package/build/types/types.d.ts +11 -0
- package/build/types/types.d.ts.map +1 -0
- package/build/xsound.js +1 -1
- package/build/xsound.js.LICENSE.txt +1 -1
- package/build/xsound.js.map +1 -1
- package/build/xsound.min.js +3 -0
- package/build/xsound.min.js.LICENSE.txt +1 -0
- package/build/xsound.min.js.map +1 -0
- package/package.json +39 -31
- package/build/xsound.d.ts +0 -3
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://xsound.jp)
|
|
2
2
|
|
|
3
3
|
[](https://github.com/Korilakkuma/XSound/actions?query=workflow%3A%22Node.js+CI%22)
|
|
4
4
|

|
|
@@ -29,14 +29,14 @@ XSound don't depend on other libraries or frameworks (For example, jQuery, React
|
|
|
29
29
|
|
|
30
30
|
## Supported Browsers
|
|
31
31
|
|
|
32
|
-
<img src="
|
|
32
|
+
<img src="https://user-images.githubusercontent.com/4006693/154785242-8290dfa7-2f09-4f29-a8c0-f108a52d93ac.png" alt="Supported Browsers are Chrome, Edge, Firefox, Opera and Safari" style="max-width: 100%;" />
|
|
33
33
|
|
|
34
34
|
## Getting Started
|
|
35
35
|
|
|
36
36
|
In the case of using as **full stack** (For example, use oscillator) ...
|
|
37
37
|
|
|
38
38
|
```JavaScript
|
|
39
|
-
X('oscillator').setup(true).ready().start(440);
|
|
39
|
+
X('oscillator').setup([true, true, false, false]).ready().start([440, 880]);
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
or, in the case of using as **module base** (For example, use chorus effector) ...
|
|
@@ -46,8 +46,7 @@ or, in the case of using as **module base** (For example, use chorus effector) .
|
|
|
46
46
|
const context = X.get();
|
|
47
47
|
|
|
48
48
|
// Create the instance of `Chorus` that is defined by XSound
|
|
49
|
-
|
|
50
|
-
const chorus = new X.Chorus(context, 0);
|
|
49
|
+
const chorus = new X.Chorus(context);
|
|
51
50
|
|
|
52
51
|
const oscillator = context.createOscillator();
|
|
53
52
|
|
|
@@ -64,40 +63,40 @@ chorus.param({
|
|
|
64
63
|
});
|
|
65
64
|
|
|
66
65
|
// Activate
|
|
67
|
-
chorus.
|
|
66
|
+
chorus.activate();
|
|
68
67
|
|
|
69
68
|
oscillator.start(0);
|
|
70
69
|
```
|
|
71
70
|
|
|
72
|
-
XSound enable to using the following classes (Refer to [API Documentation](https://xsound.
|
|
71
|
+
XSound enable to using the following classes (Refer to [API Documentation](https://xsound.jp/docs/) for details).
|
|
73
72
|
|
|
74
73
|
```TypeScript
|
|
74
|
+
// These type aliases are defined by XSound
|
|
75
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);
|
|
76
81
|
|
|
77
82
|
// Effectors
|
|
78
|
-
X.Autopanner(context: AudioContext
|
|
79
|
-
X.Chorus(context: AudioContext
|
|
80
|
-
X.Compressor(context: AudioContext
|
|
81
|
-
X.Delay(context: AudioContext
|
|
82
|
-
X.Distortion(context: AudioContext
|
|
83
|
-
X.Equalizer(context: AudioContext
|
|
84
|
-
X.Filter(context: AudioContext
|
|
85
|
-
X.Flanger(context: AudioContext
|
|
86
|
-
X.Listener(context: AudioContext
|
|
87
|
-
X.Panner(context: AudioContext
|
|
88
|
-
X.Phaser(context: AudioContext
|
|
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);
|
|
89
94
|
X.PitchShifter(context: AudioContext, size: BufferSize);
|
|
90
|
-
X.Reverb(context: AudioContext
|
|
91
|
-
X.Ringmodulator(context: AudioContext
|
|
95
|
+
X.Reverb(context: AudioContext);
|
|
96
|
+
X.Ringmodulator(context: AudioContext);
|
|
92
97
|
X.Stereo(context: AudioContext, size, size: BufferSize);
|
|
93
|
-
X.Tremolo(context: AudioContext
|
|
94
|
-
X.Wah(context: AudioContext
|
|
95
|
-
|
|
96
|
-
X.Analyser(context: AudioContext);
|
|
97
|
-
|
|
98
|
-
X.Recorder(context: AudioContext, size: BufferSize, numberOfInputs: number, numberOfOutputs: number);
|
|
99
|
-
|
|
100
|
-
X.Session(context: AudioContext);
|
|
98
|
+
X.Tremolo(context: AudioContext);
|
|
99
|
+
X.Wah(context: AudioContext);
|
|
101
100
|
```
|
|
102
101
|
|
|
103
102
|
## Demo
|
|
@@ -105,20 +104,12 @@ X.Session(context: AudioContext);
|
|
|
105
104
|
The application that uses XSound is in the following URLs.
|
|
106
105
|
|
|
107
106
|
- [XSound.app](https://xsound.app)
|
|
108
|
-
- [x-piano](https://korilakkuma.github.io/x-piano/)
|
|
109
|
-
- [Music V](https://weblike-curtaincall.ssl-lolipop.jp/portfolio-music-v/)
|
|
110
107
|
- [Music Tweet](https://github.com/Korilakkuma/Music-Tweet)
|
|
111
108
|
- [Chrome EQUALIZER](https://github.com/Korilakkuma/Chrome-EQUALIZER)
|
|
112
109
|
|
|
113
110
|
Now, I'm creating website for Web Audio API. Please refer to the following site for understanding API Documentation.
|
|
114
111
|
|
|
115
112
|
- [WEB SOUNDER](https://weblike-curtaincall.ssl-lolipop.jp/portfolio-web-sounder/)
|
|
116
|
-
|
|
117
|
-
## Playground
|
|
118
|
-
|
|
119
|
-
You can view overview on [YouTube](https://www.youtube.com/watch?v=zqdmoB8VICY).
|
|
120
|
-
|
|
121
|
-
[](https://xsound.jp/playground)
|
|
122
113
|
|
|
123
114
|
## Installation
|
|
124
115
|
|
|
@@ -126,6 +117,12 @@ You can view overview on [YouTube](https://www.youtube.com/watch?v=zqdmoB8VICY).
|
|
|
126
117
|
$ npm install --save xsound
|
|
127
118
|
```
|
|
128
119
|
|
|
120
|
+
or,
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
$ yarn add xsound
|
|
124
|
+
```
|
|
125
|
+
|
|
129
126
|
## Usage
|
|
130
127
|
|
|
131
128
|
In the case of using CDN,
|
|
@@ -134,7 +131,7 @@ In the case of using CDN,
|
|
|
134
131
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/xsound@latest/build/xsound.min.js"></script>
|
|
135
132
|
```
|
|
136
133
|
|
|
137
|
-
In the case of using
|
|
134
|
+
In the case of using ES Modules for SSR ... etc,
|
|
138
135
|
|
|
139
136
|
```JavaScript
|
|
140
137
|
import { XSound, X } from 'xsound';
|
|
@@ -165,8 +162,44 @@ $ open http://localhost:8080/playground/
|
|
|
165
162
|
|
|
166
163
|
## API Documentation
|
|
167
164
|
|
|
168
|
-
- [XSound API Documentation](https://xsound.
|
|
165
|
+
- [XSound API Documentation](https://xsound.jp/docs/)
|
|
166
|
+
|
|
167
|
+
## Playground
|
|
169
168
|
|
|
169
|
+
- [XSound Playground](https://xsound.jp/playground/)
|
|
170
|
+
|
|
171
|
+
## Migration to v3
|
|
172
|
+
|
|
173
|
+
Please refer to [API Documentation](#api-documentation) for details.
|
|
174
|
+
|
|
175
|
+
### Case sensitive
|
|
176
|
+
|
|
177
|
+
```JavaScript
|
|
178
|
+
// Bad (v2 or earlier)
|
|
179
|
+
X('audio').module('panner').param({ coneinnerangle: 240 });
|
|
180
|
+
|
|
181
|
+
// Good (v3)
|
|
182
|
+
X('audio').module('panner').param({ coneInnerAngle: 240 });
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Use plain object if parameters setter
|
|
186
|
+
|
|
187
|
+
```JavaScript
|
|
188
|
+
// Bad (v2 or earlier)
|
|
189
|
+
X('oscillator').get(0).param('type', 'sawtooth');
|
|
190
|
+
|
|
191
|
+
// Good (v3)
|
|
192
|
+
X('oscillator').get(0).param({ type: 'sawtooth' });
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Validate parameters on the application side
|
|
196
|
+
|
|
197
|
+
```JavaScript
|
|
198
|
+
if ((type === 'sine') || (type === 'square') || (type === 'sawtooth') || (type === 'triangle')) {
|
|
199
|
+
X('oscillator').get(0).param({ type });
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
170
203
|
## Pickups
|
|
171
204
|
|
|
172
205
|
- [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,206 @@
|
|
|
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
|
+
/** @override */
|
|
191
|
+
mix(): AudioModule;
|
|
192
|
+
/** @override */
|
|
193
|
+
demix(): AudioModule;
|
|
194
|
+
/**
|
|
195
|
+
* This method gets audio module parameters as associative array.
|
|
196
|
+
* @return {AudioModuleParams}
|
|
197
|
+
* @override
|
|
198
|
+
*/
|
|
199
|
+
params(): AudioModuleParams;
|
|
200
|
+
/** @override */
|
|
201
|
+
get INPUT(): ScriptProcessorNode;
|
|
202
|
+
/** @override */
|
|
203
|
+
get OUTPUT(): GainNode;
|
|
204
|
+
}
|
|
205
|
+
export {};
|
|
206
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/AudioModule/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAsB,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,EAA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AG,QAAQ;IACxC,MAAM,CAAC,UAAU,EAAE,QAAQ,GAAG,MAAM;IACpC,MAAM,CAAC,UAAU,EAAE,QAAQ,GAAG,MAAM;IACpC,MAAM,CAAC,UAAU,EAAE,cAAc,GAAG,YAAY;IAChD,MAAM,CAAC,UAAU,EAAE,QAAQ,GAAG,MAAM;IACpC,MAAM,CAAC,UAAU,EAAE,eAAe,GAAG,aAAa;IAClD,MAAM,CAAC,UAAU,EAAE,QAAQ,GAAG,MAAM;IACpC,MAAM,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO;IACtC,MAAM,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,gBAAgB;IACA,GAAG,IAAI,WAAW;IAKlC,gBAAgB;IACA,KAAK,IAAI,WAAW;IAKpC;;;;OAIG;IACa,MAAM,IAAI,iBAAiB;IAgB3C,gBAAgB;IAChB,IAAoB,KAAK,IAAI,mBAAmB,CAE/C;IAED,gBAAgB;IAChB,IAAoB,MAAM,IAAI,QAAQ,CAErC;CACF"}
|
|
@@ -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"}
|