@elevenlabs/client 0.15.0 → 0.15.2
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/.turbo/turbo-build.log +9 -9
- package/.turbo/turbo-generate-version.log +1 -1
- package/.turbo/turbo-generate-worklets.log +1 -1
- package/.turbo/turbo-lint$colon$es.log +2 -2
- package/.turbo/turbo-lint$colon$prettier.log +1 -1
- package/CHANGELOG.md +14 -0
- package/dist/BaseConversation.d.ts +4 -0
- package/dist/lib.cjs +1 -1
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.modern.js +1 -1
- package/dist/lib.modern.js.map +1 -1
- package/dist/lib.module.js +1 -1
- package/dist/lib.module.js.map +1 -1
- package/dist/lib.umd.js +1 -1
- package/dist/lib.umd.js.map +1 -1
- package/dist/utils/BaseConnection.d.ts +1 -0
- package/dist/utils/addLibsamplerateModule.d.ts +1 -0
- package/dist/utils/events.d.ts +2 -1
- package/dist/utils/output.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
- package/worklets/audioConcatProcessor.js +17 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function addLibsamplerateModule(context: AudioContext, customPath?: string): Promise<void>;
|
package/dist/utils/events.d.ts
CHANGED
|
@@ -30,5 +30,6 @@ export type ContextualUpdateEvent = Outgoing.ContextualUpdateClientToOrchestrato
|
|
|
30
30
|
export type UserMessageEvent = Outgoing.UserMessageClientToOrchestratorEvent;
|
|
31
31
|
export type UserActivityEvent = Outgoing.UserActivityClientToOrchestratorEvent;
|
|
32
32
|
export type MCPToolApprovalResultEvent = Outgoing.McpToolApprovalResultClientToOrchestratorEvent;
|
|
33
|
-
export type
|
|
33
|
+
export type MultimodalMessageEvent = Outgoing.MultimodalMessageClientToOrchestratorEvent;
|
|
34
|
+
export type OutgoingSocketEvent = PongEvent | UserAudioEvent | InitiationClientDataEvent | UserFeedbackEvent | ClientToolResultEvent | ContextualUpdateEvent | UserMessageEvent | UserActivityEvent | MCPToolApprovalResultEvent | MultimodalMessageEvent;
|
|
34
35
|
export declare function isValidSocketEvent(event: any): event is IncomingSocketEvent;
|
package/dist/utils/output.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare class Output {
|
|
|
9
9
|
readonly gain: GainNode;
|
|
10
10
|
readonly worklet: AudioWorkletNode;
|
|
11
11
|
readonly audioElement: HTMLAudioElement;
|
|
12
|
-
static create({ sampleRate, format, outputDeviceId, workletPaths, }: FormatConfig & OutputConfig & AudioWorkletConfig): Promise<Output>;
|
|
12
|
+
static create({ sampleRate, format, outputDeviceId, workletPaths, libsampleratePath, }: FormatConfig & OutputConfig & AudioWorkletConfig): Promise<Output>;
|
|
13
13
|
private constructor();
|
|
14
14
|
setOutputDevice(deviceId?: string): Promise<void>;
|
|
15
15
|
close(): Promise<void>;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "0.15.
|
|
1
|
+
export declare const PACKAGE_VERSION = "0.15.2";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elevenlabs/client",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"description": "ElevenLabs JavaScript Client Library",
|
|
5
5
|
"main": "./dist/lib.umd.js",
|
|
6
6
|
"module": "./dist/lib.module.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"livekit-client": "^2.11.4",
|
|
42
|
-
"@elevenlabs/types": "0.6.
|
|
42
|
+
"@elevenlabs/types": "0.6.1"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"generate-version": "printf \"// This file is auto-generated during build\\nexport const PACKAGE_VERSION = \\\"%s\\\";\\n\" \"$npm_package_version\" > src/version.ts",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* USED BY @elevenlabs/client
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
const decodeTable = [0,132,396,924,1980,4092,8316,16764];
|
|
7
|
+
const decodeTable = [0, 132, 396, 924, 1980, 4092, 8316, 16764];
|
|
8
8
|
|
|
9
9
|
function decodeSample(muLawSample) {
|
|
10
10
|
let sign;
|
|
@@ -12,10 +12,10 @@ function decodeSample(muLawSample) {
|
|
|
12
12
|
let mantissa;
|
|
13
13
|
let sample;
|
|
14
14
|
muLawSample = ~muLawSample;
|
|
15
|
-
sign =
|
|
15
|
+
sign = muLawSample & 0x80;
|
|
16
16
|
exponent = (muLawSample >> 4) & 0x07;
|
|
17
|
-
mantissa = muLawSample &
|
|
18
|
-
sample = decodeTable[exponent] + (mantissa << (exponent+3));
|
|
17
|
+
mantissa = muLawSample & 0x0f;
|
|
18
|
+
sample = decodeTable[exponent] + (mantissa << (exponent + 3));
|
|
19
19
|
if (sign !== 0) sample = -sample;
|
|
20
20
|
|
|
21
21
|
return sample;
|
|
@@ -29,11 +29,20 @@ class AudioConcatProcessor extends AudioWorkletProcessor {
|
|
|
29
29
|
this.currentBuffer = null;
|
|
30
30
|
this.wasInterrupted = false;
|
|
31
31
|
this.finished = false;
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
this.port.onmessage = ({ data }) => {
|
|
34
34
|
switch (data.type) {
|
|
35
35
|
case "setFormat":
|
|
36
36
|
this.format = data.format;
|
|
37
|
+
if (globalThis.LibSampleRate && sampleRate !== data.sampleRate) {
|
|
38
|
+
globalThis.LibSampleRate.create(
|
|
39
|
+
1,
|
|
40
|
+
data.sampleRate,
|
|
41
|
+
sampleRate
|
|
42
|
+
).then(resampler => {
|
|
43
|
+
this.resampler = resampler;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
37
46
|
break;
|
|
38
47
|
case "buffer":
|
|
39
48
|
this.wasInterrupted = false;
|
|
@@ -65,6 +74,9 @@ class AudioConcatProcessor extends AudioWorkletProcessor {
|
|
|
65
74
|
break;
|
|
66
75
|
}
|
|
67
76
|
this.currentBuffer = this.buffers.shift();
|
|
77
|
+
if (this.resampler) {
|
|
78
|
+
this.currentBuffer = this.resampler.full(this.currentBuffer);
|
|
79
|
+
}
|
|
68
80
|
this.cursor = 0;
|
|
69
81
|
}
|
|
70
82
|
|