@pipecat-ai/websocket-transport 1.5.0 → 1.6.1
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/dist/index.d.ts.map +1 -1
- package/dist/index.js +171 -91
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +171 -91
- package/dist/index.module.js.map +1 -1
- package/package.json +11 -4
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;ASUA,QAAO,QAAQ;IACb,UAAkB,kBAAkB,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAClE,UAAkB,QAAQ,EAAE,oBAAoB,CAAC;IACjD,SAAS,CAAC,UAAU,EAAE,kBAAkB,CAAM;IAE9C,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC;IAC/B,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC;IAE/B,SAAS,CAAC,oBAAoB,EAAE,OAAO,CAAC;;IAQxC,oBAAoB,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI;IAGnE,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,QAAQ,GAAE,OAAe;IAQzE,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IACpC,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IACjC,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAEpC,QAAQ,CAAC,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC;IAChD,QAAQ,CAAC,cAAc,CACrB,IAAI,EAAE,WAAW,GAAG,UAAU,EAC9B,EAAE,CAAC,EAAE,MAAM,GACV,UAAU,GAAG,SAAS;IAEzB,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IACjD,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IACjD,QAAQ,C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C,OAAO,EAAE,GAAG,CAAA;KAAE,CAChC;CAoBF","sources":["transports/lib/wavtools/lib/wav_packer.js","transports/lib/wavtools/lib/analysis/constants.js","transports/lib/wavtools/lib/analysis/audio_analysis.js","transports/lib/wavtools/lib/worklets/stream_processor.js","transports/lib/wavtools/lib/wav_stream_player.js","transports/lib/wavtools/lib/worklets/audio_processor.js","transports/lib/wavtools/lib/wav_recorder.js","transports/lib/wavtools/lib/mediastream_recorder.js","transports/lib/wavtools/index.js","transports/lib/media-mgmt/mediaManager.ts","transports/lib/media-mgmt/dailyMediaManager.ts","transports/lib/websocket-utils/reconnectingWebSocket.ts","transports/websocket-transport/src/src/serializers/websocketSerializer.ts","transports/websocket-transport/src/src/generated/proto/frames.ts","transports/websocket-transport/src/src/serializers/protobufSerializer.ts","transports/websocket-transport/src/src/webSocketTransport.ts","transports/websocket-transport/src/src/serializers/twilioSerializer.ts","transports/websocket-transport/src/src/index.ts","transports/websocket-transport/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"// export * from \"./realTimeWebSocketTransport\";\n// export * from \"../../../lib/wavtools/dist/index.d.ts\";\n\nimport { WavMediaManager } from \"../../../lib/media-mgmt/mediaManager\";\nimport { DailyMediaManager } from \"../../../lib/media-mgmt/dailyMediaManager\";\nimport { WebSocketTransport } from \"./webSocketTransport.ts\";\nimport { ProtobufFrameSerializer } from \"./serializers/protobufSerializer.ts\";\nimport { TwilioSerializer } from \"./serializers/twilioSerializer.ts\";\n\nexport {\n WavMediaManager,\n DailyMediaManager,\n WebSocketTransport,\n ProtobufFrameSerializer,\n TwilioSerializer,\n};\n"],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/dist/index.js
CHANGED
|
@@ -89,11 +89,11 @@ $parcel$export(module.exports, "TwilioSerializer", () => $36ab1bf4324e4b8b$expor
|
|
|
89
89
|
const { bitsPerSample: bitsPerSample, channels: channels, data: data } = audio;
|
|
90
90
|
const output = [
|
|
91
91
|
// Header
|
|
92
|
-
|
|
92
|
+
"RIFF",
|
|
93
93
|
this._packData(1, 52),
|
|
94
|
-
|
|
94
|
+
"WAVE",
|
|
95
95
|
// chunk 1
|
|
96
|
-
|
|
96
|
+
"fmt ",
|
|
97
97
|
this._packData(1, 16),
|
|
98
98
|
this._packData(0, 1),
|
|
99
99
|
this._packData(0, channels.length),
|
|
@@ -102,12 +102,12 @@ $parcel$export(module.exports, "TwilioSerializer", () => $36ab1bf4324e4b8b$expor
|
|
|
102
102
|
this._packData(0, channels.length * bitsPerSample / 8),
|
|
103
103
|
this._packData(0, bitsPerSample),
|
|
104
104
|
// chunk 2
|
|
105
|
-
|
|
105
|
+
"data",
|
|
106
106
|
this._packData(1, channels[0].length * channels.length * bitsPerSample / 8),
|
|
107
107
|
data
|
|
108
108
|
];
|
|
109
109
|
const blob = new Blob(output, {
|
|
110
|
-
type:
|
|
110
|
+
type: "audio/mpeg"
|
|
111
111
|
});
|
|
112
112
|
const url = URL.createObjectURL(blob);
|
|
113
113
|
return {
|
|
@@ -144,18 +144,18 @@ const $e10a9de47f58e137$var$octave8Frequencies = [
|
|
|
144
144
|
];
|
|
145
145
|
// Labels for each of the above frequencies
|
|
146
146
|
const $e10a9de47f58e137$var$octave8FrequencyLabels = [
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
147
|
+
"C",
|
|
148
|
+
"C#",
|
|
149
|
+
"D",
|
|
150
|
+
"D#",
|
|
151
|
+
"E",
|
|
152
|
+
"F",
|
|
153
|
+
"F#",
|
|
154
|
+
"G",
|
|
155
|
+
"G#",
|
|
156
|
+
"A",
|
|
157
|
+
"A#",
|
|
158
|
+
"B"
|
|
159
159
|
];
|
|
160
160
|
const $e10a9de47f58e137$export$776c63898ae5b636 = [];
|
|
161
161
|
const $e10a9de47f58e137$export$facd167cc27ea9b0 = [];
|
|
@@ -190,7 +190,7 @@ class $5853841ab58516d4$export$2c3136da0bf130f9 {
|
|
|
190
190
|
* @param {number} [minDecibels] default -100
|
|
191
191
|
* @param {number} [maxDecibels] default -30
|
|
192
192
|
* @returns {AudioAnalysisOutputType}
|
|
193
|
-
*/ static getFrequencies(analyser, sampleRate, fftResult, analysisType =
|
|
193
|
+
*/ static getFrequencies(analyser, sampleRate, fftResult, analysisType = "frequency", minDecibels = -100, maxDecibels = -30) {
|
|
194
194
|
if (!fftResult) {
|
|
195
195
|
fftResult = new Float32Array(analyser.frequencyBinCount);
|
|
196
196
|
analyser.getFloatFrequencyData(fftResult);
|
|
@@ -200,8 +200,8 @@ class $5853841ab58516d4$export$2c3136da0bf130f9 {
|
|
|
200
200
|
let outputValues;
|
|
201
201
|
let frequencies;
|
|
202
202
|
let labels;
|
|
203
|
-
if (analysisType ===
|
|
204
|
-
const useFrequencies = analysisType ===
|
|
203
|
+
if (analysisType === "music" || analysisType === "voice") {
|
|
204
|
+
const useFrequencies = analysisType === "voice" ? (0, $e10a9de47f58e137$export$dbc1581ed2cfa183) : (0, $e10a9de47f58e137$export$776c63898ae5b636);
|
|
205
205
|
const aggregateOutput = Array(useFrequencies.length).fill(minDecibels);
|
|
206
206
|
for(let i = 0; i < fftResult.length; i++){
|
|
207
207
|
const frequency = i * frequencyStep;
|
|
@@ -212,8 +212,8 @@ class $5853841ab58516d4$export$2c3136da0bf130f9 {
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
outputValues = aggregateOutput;
|
|
215
|
-
frequencies = analysisType ===
|
|
216
|
-
labels = analysisType ===
|
|
215
|
+
frequencies = analysisType === "voice" ? (0, $e10a9de47f58e137$export$dbc1581ed2cfa183) : (0, $e10a9de47f58e137$export$776c63898ae5b636);
|
|
216
|
+
labels = analysisType === "voice" ? (0, $e10a9de47f58e137$export$30a6f2881311088f) : (0, $e10a9de47f58e137$export$facd167cc27ea9b0);
|
|
217
217
|
} else {
|
|
218
218
|
outputValues = Array.from(fftResult);
|
|
219
219
|
frequencies = outputValues.map((_, i)=>frequencyStep * i);
|
|
@@ -299,7 +299,7 @@ class $5853841ab58516d4$export$2c3136da0bf130f9 {
|
|
|
299
299
|
* @param {number} [minDecibels] default -100
|
|
300
300
|
* @param {number} [maxDecibels] default -30
|
|
301
301
|
* @returns {AudioAnalysisOutputType}
|
|
302
|
-
*/ getFrequencies(analysisType =
|
|
302
|
+
*/ getFrequencies(analysisType = "frequency", minDecibels = -100, maxDecibels = -30) {
|
|
303
303
|
let fftResult = null;
|
|
304
304
|
if (this.audioBuffer && this.fftResults.length) {
|
|
305
305
|
const pct = this.audio.currentTime / this.audio.duration;
|
|
@@ -313,7 +313,7 @@ class $5853841ab58516d4$export$2c3136da0bf130f9 {
|
|
|
313
313
|
* user interaction when the AudioAnalysis was instantiated.
|
|
314
314
|
* @returns {Promise<true>}
|
|
315
315
|
*/ async resumeIfSuspended() {
|
|
316
|
-
if (this.context.state ===
|
|
316
|
+
if (this.context.state === "suspended") await this.context.resume();
|
|
317
317
|
return true;
|
|
318
318
|
}
|
|
319
319
|
}
|
|
@@ -413,7 +413,7 @@ registerProcessor('stream_processor', StreamProcessor);
|
|
|
413
413
|
const $d6d3743ef65c7519$var$script = new Blob([
|
|
414
414
|
$d6d3743ef65c7519$export$50b76700e2b15e9
|
|
415
415
|
], {
|
|
416
|
-
type:
|
|
416
|
+
type: "application/javascript"
|
|
417
417
|
});
|
|
418
418
|
const $d6d3743ef65c7519$var$src = URL.createObjectURL($d6d3743ef65c7519$var$script);
|
|
419
419
|
const $d6d3743ef65c7519$export$bfa8c596114d74df = $d6d3743ef65c7519$var$src;
|
|
@@ -768,7 +768,7 @@ registerProcessor('audio_processor', AudioProcessor);
|
|
|
768
768
|
const $2cf6a2d8a6d031bc$var$script = new Blob([
|
|
769
769
|
$2cf6a2d8a6d031bc$var$AudioProcessorWorklet
|
|
770
770
|
], {
|
|
771
|
-
type:
|
|
771
|
+
type: "application/javascript"
|
|
772
772
|
});
|
|
773
773
|
const $2cf6a2d8a6d031bc$var$src = URL.createObjectURL($2cf6a2d8a6d031bc$var$script);
|
|
774
774
|
const $2cf6a2d8a6d031bc$export$1f65f50a8cbff43c = $2cf6a2d8a6d031bc$var$src;
|
|
@@ -832,7 +832,7 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
832
832
|
blob = new Blob([
|
|
833
833
|
arrayBuffer
|
|
834
834
|
], {
|
|
835
|
-
type:
|
|
835
|
+
type: "audio/wav"
|
|
836
836
|
});
|
|
837
837
|
} else {
|
|
838
838
|
let float32Array;
|
|
@@ -887,9 +887,9 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
887
887
|
* Retrieves the current status of the recording
|
|
888
888
|
* @returns {"ended"|"paused"|"recording"}
|
|
889
889
|
*/ getStatus() {
|
|
890
|
-
if (!this.processor) return
|
|
891
|
-
else if (!this.recording) return
|
|
892
|
-
else return
|
|
890
|
+
if (!this.processor) return "ended";
|
|
891
|
+
else if (!this.recording) return "paused";
|
|
892
|
+
else return "recording";
|
|
893
893
|
}
|
|
894
894
|
/**
|
|
895
895
|
* Sends an event to the AudioWorklet
|
|
@@ -900,7 +900,7 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
900
900
|
* @returns {Promise<{[key: string]: any}>}
|
|
901
901
|
*/ async _event(name, data = {}, _processor = null) {
|
|
902
902
|
_processor = _processor || this.processor;
|
|
903
|
-
if (!_processor) throw new Error(
|
|
903
|
+
if (!_processor) throw new Error("Can not send events without recording first");
|
|
904
904
|
const message = {
|
|
905
905
|
event: name,
|
|
906
906
|
id: this._lastEventId++,
|
|
@@ -922,7 +922,7 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
922
922
|
* @returns {true}
|
|
923
923
|
*/ listenForDeviceChange(callback) {
|
|
924
924
|
if (callback === null && this._deviceChangeCallback) {
|
|
925
|
-
navigator.mediaDevices.removeEventListener(
|
|
925
|
+
navigator.mediaDevices.removeEventListener("devicechange", this._deviceChangeCallback);
|
|
926
926
|
this._deviceChangeCallback = null;
|
|
927
927
|
} else if (callback !== null) {
|
|
928
928
|
// Basically a debounce; we only want this called once when devices change
|
|
@@ -930,7 +930,7 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
930
930
|
// if a few are operating at the same time
|
|
931
931
|
let lastId = 0;
|
|
932
932
|
let lastDevices = [];
|
|
933
|
-
const serializeDevices = (devices)=>devices.map((d)=>d.deviceId).sort().join(
|
|
933
|
+
const serializeDevices = (devices)=>devices.map((d)=>d.deviceId).sort().join(",");
|
|
934
934
|
const cb = async ()=>{
|
|
935
935
|
let id = ++lastId;
|
|
936
936
|
const devices = await this.listDevices();
|
|
@@ -941,7 +941,7 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
941
941
|
}
|
|
942
942
|
}
|
|
943
943
|
};
|
|
944
|
-
navigator.mediaDevices.addEventListener(
|
|
944
|
+
navigator.mediaDevices.addEventListener("devicechange", cb);
|
|
945
945
|
cb();
|
|
946
946
|
this._deviceChangeCallback = cb;
|
|
947
947
|
}
|
|
@@ -959,9 +959,9 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
959
959
|
* @returns {Promise<true>}
|
|
960
960
|
*/ async requestPermission() {
|
|
961
961
|
const permissionStatus = await navigator.permissions.query({
|
|
962
|
-
name:
|
|
962
|
+
name: "microphone"
|
|
963
963
|
});
|
|
964
|
-
if (permissionStatus.state ===
|
|
964
|
+
if (permissionStatus.state === "denied") {
|
|
965
965
|
if (this._deviceErrorCallback) this._deviceErrorCallback({
|
|
966
966
|
devices: [
|
|
967
967
|
"mic"
|
|
@@ -969,7 +969,7 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
969
969
|
type: "unknown",
|
|
970
970
|
error: new Error("Microphone access denied")
|
|
971
971
|
});
|
|
972
|
-
} else if (permissionStatus.state ===
|
|
972
|
+
} else if (permissionStatus.state === "prompt") try {
|
|
973
973
|
const stream = await navigator.mediaDevices.getUserMedia({
|
|
974
974
|
audio: true
|
|
975
975
|
});
|
|
@@ -991,10 +991,10 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
991
991
|
* List all eligible devices for recording, will request permission to use microphone
|
|
992
992
|
* @returns {Promise<Array<MediaDeviceInfo & {default: boolean}>>}
|
|
993
993
|
*/ async listDevices() {
|
|
994
|
-
if (!navigator.mediaDevices || !(
|
|
994
|
+
if (!navigator.mediaDevices || !("enumerateDevices" in navigator.mediaDevices)) throw new Error("Could not request user devices");
|
|
995
995
|
await this.requestPermission();
|
|
996
996
|
const devices = await navigator.mediaDevices.enumerateDevices();
|
|
997
|
-
const audioDevices = devices.filter((device)=>device.kind ===
|
|
997
|
+
const audioDevices = devices.filter((device)=>device.kind === "audioinput");
|
|
998
998
|
return audioDevices;
|
|
999
999
|
// const defaultDeviceIndex = audioDevices.findIndex(
|
|
1000
1000
|
// (device) => device.deviceId === 'default'
|
|
@@ -1020,7 +1020,7 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
1020
1020
|
* @returns {Promise<true>}
|
|
1021
1021
|
*/ async begin(deviceId) {
|
|
1022
1022
|
if (this.processor) throw new Error(`Already connected: please call .end() to start a new session`);
|
|
1023
|
-
if (!navigator.mediaDevices || !(
|
|
1023
|
+
if (!navigator.mediaDevices || !("getUserMedia" in navigator.mediaDevices)) {
|
|
1024
1024
|
if (this._deviceErrorCallback) this._deviceErrorCallback({
|
|
1025
1025
|
devices: [
|
|
1026
1026
|
"mic",
|
|
@@ -1028,7 +1028,7 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
1028
1028
|
],
|
|
1029
1029
|
type: "undefined-mediadevices"
|
|
1030
1030
|
});
|
|
1031
|
-
throw new Error(
|
|
1031
|
+
throw new Error("Could not request user media");
|
|
1032
1032
|
}
|
|
1033
1033
|
deviceId = deviceId ?? this.deviceSelection?.deviceId;
|
|
1034
1034
|
try {
|
|
@@ -1049,13 +1049,13 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
1049
1049
|
type: "unknown",
|
|
1050
1050
|
error: err
|
|
1051
1051
|
});
|
|
1052
|
-
throw new Error(
|
|
1052
|
+
throw new Error("Could not start media stream");
|
|
1053
1053
|
}
|
|
1054
1054
|
this.listDevices().then((devices)=>{
|
|
1055
1055
|
deviceId = this.stream.getAudioTracks()[0].getSettings().deviceId;
|
|
1056
|
-
console.log(
|
|
1056
|
+
console.log("find current device", devices, deviceId, this.stream.getAudioTracks()[0].getSettings());
|
|
1057
1057
|
this.deviceSelection = devices.find((d)=>d.deviceId === deviceId);
|
|
1058
|
-
console.log(
|
|
1058
|
+
console.log("current device", this.deviceSelection);
|
|
1059
1059
|
});
|
|
1060
1060
|
const context = new AudioContext({
|
|
1061
1061
|
sampleRate: this.sampleRate
|
|
@@ -1068,11 +1068,11 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
1068
1068
|
console.error(e);
|
|
1069
1069
|
throw new Error(`Could not add audioWorklet module: ${this.scriptSrc}`);
|
|
1070
1070
|
}
|
|
1071
|
-
const processor = new AudioWorkletNode(context,
|
|
1071
|
+
const processor = new AudioWorkletNode(context, "audio_processor");
|
|
1072
1072
|
processor.port.onmessage = (e)=>{
|
|
1073
1073
|
const { event: event, id: id, data: data } = e.data;
|
|
1074
|
-
if (event ===
|
|
1075
|
-
else if (event ===
|
|
1074
|
+
if (event === "receipt") this.eventReceipts[id] = data;
|
|
1075
|
+
else if (event === "chunk") {
|
|
1076
1076
|
if (this._chunkProcessorSize) {
|
|
1077
1077
|
const buffer = this._chunkProcessorBuffer;
|
|
1078
1078
|
this._chunkProcessorBuffer = {
|
|
@@ -1103,7 +1103,7 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
1103
1103
|
this.node = node;
|
|
1104
1104
|
this.analyser = analyser;
|
|
1105
1105
|
this.processor = processor;
|
|
1106
|
-
console.log(
|
|
1106
|
+
console.log("begin completed");
|
|
1107
1107
|
return true;
|
|
1108
1108
|
}
|
|
1109
1109
|
/**
|
|
@@ -1112,8 +1112,8 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
1112
1112
|
* @param {number} [minDecibels] default -100
|
|
1113
1113
|
* @param {number} [maxDecibels] default -30
|
|
1114
1114
|
* @returns {import('./analysis/audio_analysis.js').AudioAnalysisOutputType}
|
|
1115
|
-
*/ getFrequencies(analysisType =
|
|
1116
|
-
if (!this.processor) throw new Error(
|
|
1115
|
+
*/ getFrequencies(analysisType = "frequency", minDecibels = -100, maxDecibels = -30) {
|
|
1116
|
+
if (!this.processor) throw new Error("Session ended: please call .begin() first");
|
|
1117
1117
|
return (0, $5853841ab58516d4$export$2c3136da0bf130f9).getFrequencies(this.analyser, this.sampleRate, null, analysisType, minDecibels, maxDecibels);
|
|
1118
1118
|
}
|
|
1119
1119
|
/**
|
|
@@ -1121,11 +1121,11 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
1121
1121
|
* Keeps microphone stream open but halts storage of audio
|
|
1122
1122
|
* @returns {Promise<true>}
|
|
1123
1123
|
*/ async pause() {
|
|
1124
|
-
if (!this.processor) throw new Error(
|
|
1125
|
-
else if (!this.recording) throw new Error(
|
|
1124
|
+
if (!this.processor) throw new Error("Session ended: please call .begin() first");
|
|
1125
|
+
else if (!this.recording) throw new Error("Already paused: please call .record() first");
|
|
1126
1126
|
if (this._chunkProcessorBuffer.raw.byteLength) this._chunkProcessor(this._chunkProcessorBuffer);
|
|
1127
|
-
this.log(
|
|
1128
|
-
await this._event(
|
|
1127
|
+
this.log("Pausing ...");
|
|
1128
|
+
await this._event("stop");
|
|
1129
1129
|
this.recording = false;
|
|
1130
1130
|
return true;
|
|
1131
1131
|
}
|
|
@@ -1135,17 +1135,17 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
1135
1135
|
* @param {number} [chunkSize] chunkProcessor will not be triggered until this size threshold met in mono audio
|
|
1136
1136
|
* @returns {Promise<true>}
|
|
1137
1137
|
*/ async record(chunkProcessor = ()=>{}, chunkSize = 8192) {
|
|
1138
|
-
if (!this.processor) throw new Error(
|
|
1139
|
-
else if (this.recording) throw new Error(
|
|
1140
|
-
else if (typeof chunkProcessor !==
|
|
1138
|
+
if (!this.processor) throw new Error("Session ended: please call .begin() first");
|
|
1139
|
+
else if (this.recording) throw new Error("Already recording: please call .pause() first");
|
|
1140
|
+
else if (typeof chunkProcessor !== "function") throw new Error(`chunkProcessor must be a function`);
|
|
1141
1141
|
this._chunkProcessor = chunkProcessor;
|
|
1142
1142
|
this._chunkProcessorSize = chunkSize;
|
|
1143
1143
|
this._chunkProcessorBuffer = {
|
|
1144
1144
|
raw: new ArrayBuffer(0),
|
|
1145
1145
|
mono: new ArrayBuffer(0)
|
|
1146
1146
|
};
|
|
1147
|
-
this.log(
|
|
1148
|
-
await this._event(
|
|
1147
|
+
this.log("Recording ...");
|
|
1148
|
+
await this._event("start");
|
|
1149
1149
|
this.recording = true;
|
|
1150
1150
|
return true;
|
|
1151
1151
|
}
|
|
@@ -1153,17 +1153,17 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
1153
1153
|
* Clears the audio buffer, empties stored recording
|
|
1154
1154
|
* @returns {Promise<true>}
|
|
1155
1155
|
*/ async clear() {
|
|
1156
|
-
if (!this.processor) throw new Error(
|
|
1157
|
-
await this._event(
|
|
1156
|
+
if (!this.processor) throw new Error("Session ended: please call .begin() first");
|
|
1157
|
+
await this._event("clear");
|
|
1158
1158
|
return true;
|
|
1159
1159
|
}
|
|
1160
1160
|
/**
|
|
1161
1161
|
* Reads the current audio stream data
|
|
1162
1162
|
* @returns {Promise<{meanValues: Float32Array, channels: Array<Float32Array>}>}
|
|
1163
1163
|
*/ async read() {
|
|
1164
|
-
if (!this.processor) throw new Error(
|
|
1165
|
-
this.log(
|
|
1166
|
-
const result = await this._event(
|
|
1164
|
+
if (!this.processor) throw new Error("Session ended: please call .begin() first");
|
|
1165
|
+
this.log("Reading ...");
|
|
1166
|
+
const result = await this._event("read");
|
|
1167
1167
|
return result;
|
|
1168
1168
|
}
|
|
1169
1169
|
/**
|
|
@@ -1171,10 +1171,10 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
1171
1171
|
* @param {boolean} [force] Force saving while still recording
|
|
1172
1172
|
* @returns {Promise<import('./wav_packer.js').WavPackerAudioType>}
|
|
1173
1173
|
*/ async save(force = false) {
|
|
1174
|
-
if (!this.processor) throw new Error(
|
|
1175
|
-
if (!force && this.recording) throw new Error(
|
|
1176
|
-
this.log(
|
|
1177
|
-
const exportData = await this._event(
|
|
1174
|
+
if (!this.processor) throw new Error("Session ended: please call .begin() first");
|
|
1175
|
+
if (!force && this.recording) throw new Error("Currently recording: please call .pause() first, or call .save(true) to force");
|
|
1176
|
+
this.log("Exporting ...");
|
|
1177
|
+
const exportData = await this._event("export");
|
|
1178
1178
|
const packer = new (0, $a61750b8fbee4dae$export$13afda237b1c9846)();
|
|
1179
1179
|
const result = packer.pack(this.sampleRate, exportData.audio);
|
|
1180
1180
|
return result;
|
|
@@ -1183,15 +1183,15 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
1183
1183
|
* Ends the current recording session and saves the result
|
|
1184
1184
|
* @returns {Promise<import('./wav_packer.js').WavPackerAudioType>}
|
|
1185
1185
|
*/ async end() {
|
|
1186
|
-
if (!this.processor) throw new Error(
|
|
1186
|
+
if (!this.processor) throw new Error("Session ended: please call .begin() first");
|
|
1187
1187
|
const _processor = this.processor;
|
|
1188
|
-
this.log(
|
|
1189
|
-
await this._event(
|
|
1188
|
+
this.log("Stopping ...");
|
|
1189
|
+
await this._event("stop");
|
|
1190
1190
|
this.recording = false;
|
|
1191
1191
|
const tracks = this.stream.getTracks();
|
|
1192
1192
|
tracks.forEach((track)=>track.stop());
|
|
1193
|
-
this.log(
|
|
1194
|
-
const exportData = await this._event(
|
|
1193
|
+
this.log("Exporting ...");
|
|
1194
|
+
const exportData = await this._event("export", {}, _processor);
|
|
1195
1195
|
this.processor.disconnect();
|
|
1196
1196
|
this.source.disconnect();
|
|
1197
1197
|
this.node.disconnect();
|
|
@@ -1222,6 +1222,29 @@ globalThis.WavRecorder = $0d471c38435bdab6$export$439b217ca659a877;
|
|
|
1222
1222
|
|
|
1223
1223
|
|
|
1224
1224
|
|
|
1225
|
+
/**
|
|
1226
|
+
* Resamples audio data from one sample rate to another using linear interpolation
|
|
1227
|
+
* @param {ArrayBuffer} inputBuffer - Input audio data as Int16 PCM
|
|
1228
|
+
* @param {number} inputSampleRate - Sample rate of input audio
|
|
1229
|
+
* @param {number} outputSampleRate - Desired output sample rate
|
|
1230
|
+
* @returns {ArrayBuffer} - Resampled audio data as Int16 PCM
|
|
1231
|
+
*/ function $7cef7a69bdf8f84d$var$resampleAudioBuffer(inputBuffer, inputSampleRate, outputSampleRate) {
|
|
1232
|
+
if (inputSampleRate === outputSampleRate) return inputBuffer;
|
|
1233
|
+
const inputView = new Int16Array(inputBuffer);
|
|
1234
|
+
const ratio = inputSampleRate / outputSampleRate;
|
|
1235
|
+
const outputLength = Math.round(inputView.length / ratio);
|
|
1236
|
+
const outputBuffer = new ArrayBuffer(outputLength * 2);
|
|
1237
|
+
const outputView = new Int16Array(outputBuffer);
|
|
1238
|
+
for(let i = 0; i < outputLength; i++){
|
|
1239
|
+
const srcIndex = i * ratio;
|
|
1240
|
+
const srcIndexFloor = Math.floor(srcIndex);
|
|
1241
|
+
const srcIndexCeil = Math.min(srcIndexFloor + 1, inputView.length - 1);
|
|
1242
|
+
const t = srcIndex - srcIndexFloor;
|
|
1243
|
+
// Linear interpolation
|
|
1244
|
+
outputView[i] = Math.round(inputView[srcIndexFloor] * (1 - t) + inputView[srcIndexCeil] * t);
|
|
1245
|
+
}
|
|
1246
|
+
return outputBuffer;
|
|
1247
|
+
}
|
|
1225
1248
|
class $7cef7a69bdf8f84d$export$2934cf2d25c67a48 {
|
|
1226
1249
|
/**
|
|
1227
1250
|
* Create a new MediaStreamRecorder instance
|
|
@@ -1310,9 +1333,21 @@ class $7cef7a69bdf8f84d$export$2934cf2d25c67a48 {
|
|
|
1310
1333
|
this.stream = new MediaStream([
|
|
1311
1334
|
audioTrack
|
|
1312
1335
|
]);
|
|
1313
|
-
|
|
1336
|
+
// Firefox workaround: Firefox doesn't support connecting AudioNodes from
|
|
1337
|
+
// AudioContexts with different sample rates. So we create the AudioContext
|
|
1338
|
+
// at the native sample rate and resample manually.
|
|
1339
|
+
// This workaround may be temporary; Firefox is in the process of adding
|
|
1340
|
+
// support for this.
|
|
1341
|
+
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1674892
|
|
1342
|
+
const isFirefox = navigator.userAgent.toLowerCase().includes("firefox");
|
|
1343
|
+
let context;
|
|
1344
|
+
if (isFirefox) // Firefox: Use native sample rate and resample manually
|
|
1345
|
+
context = new AudioContext();
|
|
1346
|
+
else // Other browsers: Let the AudioContext handle resampling
|
|
1347
|
+
context = new AudioContext({
|
|
1314
1348
|
sampleRate: this.sampleRate
|
|
1315
1349
|
});
|
|
1350
|
+
const contextSampleRate = context.sampleRate;
|
|
1316
1351
|
const source = context.createMediaStreamSource(this.stream);
|
|
1317
1352
|
// Load and execute the module script.
|
|
1318
1353
|
try {
|
|
@@ -1326,11 +1361,17 @@ class $7cef7a69bdf8f84d$export$2934cf2d25c67a48 {
|
|
|
1326
1361
|
const { event: event, id: id, data: data } = e.data;
|
|
1327
1362
|
if (event === "receipt") this.eventReceipts[id] = data;
|
|
1328
1363
|
else if (event === "chunk") {
|
|
1364
|
+
// Resample chunk data from native sample rate to target sample rate
|
|
1365
|
+
// (no-op if rates match, i.e. for non-Firefox browsers)
|
|
1366
|
+
const resampledData = {
|
|
1367
|
+
raw: $7cef7a69bdf8f84d$var$resampleAudioBuffer(data.raw, contextSampleRate, this.sampleRate),
|
|
1368
|
+
mono: $7cef7a69bdf8f84d$var$resampleAudioBuffer(data.mono, contextSampleRate, this.sampleRate)
|
|
1369
|
+
};
|
|
1329
1370
|
if (this._chunkProcessorSize) {
|
|
1330
1371
|
const buffer = this._chunkProcessorBuffer;
|
|
1331
1372
|
this._chunkProcessorBuffer = {
|
|
1332
|
-
raw: (0, $a61750b8fbee4dae$export$13afda237b1c9846).mergeBuffers(buffer.raw,
|
|
1333
|
-
mono: (0, $a61750b8fbee4dae$export$13afda237b1c9846).mergeBuffers(buffer.mono,
|
|
1373
|
+
raw: (0, $a61750b8fbee4dae$export$13afda237b1c9846).mergeBuffers(buffer.raw, resampledData.raw),
|
|
1374
|
+
mono: (0, $a61750b8fbee4dae$export$13afda237b1c9846).mergeBuffers(buffer.mono, resampledData.mono)
|
|
1334
1375
|
};
|
|
1335
1376
|
if (this._chunkProcessorBuffer.mono.byteLength >= this._chunkProcessorSize) {
|
|
1336
1377
|
this._chunkProcessor(this._chunkProcessorBuffer);
|
|
@@ -1339,7 +1380,7 @@ class $7cef7a69bdf8f84d$export$2934cf2d25c67a48 {
|
|
|
1339
1380
|
mono: new ArrayBuffer(0)
|
|
1340
1381
|
};
|
|
1341
1382
|
}
|
|
1342
|
-
} else this._chunkProcessor(
|
|
1383
|
+
} else this._chunkProcessor(resampledData);
|
|
1343
1384
|
}
|
|
1344
1385
|
};
|
|
1345
1386
|
const node = source.connect(processor);
|
|
@@ -2471,26 +2512,64 @@ var $1c088932741d88e6$export$c95c65abc5f47125 = /** @class */ function(_super) {
|
|
|
2471
2512
|
};
|
|
2472
2513
|
DailyMediaManager.prototype.updateSpeaker = function(speakerId) {
|
|
2473
2514
|
return $1c088932741d88e6$var$__awaiter(this, void 0, Promise, function() {
|
|
2474
|
-
var sID, speakers, defaultSpeaker_1, defaultSpeakerCp;
|
|
2515
|
+
var dInfo, e_1, sID, speakers, defaultSpeaker_1, defaultSpeakerCp;
|
|
2475
2516
|
var _this = this;
|
|
2476
|
-
var _a, _b;
|
|
2477
|
-
return $1c088932741d88e6$var$__generator(this, function(
|
|
2478
|
-
switch(
|
|
2517
|
+
var _a, _b, _c, _d;
|
|
2518
|
+
return $1c088932741d88e6$var$__generator(this, function(_e) {
|
|
2519
|
+
switch(_e.label){
|
|
2479
2520
|
case 0:
|
|
2521
|
+
if (!!this._wavStreamPlayer) return [
|
|
2522
|
+
3 /*break*/ ,
|
|
2523
|
+
5
|
|
2524
|
+
];
|
|
2525
|
+
_e.label = 1;
|
|
2526
|
+
case 1:
|
|
2527
|
+
_e.trys.push([
|
|
2528
|
+
1,
|
|
2529
|
+
3,
|
|
2530
|
+
,
|
|
2531
|
+
4
|
|
2532
|
+
]);
|
|
2533
|
+
return [
|
|
2534
|
+
4 /*yield*/ ,
|
|
2535
|
+
this._daily.setOutputDeviceAsync({
|
|
2536
|
+
outputDeviceId: speakerId
|
|
2537
|
+
})
|
|
2538
|
+
];
|
|
2539
|
+
case 2:
|
|
2540
|
+
dInfo = _e.sent();
|
|
2541
|
+
this._selectedSpeaker = dInfo.speaker;
|
|
2542
|
+
(_b = (_a = this._callbacks).onSpeakerUpdated) === null || _b === void 0 || _b.call(_a, this._selectedSpeaker);
|
|
2543
|
+
return [
|
|
2544
|
+
3 /*break*/ ,
|
|
2545
|
+
4
|
|
2546
|
+
];
|
|
2547
|
+
case 3:
|
|
2548
|
+
e_1 = _e.sent();
|
|
2549
|
+
console.error("Error setting output device", e_1);
|
|
2550
|
+
return [
|
|
2551
|
+
3 /*break*/ ,
|
|
2552
|
+
4
|
|
2553
|
+
];
|
|
2554
|
+
case 4:
|
|
2555
|
+
return [
|
|
2556
|
+
2 /*return*/
|
|
2557
|
+
];
|
|
2558
|
+
case 5:
|
|
2480
2559
|
if (speakerId !== "default" && this._selectedSpeaker.deviceId === speakerId) return [
|
|
2481
2560
|
2 /*return*/
|
|
2482
2561
|
];
|
|
2483
2562
|
sID = speakerId;
|
|
2484
2563
|
if (!(sID === "default")) return [
|
|
2485
2564
|
3 /*break*/ ,
|
|
2486
|
-
|
|
2565
|
+
7
|
|
2487
2566
|
];
|
|
2488
2567
|
return [
|
|
2489
2568
|
4 /*yield*/ ,
|
|
2490
2569
|
this.getAllSpeakers()
|
|
2491
2570
|
];
|
|
2492
|
-
case
|
|
2493
|
-
speakers =
|
|
2571
|
+
case 6:
|
|
2572
|
+
speakers = _e.sent();
|
|
2494
2573
|
defaultSpeaker_1 = speakers.find(function(s) {
|
|
2495
2574
|
return s.deviceId === "default";
|
|
2496
2575
|
});
|
|
@@ -2504,10 +2583,10 @@ var $1c088932741d88e6$export$c95c65abc5f47125 = /** @class */ function(_super) {
|
|
|
2504
2583
|
defaultSpeakerCp = speakers.find(function(s) {
|
|
2505
2584
|
return defaultSpeaker_1.label.includes(s.label);
|
|
2506
2585
|
});
|
|
2507
|
-
sID = (
|
|
2508
|
-
|
|
2509
|
-
case
|
|
2510
|
-
(
|
|
2586
|
+
sID = (_c = defaultSpeakerCp === null || defaultSpeakerCp === void 0 ? void 0 : defaultSpeakerCp.deviceId) !== null && _c !== void 0 ? _c : speakerId;
|
|
2587
|
+
_e.label = 7;
|
|
2588
|
+
case 7:
|
|
2589
|
+
(_d = this._wavStreamPlayer) === null || _d === void 0 || _d.updateSpeaker(sID).then(function() {
|
|
2511
2590
|
var _a, _b;
|
|
2512
2591
|
_this._selectedSpeaker = {
|
|
2513
2592
|
deviceId: speakerId
|
|
@@ -2694,7 +2773,7 @@ var $1c088932741d88e6$export$c95c65abc5f47125 = /** @class */ function(_super) {
|
|
|
2694
2773
|
};
|
|
2695
2774
|
DailyMediaManager.prototype.handleTrackStarted = function(event) {
|
|
2696
2775
|
return $1c088932741d88e6$var$__awaiter(this, void 0, void 0, function() {
|
|
2697
|
-
var status, _a,
|
|
2776
|
+
var status, _a, e_2, e_3;
|
|
2698
2777
|
var _b, _c, _d, _e;
|
|
2699
2778
|
return $1c088932741d88e6$var$__generator(this, function(_f) {
|
|
2700
2779
|
switch(_f.label){
|
|
@@ -2758,7 +2837,7 @@ var $1c088932741d88e6$export$c95c65abc5f47125 = /** @class */ function(_super) {
|
|
|
2758
2837
|
4
|
|
2759
2838
|
];
|
|
2760
2839
|
case 3:
|
|
2761
|
-
|
|
2840
|
+
e_2 = _f.sent();
|
|
2762
2841
|
return [
|
|
2763
2842
|
3 /*break*/ ,
|
|
2764
2843
|
4
|
|
@@ -2805,7 +2884,7 @@ var $1c088932741d88e6$export$c95c65abc5f47125 = /** @class */ function(_super) {
|
|
|
2805
2884
|
11
|
|
2806
2885
|
];
|
|
2807
2886
|
case 10:
|
|
2808
|
-
|
|
2887
|
+
e_3 = _f.sent();
|
|
2809
2888
|
return [
|
|
2810
2889
|
3 /*break*/ ,
|
|
2811
2890
|
11
|
|
@@ -4097,6 +4176,7 @@ class $bee70417e8ead9ed$export$de21836fc42c6f9c extends (0, $fkNis$pipecataiclie
|
|
|
4097
4176
|
this._mediaManager.setUserAudioCallback(this.handleUserAudioStream.bind(this));
|
|
4098
4177
|
this._ws = null;
|
|
4099
4178
|
this._serializer = opts.serializer || new (0, $49316c2028553492$export$4b2026f8e11b148a)();
|
|
4179
|
+
this._maxMessageSize = 1048576; // python websockets default to 1MB
|
|
4100
4180
|
}
|
|
4101
4181
|
initialize(options, messageHandler) {
|
|
4102
4182
|
this._options = options;
|