@avoid.quest/audio 0.1.1-beta.2 → 0.1.1-beta.4
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 +6 -6
- package/dist/effects/index.d.ts +2 -8
- package/dist/effects/index.js +4 -14
- package/dist/effects/index.js.map +1 -1
- package/dist/{errors-ChTQFwuZ.d.ts → errors-BKZYmxIR.d.ts} +1 -0
- package/dist/{errors-BT9HxDLn.js → errors-C0N6fb0p.js} +2 -1
- package/dist/{errors-BT9HxDLn.js.map → errors-C0N6fb0p.js.map} +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/midi/index.d.ts +2 -1
- package/dist/midi/index.js +2 -1
- package/dist/midi/index.js.map +1 -1
- package/dist/{native-Bern4_PB.js → native-Cpwv9cBV.js} +2 -1
- package/dist/{native-Bern4_PB.js.map → native-Cpwv9cBV.js.map} +1 -1
- package/dist/{pcm-buffer-BsaH-L59.js → pcm-buffer-C_Yt9lQb.js} +22 -45
- package/dist/pcm-buffer-C_Yt9lQb.js.map +1 -0
- package/dist/playback/index.d.ts +78 -24
- package/dist/playback/index.js +134 -35
- package/dist/playback/index.js.map +1 -1
- package/dist/queue/index.d.ts +2 -2
- package/dist/queue/index.js +5 -24
- package/dist/queue/index.js.map +1 -1
- package/dist/recognize/index.d.ts +8 -81
- package/dist/recognize/index.js +1 -272
- package/dist/routing/index.d.ts +3 -3
- package/dist/routing/index.js +5 -4
- package/dist/routing/index.js.map +1 -1
- package/dist/{shazam-cT7xEIzJ.d.ts → shazam-uaDcx82B.d.ts} +5 -6
- package/dist/sync/index.d.ts +21 -176
- package/dist/sync/index.js +156 -727
- package/dist/sync/index.js.map +1 -1
- package/dist/{worklet-loader-B_rkf9ao.js → worklet-loader-BbEPtzLN.js} +8 -6
- package/dist/worklet-loader-BbEPtzLN.js.map +1 -0
- package/dist/{worklet-loader-BvDJuua5.d.ts → worklet-loader-o8CcHnok.d.ts} +4 -3
- package/dist/worklets/live-pcm.d.ts +1 -0
- package/dist/worklets/live-pcm.js +285 -0
- package/dist/worklets/live-pcm.js.map +1 -0
- package/package.json +6 -15
- package/dist/pcm-buffer-BsaH-L59.js.map +0 -1
- package/dist/recognize/index.js.map +0 -1
- package/dist/worklet-loader-B_rkf9ao.js.map +0 -1
- package/dist/worklets/couch-live.d.ts +0 -1
- package/dist/worklets/couch-live.js +0 -293
- package/dist/worklets/couch-live.js.map +0 -1
- package/types/hls-unavailable.d.ts +0 -14
package/dist/sync/index.d.ts
CHANGED
|
@@ -1,108 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Effect
|
|
3
|
-
import { d as AudioWorkletError,
|
|
4
|
-
|
|
5
|
-
export declare const
|
|
6
|
-
|
|
7
|
-
export declare
|
|
8
|
-
export declare const CCA1_MAX_PACKET_BYTES: number;
|
|
9
|
-
export declare const CCA1_ALLOWED_SAMPLE_RATES: readonly [44100, 48000, 96000];
|
|
10
|
-
export declare const CCA1_MAX_CLOCK_RTT_US = 100000;
|
|
11
|
-
type Cca1SampleRate = (typeof CCA1_ALLOWED_SAMPLE_RATES)[number];
|
|
12
|
-
interface Cca1Packet {
|
|
13
|
-
readonly generation?: string;
|
|
14
|
-
readonly channels: 1 | 2;
|
|
15
|
-
readonly sampleRate: Cca1SampleRate;
|
|
16
|
-
readonly sequence: number;
|
|
17
|
-
readonly samplePosition: number;
|
|
18
|
-
readonly capturedAtUs: number;
|
|
19
|
-
readonly pcm: Float32Array;
|
|
20
|
-
}
|
|
21
|
-
interface ClockPingSample {
|
|
22
|
-
readonly clientSentUs: number;
|
|
23
|
-
readonly serverUs: number;
|
|
24
|
-
readonly clientReceivedUs: number;
|
|
25
|
-
}
|
|
26
|
-
interface ClockHandshakeResult {
|
|
27
|
-
readonly rttUs: number;
|
|
28
|
-
readonly offsetUs: number;
|
|
29
|
-
}
|
|
30
|
-
export declare function validateCca1Packet(packet: Cca1Packet): Effect.Effect<Cca1Packet, AudioSyncError>;
|
|
31
|
-
export declare function encodeCca1Frame(packet: Cca1Packet): Effect.Effect<Uint8Array, AudioSyncError>;
|
|
32
|
-
export declare function decodeCca1Frame(data: Uint8Array | ArrayBuffer, options?: {
|
|
33
|
-
readonly generation?: string;
|
|
34
|
-
readonly clockOffsetUs?: number;
|
|
35
|
-
}): Effect.Effect<Cca1Packet, AudioSyncError>;
|
|
36
|
-
export declare function computeClockHandshake(samples: readonly ClockPingSample[], maxRttUs?: number): Effect.Effect<ClockHandshakeResult, AudioSyncError>;
|
|
37
|
-
export declare const SDK_BATCH_MS = 15;
|
|
38
|
-
interface LossSecond {
|
|
39
|
-
readonly chunks: number;
|
|
40
|
-
readonly lost: number;
|
|
41
|
-
readonly sendAheadMs?: number;
|
|
42
|
-
readonly lateMs?: number;
|
|
43
|
-
readonly syncErrorMs?: number;
|
|
44
|
-
}
|
|
45
|
-
interface Recurring {
|
|
46
|
-
readonly measure: "running" | "chunks" | "spells";
|
|
47
|
-
readonly count: number;
|
|
48
|
-
readonly stepMs: number;
|
|
49
|
-
}
|
|
50
|
-
interface MovingPhase {
|
|
51
|
-
readonly kind: "moving";
|
|
52
|
-
readonly caused: Recurring;
|
|
53
|
-
readonly sendAheadMs?: number;
|
|
54
|
-
readonly askedMs: number;
|
|
55
|
-
readonly landedMs: number;
|
|
56
|
-
readonly waited: number;
|
|
57
|
-
}
|
|
58
|
-
type Phase = {
|
|
59
|
-
readonly kind: "watching";
|
|
60
|
-
} | MovingPhase | {
|
|
61
|
-
readonly kind: "pausing";
|
|
62
|
-
readonly left: number;
|
|
63
|
-
};
|
|
64
|
-
interface LateSteps {
|
|
65
|
-
readonly lateMs: number;
|
|
66
|
-
readonly partMs?: number;
|
|
67
|
-
readonly unhelpful: number;
|
|
68
|
-
readonly caused?: Recurring;
|
|
69
|
-
readonly clean: number;
|
|
70
|
-
readonly counted: number;
|
|
71
|
-
readonly taken: readonly {
|
|
72
|
-
readonly at: number;
|
|
73
|
-
readonly ms: number;
|
|
74
|
-
}[];
|
|
75
|
-
readonly seconds: readonly LossSecond[];
|
|
76
|
-
readonly phase: Phase;
|
|
77
|
-
}
|
|
78
|
-
export declare const NO_LATE_STEPS: LateSteps;
|
|
79
|
-
export declare const SDK_LATE_STEPS: LateSteps;
|
|
80
|
-
export declare const FIRST_HOUR_MAX_LATE_MS: number;
|
|
81
|
-
export declare const SUBSEQUENT_HOUR_MAX_LATE_MS: number;
|
|
82
|
-
export declare const arrivalLateMs: (sendAheadMs: number, stampUs: number, nowUs: number) => number;
|
|
83
|
-
export declare function measuredLateMs(seconds: readonly number[]): number | undefined;
|
|
84
|
-
export declare const declareLiveBuffer: (declaredMs: number | undefined, latencyMs?: readonly number[], allowanceMs?: number) => number | undefined;
|
|
85
|
-
export declare const withLateSteps: (needMs: number, lateMs: number) => number;
|
|
86
|
-
export declare function nextLateSteps(before: LateSteps, second: LossSecond): LateSteps;
|
|
87
|
-
type LiveWire = "opus" | "pcm";
|
|
88
|
-
interface LiveLeadController {
|
|
89
|
-
readonly arrived: (wire: LiveWire, capturedAtUs: number, nowUs: number) => void;
|
|
90
|
-
readonly leadMs: (clientId: string, wire: LiveWire, declaredMs: number | undefined, name?: string) => number;
|
|
91
|
-
readonly measureMs: (wire: LiveWire) => number | undefined;
|
|
92
|
-
readonly restart: () => void;
|
|
93
|
-
readonly left: (clientId: string) => void;
|
|
94
|
-
}
|
|
95
|
-
export declare function createLiveLead(log?: (line: string) => void, nowMs?: () => number): LiveLeadController;
|
|
96
|
-
export declare const LIVE_STEP_MS = 5;
|
|
97
|
-
export declare const LIVE_LATE_STEP_MS = 10;
|
|
98
|
-
export declare const LIVE_READINGS = 5;
|
|
99
|
-
export declare function liveStep(needMs: number): number;
|
|
100
|
-
/**
|
|
101
|
-
* Computes a monotonically rising buffered need from recent once-a-second readings.
|
|
102
|
-
* Sets immediately on the first reading; subsequently raises only when the median
|
|
103
|
-
* of the last `window` readings exceeds `currentMs + LIVE_STEP_MS`.
|
|
104
|
-
*/
|
|
105
|
-
export declare function risenNeed(currentMs: number | undefined, readingsMs: readonly number[], allowanceMs?: number, window?: number): number | undefined;
|
|
1
|
+
import "../index.js";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import { d as AudioWorkletError, u as AudioUnsupportedError } from "../errors-BKZYmxIR.js";
|
|
4
|
+
import { t as LoadAudioWorkletOptions } from "../worklet-loader-o8CcHnok.js";
|
|
5
|
+
export declare const LIVE_PCM_PROCESSOR_NAME: "live-pcm";
|
|
6
|
+
type LoadLivePcmWorkletOptions = Omit<LoadAudioWorkletOptions, "processorName">;
|
|
7
|
+
export declare function loadLivePcmWorklet(context: BaseAudioContext, options?: LoadLivePcmWorkletOptions): Effect.Effect<void, AudioUnsupportedError | AudioWorkletError>;
|
|
106
8
|
interface LiveChunk {
|
|
107
9
|
readonly frame: number;
|
|
108
10
|
readonly stampUs: number;
|
|
@@ -135,81 +37,24 @@ interface LiveStats {
|
|
|
135
37
|
errorMax: number;
|
|
136
38
|
corrections: number;
|
|
137
39
|
}
|
|
40
|
+
interface LiveTimeline {
|
|
41
|
+
readonly stats: LiveStats;
|
|
42
|
+
readonly length: number;
|
|
43
|
+
readonly maxCapacity: number;
|
|
44
|
+
readonly reset: () => void;
|
|
45
|
+
readonly takeStats: () => LiveStats;
|
|
46
|
+
readonly takeStatsInto: (target: LiveStats) => void;
|
|
47
|
+
readonly push: (chunk: LiveChunk, next: number) => void;
|
|
48
|
+
readonly render: (frame: number, output: Float32Array[]) => void;
|
|
49
|
+
}
|
|
138
50
|
/**
|
|
139
|
-
* Default ring size in chunks
|
|
140
|
-
*
|
|
51
|
+
* Default ring size in chunks (6.4 s of 5 ms frames), above a 5 s listener
|
|
52
|
+
* buffer so queued audio is not dropped.
|
|
141
53
|
*/
|
|
142
54
|
export declare const DEFAULT_LIVE_TIMELINE_CAPACITY = 1280;
|
|
143
55
|
export declare const contextFrame: (clock: LiveClock, pageMs: number) => number;
|
|
144
56
|
export declare function pageClock(): PageClockEstimator;
|
|
145
57
|
export declare const noStats: () => LiveStats;
|
|
146
58
|
export declare function addStats(totals: LiveStats, stats: LiveStats): void;
|
|
147
|
-
export declare
|
|
148
|
-
|
|
149
|
-
private readonly ring;
|
|
150
|
-
private head;
|
|
151
|
-
private tail;
|
|
152
|
-
private count;
|
|
153
|
-
private position;
|
|
154
|
-
private playing;
|
|
155
|
-
private dry;
|
|
156
|
-
private endStampUs;
|
|
157
|
-
private correcting;
|
|
158
|
-
private settling;
|
|
159
|
-
private rate;
|
|
160
|
-
private readonly sampleRate;
|
|
161
|
-
stats: LiveStats;
|
|
162
|
-
constructor(sampleRate: number, capacity?: number);
|
|
163
|
-
get length(): number;
|
|
164
|
-
get maxCapacity(): number;
|
|
165
|
-
reset(): void;
|
|
166
|
-
takeStats(): LiveStats;
|
|
167
|
-
takeStatsInto(target: LiveStats): void;
|
|
168
|
-
private stopSlew;
|
|
169
|
-
private at;
|
|
170
|
-
private dropHead;
|
|
171
|
-
push(chunk: LiveChunk, next: number): void;
|
|
172
|
-
render(frame: number, output: Float32Array[]): void;
|
|
173
|
-
private queued;
|
|
174
|
-
private place;
|
|
175
|
-
private steer;
|
|
176
|
-
private read;
|
|
177
|
-
}
|
|
178
|
-
export declare const COUCH_LIVE_PROCESSOR_NAME: "couch-live";
|
|
179
|
-
export declare const SENDSPIN_BINARY_AUDIO_TYPE = 4;
|
|
180
|
-
export declare const SENDSPIN_VOLUME_RAMP_TIME_CONSTANT_S = 0.015;
|
|
181
|
-
interface SendspinAudioHeader {
|
|
182
|
-
readonly messageType: 4;
|
|
183
|
-
readonly stampUs: number;
|
|
184
|
-
readonly sendAheadUs: number;
|
|
185
|
-
}
|
|
186
|
-
interface LoadCouchLiveWorkletOptions {
|
|
187
|
-
readonly moduleUrl?: string;
|
|
188
|
-
readonly inlineSource?: string;
|
|
189
|
-
readonly fallbackToBlob?: boolean;
|
|
190
|
-
readonly fetchImpl?: typeof fetch;
|
|
191
|
-
}
|
|
192
|
-
interface SendspinReceiverOptions {
|
|
193
|
-
readonly outputNode?: AudioNode;
|
|
194
|
-
readonly initialVolume?: number;
|
|
195
|
-
readonly initialMuted?: boolean;
|
|
196
|
-
readonly workletOptions?: LoadCouchLiveWorkletOptions;
|
|
197
|
-
readonly onStats?: (epoch: number, stats: LiveStats) => void;
|
|
198
|
-
}
|
|
199
|
-
interface SendspinReceiver {
|
|
200
|
-
readonly outputGain: GainNode;
|
|
201
|
-
readonly targetNode: AudioNode;
|
|
202
|
-
readonly workletNode: AudioWorkletNode;
|
|
203
|
-
readonly feedPort: MessagePort;
|
|
204
|
-
readonly pushChunk: (chunk: LiveChunk) => void;
|
|
205
|
-
readonly resetTimeline: (epoch?: number) => number;
|
|
206
|
-
readonly setVolume: (volumePercent: number) => number;
|
|
207
|
-
readonly setMuted: (muted: boolean) => boolean;
|
|
208
|
-
readonly reconnectOutput: (nextOutputNode: AudioNode) => void;
|
|
209
|
-
readonly dispose: () => void;
|
|
210
|
-
}
|
|
211
|
-
export declare function computeLiveVolumeGain(volumePercent: number, muted: boolean): number;
|
|
212
|
-
export declare function sniffSendspinAudioHeader(data: Uint8Array | ArrayBuffer): SendspinAudioHeader | undefined;
|
|
213
|
-
export declare function loadCouchLiveWorklet(context: BaseAudioContext, options?: LoadCouchLiveWorkletOptions): Effect.Effect<void, AudioUnsupportedError | AudioWorkletError>;
|
|
214
|
-
export declare const createSendspinReceiver: (context: BaseAudioContext, options?: SendspinReceiverOptions | undefined) => Effect.Effect<SendspinReceiver, AudioUnsupportedError | AudioWorkletError, Scope.Scope>;
|
|
215
|
-
export { type Cca1Packet, type Cca1SampleRate, type ClockHandshakeResult, type ClockPingSample, type LateSteps, type LiveChunk, type LiveClock, type LiveLeadController, type LiveMessage, type LiveStats, type LiveWire, type LoadAudioWorkletOptions, type LoadCouchLiveWorkletOptions, type LossSecond, type PageClockEstimator, type SendspinAudioHeader, type SendspinReceiver, type SendspinReceiverOptions, VITE_AUDIO_WORKLET_OPTIMIZE_DEPS_EXCLUDE, type WorkletId, type WorkletModuleHandle, createWorkletBlobUrl, createWorkletModuleUrl, loadAudioWorklet };
|
|
59
|
+
export declare function createLiveTimeline(sampleRate: number, capacity?: number): LiveTimeline;
|
|
60
|
+
export type { LiveChunk, LiveClock, LiveMessage, LiveStats, LiveTimeline, LoadLivePcmWorkletOptions, PageClockEstimator };
|