xsound 3.0.8 → 3.0.9
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 +22 -22
- package/build/types/main.d.ts +89 -97
- package/build/types/main.d.ts.map +1 -1
- 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 +1 -1
- package/build/xsound.min.js.LICENSE.txt +1 -1
- package/build/xsound.min.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -43,10 +43,10 @@ or, in case of using as **module base** (For example, use chorus effector) ...
|
|
|
43
43
|
|
|
44
44
|
```JavaScript
|
|
45
45
|
// The instance of `AudioContext`
|
|
46
|
-
const context =
|
|
46
|
+
const context = get();
|
|
47
47
|
|
|
48
48
|
// Create the instance of `Chorus` that is defined by XSound
|
|
49
|
-
const chorus = new
|
|
49
|
+
const chorus = new Chorus(context);
|
|
50
50
|
|
|
51
51
|
const oscillator = context.createOscillator();
|
|
52
52
|
|
|
@@ -75,28 +75,28 @@ XSound enable to using the following classes (Refer to [API Documentation](https
|
|
|
75
75
|
type BufferSize = 0 | 256 | 512 | 1024 | 2048 | 4096 | 8192 | 16384;
|
|
76
76
|
type RecordType = 1 | 2; // Monaural | Stereo
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
Analyser(context: AudioContext);
|
|
79
|
+
Recorder(context: AudioContext, bufferSize: BufferSize, numberOfInputs: RecordType, numberOfOutputs: RecordType);
|
|
80
|
+
Session(context: AudioContext);
|
|
81
81
|
|
|
82
82
|
// Effectors
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
83
|
+
Autopanner(context: AudioContext);
|
|
84
|
+
Chorus(context: AudioContext);
|
|
85
|
+
Compressor(context: AudioContext);
|
|
86
|
+
Delay(context: AudioContext);
|
|
87
|
+
Distortion(context: AudioContext);
|
|
88
|
+
Equalizer(context: AudioContext);
|
|
89
|
+
Filter(context: AudioContext);
|
|
90
|
+
Flanger(context: AudioContext);
|
|
91
|
+
Listener(context: AudioContext);
|
|
92
|
+
Panner(context: AudioContext);
|
|
93
|
+
Phaser(context: AudioContext);
|
|
94
|
+
PitchShifter(context: AudioContext, size: BufferSize);
|
|
95
|
+
Reverb(context: AudioContext);
|
|
96
|
+
Ringmodulator(context: AudioContext);
|
|
97
|
+
Stereo(context: AudioContext, size, size: BufferSize);
|
|
98
|
+
Tremolo(context: AudioContext);
|
|
99
|
+
Wah(context: AudioContext);
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
## Demo
|
package/build/types/main.d.ts
CHANGED
|
@@ -1,39 +1,49 @@
|
|
|
1
1
|
import './types';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { StreamModule, StreamModuleParams, NoiseGate, NoiseGateParams, NoiseSuppressor, NoiseSuppressorParams, MediaStreamTrackAudioSourceNode } from './StreamModule';
|
|
2
|
+
import { OscillatorModule } from './OscillatorModule';
|
|
3
|
+
import { OneshotModule } from './OneshotModule';
|
|
4
|
+
import { NoiseModule } from './NoiseModule';
|
|
5
|
+
import { AudioModule } from './AudioModule';
|
|
6
|
+
import { MediaModule } from './MediaModule';
|
|
7
|
+
import { StreamModule } from './StreamModule';
|
|
9
8
|
import { ProcessorModule } from './ProcessorModule';
|
|
10
9
|
import { MixerModule } from './MixerModule';
|
|
11
10
|
import { MIDI } from './MIDI';
|
|
12
|
-
import { MML
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
11
|
+
import { MML } from './MML';
|
|
12
|
+
export * from './SoundModule';
|
|
13
|
+
export * from './OscillatorModule';
|
|
14
|
+
export * from './OneshotModule';
|
|
15
|
+
export * from './NoiseModule';
|
|
16
|
+
export * from './AudioModule';
|
|
17
|
+
export * from './MediaModule';
|
|
18
|
+
export * from './StreamModule';
|
|
19
|
+
export * from './ProcessorModule';
|
|
20
|
+
export * from './MixerModule';
|
|
21
|
+
export * from './MIDI';
|
|
22
|
+
export * from './MML';
|
|
23
|
+
export * from './SoundModule/Analyser';
|
|
24
|
+
export * from './SoundModule/Recorder';
|
|
25
|
+
export * from './SoundModule/Session';
|
|
26
|
+
export * from './SoundModule/Effectors/Effector';
|
|
27
|
+
export * from './SoundModule/Effectors/Autopanner';
|
|
28
|
+
export * from './SoundModule/Effectors/Chorus';
|
|
29
|
+
export * from './SoundModule/Effectors/Compressor';
|
|
30
|
+
export * from './SoundModule/Effectors/Delay';
|
|
31
|
+
export * from './SoundModule/Effectors/Distortion';
|
|
32
|
+
export * from './SoundModule/Effectors/EnvelopeGenerator';
|
|
33
|
+
export * from './SoundModule/Effectors/Equalizer';
|
|
34
|
+
export * from './SoundModule/Effectors/Filter';
|
|
35
|
+
export * from './SoundModule/Effectors/Flanger';
|
|
36
|
+
export * from './SoundModule/Effectors/Listener';
|
|
37
|
+
export * from './SoundModule/Effectors/Panner';
|
|
38
|
+
export * from './SoundModule/Effectors/Phaser';
|
|
39
|
+
export * from './SoundModule/Effectors/PitchShifter';
|
|
40
|
+
export * from './SoundModule/Effectors/Reverb';
|
|
41
|
+
export * from './SoundModule/Effectors/Ringmodulator';
|
|
42
|
+
export * from './SoundModule/Effectors/Stereo';
|
|
43
|
+
export * from './SoundModule/Effectors/Tremolo';
|
|
44
|
+
export * from './SoundModule/Effectors/VocalCanceler';
|
|
45
|
+
export * from './SoundModule/Effectors/Wah';
|
|
46
|
+
export * from './XSound';
|
|
37
47
|
export declare type Source = OscillatorModule | OneshotModule | NoiseModule | AudioModule | MediaModule | StreamModule | ProcessorModule | MixerModule | MIDI | MML;
|
|
38
48
|
export declare type SourceName = 'oscillator' | 'oneshot' | 'noise' | 'audio' | 'media' | 'stream' | 'processor' | 'mixer' | 'midi' | 'mml';
|
|
39
49
|
/**
|
|
@@ -52,70 +62,52 @@ declare function XSound(sourceName: 'processor'): ProcessorModule;
|
|
|
52
62
|
declare function XSound(sourceName: 'mixer'): MixerModule;
|
|
53
63
|
declare function XSound(sourceName: 'midi'): MIDI;
|
|
54
64
|
declare function XSound(sourceName: 'mml'): MML;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
(sourceName: "oscillator"): OscillatorModule;
|
|
103
|
-
(sourceName: "oneshot"): OneshotModule;
|
|
104
|
-
(sourceName: "noise"): NoiseModule;
|
|
105
|
-
(sourceName: "audio"): AudioModule;
|
|
106
|
-
(sourceName: "media"): MediaModule;
|
|
107
|
-
(sourceName: "stream"): StreamModule;
|
|
108
|
-
(sourceName: "processor"): ProcessorModule;
|
|
109
|
-
(sourceName: "mixer"): MixerModule;
|
|
110
|
-
(sourceName: "midi"): MIDI;
|
|
111
|
-
(sourceName: "mml"): MML;
|
|
112
|
-
free(unusedSources: Source[]): void;
|
|
113
|
-
};
|
|
114
|
-
var free: (unusedSources: Source[]) => void;
|
|
115
|
-
var noConflict: (deep: boolean) => typeof XSound;
|
|
116
|
-
var get: () => AudioContext;
|
|
117
|
-
var getCurrentTime: () => number;
|
|
118
|
-
}
|
|
119
|
-
export type { SoundModule, SoundModuleParams, OscillatorModule, OscillatorModuleParams, Glide, GlideParams, GlideType, Oscillator, OscillatorParams, OscillatorCustomType, OneshotModule, OneshotModuleParams, OneshotSetting, OneshotSettings, OneshotErrorText, NoiseModule, NoiseModuleParams, NoiseType, AudioModule, AudioModuleParams, AudioBufferSprite, MediaModule, MediaModuleParams, StreamModule, StreamModuleParams, NoiseGate, NoiseGateParams, NoiseSuppressor, NoiseSuppressorParams, MediaStreamTrackAudioSourceNode, ProcessorModule, MixerModule, MIDI, MML, Part, Sequence, MMLSyntaxError, Tree, TokenType, TokenMap, Token, Analyser, AnalyserParams, Domain, DataType, FFTSize, Color, Visualizer, VisualizerParams, GraphicsApi, Gradient, Gradients, Shape, Font, GraphicsStyles, TimeOverview, TimeOverviewParams, MouseEventTypes, DragMode, DragCallbackFunction, CurrentTimeStyles, Time, TimeParams, FFT, FFTParams, Recorder, RecorderParams, RecordType, QuantizationBit, WaveExportType, Track, Channel, Session, SessionSetupParams, SessionConnectionParams, NumberOfSessionChannels, Room, RoomMap, Effector, Autopanner, AutopannerParams, Chorus, ChorusParams, Compressor, CompressorParams, Delay, DelayParams, Distortion, DistortionParams, DistortionType, DistortionCurve, PreEqualizer, PreEqualizerParams, PostEqualizer, PostEqualizerParams, Cabinet, CabinetParams, EnvelopeGenerator, EnvelopeGeneratorParams, Equalizer, EqualizerParams, Filter, FilterParams, Flanger, FlangerParams, Listener, ListenerParams, Panner, PannerParams, Position3D, Phaser, PhaserParams, PhaserNumberOfStages, PitchShifter, PitchShifterParams, Reverb, ReverbParams, ReverbErrorText, Ringmodulator, RingmodulatorParams, Stereo, StereoParams, Tremolo, TremoloParams, VocalCanceler, VocalCancelerParams, Wah, WahParams, PitchChar, ConvertedTime, FileEvent, FileReaderType, FileReaderErrorText };
|
|
65
|
+
/**
|
|
66
|
+
* This class (static) method changes `AudioContextState` to 'running'.
|
|
67
|
+
* Initial state is 'suspended' by Autoplay Policy.
|
|
68
|
+
* Therefore, this method must be invoked by user gestures.
|
|
69
|
+
* @return {Promise<void>} Return value is `Promise`.
|
|
70
|
+
*/
|
|
71
|
+
export declare const setup: () => Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* This class (static) method returns closure that gets cloned instance of `Source`.
|
|
74
|
+
* @return {function}
|
|
75
|
+
*/
|
|
76
|
+
export declare const clone: () => {
|
|
77
|
+
(sourceName: 'oscillator'): OscillatorModule;
|
|
78
|
+
(sourceName: 'oneshot'): OneshotModule;
|
|
79
|
+
(sourceName: 'noise'): NoiseModule;
|
|
80
|
+
(sourceName: 'audio'): AudioModule;
|
|
81
|
+
(sourceName: 'media'): MediaModule;
|
|
82
|
+
(sourceName: 'stream'): StreamModule;
|
|
83
|
+
(sourceName: 'processor'): ProcessorModule;
|
|
84
|
+
(sourceName: 'mixer'): MixerModule;
|
|
85
|
+
(sourceName: 'midi'): MIDI;
|
|
86
|
+
(sourceName: 'mml'): MML;
|
|
87
|
+
free(unusedSources: Source[]): void;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* This class (static) method releases memory of unused instances.
|
|
91
|
+
* @param {Array<Source>} unusedSources This argument is array that contains unused instance of `Source`.
|
|
92
|
+
*/
|
|
93
|
+
export declare const free: (unusedSources: Source[]) => void;
|
|
94
|
+
/**
|
|
95
|
+
* This method deletes `XSound` function as global object.
|
|
96
|
+
* @param {boolean} deep This argument selects whether deleting both of global objects.
|
|
97
|
+
* If this value is `true`, both of global objects are deleted.
|
|
98
|
+
* @return {XSound}
|
|
99
|
+
*/
|
|
100
|
+
export declare const noConflict: (deep: boolean) => typeof XSound;
|
|
101
|
+
/**
|
|
102
|
+
* This class (static) method gets instance of `AudioContext`.
|
|
103
|
+
* @return {AudioContext}
|
|
104
|
+
*/
|
|
105
|
+
export declare const get: () => AudioContext;
|
|
106
|
+
/**
|
|
107
|
+
* This class (static) method gets elapsed time from creating instance of `AudioContext`.
|
|
108
|
+
* @return {number}
|
|
109
|
+
*/
|
|
110
|
+
export declare const getCurrentTime: () => number;
|
|
111
|
+
export declare const SAMPLE_RATE: number;
|
|
120
112
|
export { XSound, XSound as X };
|
|
121
113
|
//# sourceMappingURL=main.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,CAAC;AACjB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,CAAC;AACjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAO,QAAQ,CAAC;AAC/B,O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