forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
waa.d.ts
205 lines (175 loc) · 6.8 KB
/
waa.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
// Type definitions for Web Audio API
// Project: http://www.w3.org/TR/webaudio/
// Definitions by: Baruch Berger <https://github.com/bbss>, Kon <http://phyzkit.net/>, kubosho <https://github.com/kubosho>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// This file refers to the latest published working draft (currently from 10 october 2013) http://www.w3.org/TR/2013/WD-webaudio-20131010/, not to be confused with the latest editor's draft http://webaudio.github.io/web-audio-api/
// DEPRECATED: use TypeScript 1.5.3
/// <reference path='../webrtc/MediaStream.d.ts' />
declare var webkitAudioContext: {
new (): AudioContext;
}
declare var webkitOfflineAudioContext: {
new (numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext;
}
declare enum ChannelCountMode {
'max',
'clamped-max',
'explicit'
}
declare enum ChannelInterpretation {
speakers,
discrete
}
declare enum PanningModelType {
/**
* A simple and efficient spatialization algorithm using equal-power panning.
*/
equalpower,
/**
* A higher quality spatialization algorithm using a convolution with measured impulse responses from human subjects. This panning method renders stereo output.
*/
HRTF
}
declare enum DistanceModelType {
/**
* A linear distance model which calculates distanceGain according to:
* 1 - rolloffFactor * (distance - refDistance) / (maxDistance - refDistance)
*/
linear,
/**
* An inverse distance model which calculates distanceGain according to:
* refDistance / (refDistance + rolloffFactor * (distance - refDistance))
*/
inverse,
/**
* An exponential distance model which calculates distanceGain according to:
* pow(distance / refDistance, -rolloffFactor)
*/
exponential
}
declare enum BiquadFilterType {
/**
* A lowpass filter allows frequencies below the cutoff frequency to pass through and attenuates frequencies above the cutoff. It implements a standard second-order resonant lowpass filter with 12dB/octave rolloff.
*
* ## frequency
* The cutoff frequency
* ## Q
* Controls how peaked the response will be at the cutoff frequency. A large value makes the response more peaked. Please note that for this filter type, this value is not a traditional Q, but is a resonance value in decibels.
* ## gain
* Not used in this filter type
*/
lowpass,
/**
* A highpass filter is the opposite of a lowpass filter. Frequencies above the cutoff frequency are passed through, but frequencies below the cutoff are attenuated. It implements a standard second-order resonant highpass filter with 12dB/octave rolloff.
*
* ## frequency
* The cutoff frequency below which the frequencies are attenuated
* ## Q
* Controls how peaked the response will be at the cutoff frequency. A large value makes the response more peaked. Please note that for this filter type, this value is not a traditional Q, but is a resonance value in decibels.
* ## gain
* Not used in this filter type
*/
highpass,
/**
* A bandpass filter allows a range of frequencies to pass through and attenuates the frequencies below and above this frequency range. It implements a second-order bandpass filter.
*
* ## frequency
* The center of the frequency band
* ## Q
* Controls the width of the band. The width becomes narrower as the Q value increases.
* ## gain
* Not used in this filter type
*/
bandpass,
/**
* The lowshelf filter allows all frequencies through, but adds a boost (or attenuation) to the lower frequencies. It implements a second-order lowshelf filter.
*
* ## frequency
* The upper limit of the frequences where the boost (or attenuation) is applied.
* ## Q
* Not used in this filter type.
* ## gain
* The boost, in dB, to be applied. If the value is negative, the frequencies are attenuated.
*/
lowshelf,
/**
* The highshelf filter is the opposite of the lowshelf filter and allows all frequencies through, but adds a boost to the higher frequencies. It implements a second-order highshelf filter
*
* ## frequency
* The lower limit of the frequences where the boost (or attenuation) is applied.
* ## Q
* Not used in this filter type.
* ## gain
* The boost, in dB, to be applied. If the value is negative, the frequencies are attenuated.
*/
highshelf,
/**
* The peaking filter allows all frequencies through, but adds a boost (or attenuation) to a range of frequencies.
*
* ## frequency
* The center frequency of where the boost is applied.
* ## Q
* Controls the width of the band of frequencies that are boosted. A large value implies a narrow width.
* ## gain
* The boost, in dB, to be applied. If the value is negative, the frequencies are attenuated.
*/
peaking,
/**
* The notch filter (also known as a band-stop or band-rejection filter) is the opposite of a bandpass filter. It allows all frequencies through, except for a set of frequencies.
*
* ## frequency
* The center frequency of where the notch is applied.
* ## Q
* Controls the width of the band of frequencies that are attenuated. A large value implies a narrow width.
* ## gain
* Not used in this filter type.
*/
notch,
/**
* An allpass filter allows all frequencies through, but changes the phase relationship between the various frequencies. It implements a second-order allpass filter
*
* ## frequency
* The frequency where the center of the phase transition occurs. Viewed another way, this is the frequency with maximal group delay.
* ## Q
* Controls how sharp the phase transition is at the center frequency. A larger value implies a sharper transition and a larger group delay.
* ## gain
* Not used in this filter type.
*/
allpass
}
declare enum OverSampleType {
'none',
'2x',
'4x'
}
declare enum OscillatorType {
sine,
square,
sawtooth,
triangle,
custom
}
interface AudioContextConstructor {
new(): AudioContext;
}
interface Window {
AudioContext: AudioContextConstructor;
}
interface AudioContext {
createMediaStreamSource(stream: MediaStream): MediaStreamAudioSourceNode;
}
interface MediaStreamAudioSourceNode extends AudioNode {
}
interface AudioBuffer {
copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void;
copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void;
}
interface AudioNode {
disconnect(destination: AudioNode): void;
}
interface AudioContext {
suspend(): Promise<void>;
resume(): Promise<void>;
close(): Promise<void>;
}