@micdrop/server 2.10.0 → 2.11.0

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 CHANGED
@@ -73,28 +73,28 @@ a dictation tool needs. One given an agent and no voice answers in writing. See
73
73
  [dictation and text-only calls](https://micdrop.dev/docs/server/dictation).
74
74
 
75
75
  A `realtime` model hears the user and answers with its own voice, in place of
76
- all three. See [realtime models](https://micdrop.dev/docs/server/realtime).
76
+ all three. See [realtime models](https://micdrop.dev/docs/realtime).
77
77
 
78
78
  ### Available implementations
79
79
 
80
80
  Micdrop provides ready-to-use implementations for the following AI providers:
81
81
 
82
- - [@micdrop/openai](https://micdrop.dev/docs/ai-integration/provided-integrations/openai)
83
- - [@micdrop/gemini](https://micdrop.dev/docs/ai-integration/provided-integrations/gemini)
84
- - [@micdrop/ai-sdk](https://micdrop.dev/docs/ai-integration/provided-integrations/ai-sdk)
85
- - [@micdrop/elevenlabs](https://micdrop.dev/docs/ai-integration/provided-integrations/elevenlabs)
86
- - [@micdrop/cartesia](https://micdrop.dev/docs/ai-integration/provided-integrations/cartesia)
87
- - [@micdrop/mistral](https://micdrop.dev/docs/ai-integration/provided-integrations/mistral)
88
- - [@micdrop/gladia](https://micdrop.dev/docs/ai-integration/provided-integrations/gladia)
82
+ - [@micdrop/openai](https://micdrop.dev/docs/providers)
83
+ - [@micdrop/gemini](https://micdrop.dev/docs/providers)
84
+ - [@micdrop/ai-sdk](https://micdrop.dev/docs/agents/ai-sdk)
85
+ - [@micdrop/elevenlabs](https://micdrop.dev/docs/text-to-speech/elevenlabs)
86
+ - [@micdrop/cartesia](https://micdrop.dev/docs/text-to-speech/cartesia)
87
+ - [@micdrop/mistral](https://micdrop.dev/docs/providers)
88
+ - [@micdrop/gladia](https://micdrop.dev/docs/speech-to-text/gladia)
89
89
 
90
90
  ### Custom implementations
91
91
 
92
92
  You can use provided abstractions to write your own implementation:
93
93
 
94
- - **[Agent](https://micdrop.dev/docs/ai-integration/custom-integrations/custom-agent)** - Abstract class for answer generation
95
- - **[STT](https://micdrop.dev/docs/ai-integration/custom-integrations/custom-stt)** - Abstract class for speech-to-text
96
- - **[TTS](https://micdrop.dev/docs/ai-integration/custom-integrations/custom-tts)** - Abstract class for text-to-speech
97
- - **[Realtime](https://micdrop.dev/docs/server/realtime#writing-your-own)** - Abstract class for speech-to-speech models
94
+ - **[Agent](https://micdrop.dev/docs/agents/custom)** - Abstract class for answer generation
95
+ - **[STT](https://micdrop.dev/docs/speech-to-text/custom)** - Abstract class for speech-to-text
96
+ - **[TTS](https://micdrop.dev/docs/text-to-speech/custom)** - Abstract class for text-to-speech
97
+ - **[Realtime](https://micdrop.dev/docs/realtime#writing-your-own)** - Abstract class for speech-to-speech models
98
98
 
99
99
  ## Documentation
100
100
 
package/dist/index.d.mts CHANGED
@@ -21,8 +21,14 @@ declare enum MicdropServerCommands {
21
21
  SkipAnswer = "SkipAnswer",
22
22
  EndCall = "EndCall",
23
23
  ToolCall = "ToolCall",
24
- Classification = "Classification"
24
+ Classification = "Classification",
25
+ SampleRate = "SampleRate"
25
26
  }
27
+ /**
28
+ * Rate of the audio the client records, and of the assistant voice until the
29
+ * server announces another one with a `SampleRate` command.
30
+ */
31
+ declare const DEFAULT_SAMPLE_RATE = 16000;
26
32
  /**
27
33
  * Hears whether a sentence has landed, where voice activity detection only
28
34
  * hears whether someone is speaking.
@@ -125,7 +131,7 @@ interface AgentOptions {
125
131
  autoEndCall?: boolean | string;
126
132
  autoSemanticTurn?: boolean | string;
127
133
  autoIgnoreUserNoise?: boolean | string;
128
- extract?: ExtractJsonOptions | ExtractTagOptions;
134
+ extract?: ExtractOptions;
129
135
  onBeforeAnswer?: (this: Agent, stream: Writable) => void | boolean | string | Promise<void | boolean | string>;
130
136
  }
131
137
  interface AgentEvents {
@@ -137,17 +143,15 @@ interface AgentEvents {
137
143
  Failed: [];
138
144
  }
139
145
  interface ExtractOptions {
140
- callback?: (value: string) => void;
141
- saveInMetadata?: boolean;
142
- }
143
- interface ExtractJsonOptions extends ExtractOptions {
144
- json: true;
146
+ /** Called with the parsed value */
145
147
  callback?: (value: any) => void;
148
+ /** Keeps the parsed value in the metadata of the message, as `extracted` */
149
+ saveInMetadata?: boolean;
150
+ /** @deprecated JSON is the only format, this flag changes nothing */
151
+ json?: true;
146
152
  }
147
- interface ExtractTagOptions extends ExtractOptions {
148
- startTag: string;
149
- endTag: string;
150
- }
153
+ /** @deprecated Use `ExtractOptions` */
154
+ type ExtractJsonOptions = ExtractOptions;
151
155
  declare abstract class Agent<Options extends AgentOptions = AgentOptions, Events extends AgentEvents = AgentEvents> extends EventEmitter<Events> {
152
156
  protected options: Options;
153
157
  logger?: Logger;
@@ -202,7 +206,15 @@ declare abstract class Agent<Options extends AgentOptions = AgentOptions, Events
202
206
  };
203
207
  skipAnswer?: undefined;
204
208
  }>;
205
- protected getExtractOptions(): ExtractTagOptions | undefined;
209
+ /**
210
+ * Writes the answer to the stream as it is generated, leaving out the JSON
211
+ * value to extract: the voice stops at its first `{`.
212
+ *
213
+ * The value is cut from the message once the answer is complete, by
214
+ * `extract()`. Only the speech has to be cut while streaming.
215
+ */
216
+ protected answerWriter(stream: Writable): (text: string) => void;
217
+ /** Cuts the JSON value to extract from a complete answer, and parses it */
206
218
  extract(message: string): {
207
219
  message: string;
208
220
  metadata: MicdropAnswerMetadata | undefined;
@@ -318,6 +330,20 @@ declare function turnInput(conversation: MicdropConversation, history?: number):
318
330
  message: MicdropConversationMessage<MicdropAnswerMetadata>;
319
331
  };
320
332
 
333
+ /**
334
+ * Cuts a stream of PCM16 bytes on sample boundaries.
335
+ *
336
+ * A network or process chunk can end in the middle of a 16-bit sample, and the
337
+ * client reads each chunk as whole samples. The odd byte is held back and put
338
+ * in front of the next chunk, so every chunk returned holds whole samples.
339
+ */
340
+ declare class Pcm16Aligner {
341
+ private leftover?;
342
+ process(chunk: Buffer): Buffer;
343
+ /** Forgets the held byte, to start an independent stream */
344
+ reset(): void;
345
+ }
346
+
321
347
  /**
322
348
  * Streaming linear-interpolation resampler for PCM16 mono audio.
323
349
  *
@@ -326,9 +352,10 @@ declare function turnInput(conversation: MicdropConversation, history?: number):
326
352
  * keeps the fractional sample position continuous across chunks, so feeding a
327
353
  * stream chunk by chunk yields the same result as resampling it in one go.
328
354
  *
329
- * Providers use it to bridge their own rate with the 16kHz PCM16 the Micdrop
330
- * client records and plays: OpenaiSTT (16kHz -> 24kHz, the GA Realtime API
331
- * requires >= 24kHz), OpenaiTTS and KokoroTTS (24kHz output -> 16kHz).
355
+ * Providers use it to bridge the 16kHz PCM16 the Micdrop client records with
356
+ * the rate their API reads, like OpenaiSTT (16kHz -> 24kHz, the GA Realtime API
357
+ * requires >= 24kHz). Speech goes out at the rate it was produced, so text to
358
+ * speech has no use for it.
332
359
  */
333
360
  declare class Pcm16Resampler {
334
361
  private readonly step;
@@ -367,9 +394,50 @@ declare class MicdropError extends Error {
367
394
  }
368
395
  declare function handleError(socket: WebSocket, error: unknown): void;
369
396
 
397
+ /**
398
+ * Fetches a list from a provider once per key and account, then shares it with
399
+ * every caller of the process for a day. Calls asking at the same time share
400
+ * one request, and a failed one is not kept.
401
+ *
402
+ * @param key - What the list is, the provider first, then what changes it
403
+ * @param apiKey - The account, kept only as a hash
404
+ * @param load - Fetches the list
405
+ * @param refresh - Fetches it again, for an item added a moment ago
406
+ */
407
+ declare function cachedList<T>(key: unknown[], apiKey: string, load: () => Promise<T[]>, refresh?: boolean): Promise<T[]>;
408
+
409
+ /**
410
+ * A model an agent, a speech to text or a text to speech can run, as its
411
+ * `listModels()` describes it.
412
+ *
413
+ * Providers describe their models unevenly, so only `id` is always there. The
414
+ * rest is filled when the provider says it.
415
+ */
416
+ interface MicdropModel {
417
+ /** What the `model` option takes */
418
+ id: string;
419
+ name?: string;
420
+ description?: string;
421
+ /** Other names the provider answers to for the same model */
422
+ aliases?: string[];
423
+ /** Languages it speaks or transcribes, as codes such as `en` or `fr-FR` */
424
+ languages?: string[];
425
+ /** Can reason before answering, which delays its first word */
426
+ reasoning?: boolean;
427
+ /** The provider announced its end, `shutdownDate` says when if known */
428
+ deprecated?: boolean;
429
+ /** Day the provider stops serving it, as `YYYY-MM-DD` */
430
+ shutdownDate?: string;
431
+ }
432
+ /**
433
+ * Lists models once per provider, account and options, then shares the list
434
+ * with every caller of the process for a day. See `cachedList()`.
435
+ */
436
+ declare function cachedModels(key: unknown[], apiKey: string, load: () => Promise<MicdropModel[]>, refresh?: boolean): Promise<MicdropModel[]>;
437
+
370
438
  type RealtimeOptions = Pick<AgentOptions, 'systemPrompt' | 'autoEndCall' | 'autoSemanticTurn' | 'autoIgnoreUserNoise'>;
371
439
  interface RealtimeEvents extends AgentEvents {
372
- /** Voice of the assistant, in PCM16 at 16 kHz */
440
+ /** Voice of the assistant, in PCM16 mono at `sampleRate` */
373
441
  Audio: [Buffer];
374
442
  /** What the assistant has said so far in the answer it is giving */
375
443
  PartialMessage: [string];
@@ -455,7 +523,12 @@ declare abstract class Realtime<Options extends RealtimeOptions = RealtimeOption
455
523
  protected abstract injectMessage(role: 'user' | 'assistant' | 'system', text: string): void;
456
524
  /** Nobody is speaking, nor about to, so the connection can be renewed */
457
525
  protected get isIdle(): boolean;
458
- /** Voice of the answer, PCM16 at 16 kHz */
526
+ /**
527
+ * Rate of the audio emitted, in Hz, the one the model speaks at. The server
528
+ * passes it on to the client, which plays the audio as it comes.
529
+ */
530
+ get sampleRate(): number;
531
+ /** Voice of the answer, PCM16 at `sampleRate` */
459
532
  protected emitAudio(chunk: Buffer): void;
460
533
  /** Transcript of the answer, as it is spoken */
461
534
  protected addAnswerTranscript(text: string): void;
@@ -532,11 +605,20 @@ declare class FallbackSTT extends STT {
532
605
  }
533
606
 
534
607
  interface TTSEvents {
608
+ /** Voice of the answer, in PCM16 mono at `sampleRate` */
535
609
  Audio: [Buffer];
536
610
  Failed: [string[]];
537
611
  }
538
612
  declare abstract class TTS extends EventEmitter<TTSEvents> {
539
613
  logger?: Logger;
614
+ /**
615
+ * Rate of the audio emitted, in Hz.
616
+ *
617
+ * The server reads it with each chunk and tells the client when it changes,
618
+ * so the audio reaches the client at the rate the provider produced it. A
619
+ * provider that offers several rates takes the one chosen in its options.
620
+ */
621
+ get sampleRate(): number;
540
622
  abstract speak(textStream: Readable): void;
541
623
  abstract cancel(): void;
542
624
  protected log(...message: any[]): void;
@@ -552,6 +634,8 @@ declare class FallbackTTS extends TTS {
552
634
  private ttsIndex;
553
635
  private current?;
554
636
  constructor(options: FallbackTTSOptions);
637
+ /** Rate of the TTS in use, which changes when it falls back to the next */
638
+ get sampleRate(): number;
555
639
  speak(textStream: Readable): void;
556
640
  cancel(): void;
557
641
  destroy(): void;
@@ -566,12 +650,15 @@ declare class FallbackTTS extends TTS {
566
650
 
567
651
  /**
568
652
  * Plays the same recorded chunks for any answer, to run a call without a
569
- * voice provider. The files hold raw PCM 16 bits at 16 kHz.
653
+ * voice provider. The files hold raw PCM 16 bits, at 16 kHz unless another
654
+ * rate is given.
570
655
  */
571
656
  declare class MockTTS extends TTS {
572
657
  private audioFilePaths;
658
+ private readonly rate;
573
659
  private generation;
574
- constructor(audioFilePaths: string[]);
660
+ constructor(audioFilePaths: string[], rate?: number);
661
+ get sampleRate(): number;
575
662
  speak(textStream: Readable): void;
576
663
  cancel(): void;
577
664
  }
@@ -605,7 +692,7 @@ declare class SentenceSplitter {
605
692
  * be fed the agent's answer token by token. This class buffers the answer into
606
693
  * sentences, hands them over one at a time, and emits the audio in the order
607
694
  * they were written. Subclasses only have to turn one sentence into PCM16 at
608
- * the rate the Micdrop client expects.
695
+ * the rate they announce in `sampleRate`.
609
696
  *
610
697
  * Sentences are synthesized one after the other rather than at once: a local
611
698
  * model is single threaded, so racing two sentences through it slows both down
@@ -620,7 +707,7 @@ declare abstract class SentenceTTS extends TTS {
620
707
  private counter;
621
708
  private synthesizing;
622
709
  /**
623
- * Turns one sentence into PCM16 audio at the client's sample rate.
710
+ * Turns one sentence into PCM16 audio at `sampleRate`.
624
711
  *
625
712
  * The signal is aborted when the utterance is cancelled, which is the moment
626
713
  * to stop a subprocess or an inference that is no longer needed. Returning
@@ -643,12 +730,51 @@ declare abstract class SentenceTTS extends TTS {
643
730
  private drain;
644
731
  }
645
732
 
733
+ /**
734
+ * A voice a text to speech can speak with, as its `listVoices()` describes it.
735
+ *
736
+ * Providers describe their voices unevenly, so only `id` and `name` are always
737
+ * there. The rest is filled when the provider says it.
738
+ */
739
+ interface MicdropVoice {
740
+ /** What the `voice` option of the text to speech takes */
741
+ id: string;
742
+ name: string;
743
+ /**
744
+ * Languages the voice speaks, as codes such as `en` or `fr-FR`. Absent when
745
+ * the provider does not say, or when the voice reads every language of its
746
+ * model, as the OpenAI and Gemini voices do.
747
+ */
748
+ languages?: string[];
749
+ gender?: 'female' | 'male' | 'neutral';
750
+ description?: string;
751
+ /** Address of a short sample of the voice */
752
+ previewUrl?: string;
753
+ /** Created in the account, cloned or designed, rather than offered to all */
754
+ custom?: boolean;
755
+ }
756
+ /** Turns the gender words providers use into the three values above */
757
+ declare function voiceGender(value: string | null | undefined): MicdropVoice['gender'];
758
+ /**
759
+ * Lists voices once per provider, account and options, then shares the list
760
+ * with every caller of the process for a day. See `cachedList()`.
761
+ */
762
+ declare function cachedVoices(key: unknown[], apiKey: string, load: () => Promise<MicdropVoice[]>, refresh?: boolean): Promise<MicdropVoice[]>;
763
+ /**
764
+ * The voices that speak a language, `fr` or `fr-FR` alike: a voice of any
765
+ * French locale counts. A voice declaring no language reads them all, so it
766
+ * stays in the list.
767
+ */
768
+ declare function voicesForLanguage(voices: MicdropVoice[], language: string | undefined): MicdropVoice[];
769
+
646
770
  interface MicdropServerEvents {
647
771
  End: [MicdropCallSummary];
648
772
  /** A message was added to the conversation, by the agent or by the server */
649
773
  Message: [MicdropConversationItem];
774
+ /** Audio of the user, in PCM16 mono at 16 kHz */
650
775
  UserAudio: [Buffer];
651
- AssistantAudio: [Buffer];
776
+ /** Voice of the assistant, in PCM16 mono at the rate given with it, in Hz */
777
+ AssistantAudio: [Buffer, number];
652
778
  }
653
779
  interface MicdropConfig {
654
780
  /**
@@ -763,6 +889,7 @@ declare class MicdropServer extends EventEmitter<MicdropServerEvents> {
763
889
  private lastMessageSpeeched?;
764
890
  private cancelRound;
765
891
  private assistantMessages;
892
+ private assistantSampleRate;
766
893
  private ownConversation;
767
894
  private operationQueue;
768
895
  private isProcessingQueue;
@@ -833,7 +960,10 @@ declare class MicdropServer extends EventEmitter<MicdropServerEvents> {
833
960
  }
834
961
 
835
962
  interface AudioMessage {
963
+ /** PCM16 mono audio, at `sampleRate` */
836
964
  buffer: Buffer;
965
+ /** Rate of `buffer`, in Hz: 16 kHz for the user, the voice's for the assistant */
966
+ sampleRate: number;
837
967
  messageIndex: number;
838
968
  message: string;
839
969
  role: 'user' | 'assistant';
@@ -848,12 +978,16 @@ declare class MicdropRecorder extends EventEmitter<MicdropRecorderEvents> {
848
978
  private audioMessages;
849
979
  private currentUserChunks;
850
980
  private currentAssistantChunks;
981
+ private currentAssistantRate;
982
+ private assistantResampler?;
851
983
  private lastUserMessageIndex;
852
984
  private lastAssistantMessageIndex;
853
985
  constructor(server: MicdropServer);
854
986
  private setupListeners;
855
987
  private onUserAudio;
856
988
  private onAssistantAudio;
989
+ /** A message holds one rate, the one its first chunk came at */
990
+ private toAssistantRate;
857
991
  private onMessage;
858
992
  private finalizeUserAudio;
859
993
  private finalizeAssistantAudio;
@@ -874,7 +1008,8 @@ declare class MicdropRecorder extends EventEmitter<MicdropRecorderEvents> {
874
1008
  *
875
1009
  * Instances are keyed by the options they were built from, so changing a model
876
1010
  * or a device loads that one and leaves the others alone. They stay loaded for
877
- * the lifetime of the process.
1011
+ * the lifetime of the process, or for `ttl` milliseconds when it is set, which
1012
+ * suits a list fetched from an API that changes now and then.
878
1013
  *
879
1014
  * ```typescript
880
1015
  * const synthesizers = new SharedInstances<Synthesizer>()
@@ -886,8 +1021,15 @@ declare class MicdropRecorder extends EventEmitter<MicdropRecorderEvents> {
886
1021
  * }
887
1022
  * ```
888
1023
  */
1024
+ interface SharedInstancesOptions {
1025
+ /** How long an instance is kept once loaded, in ms. Forever by default. */
1026
+ ttl?: number;
1027
+ }
889
1028
  declare class SharedInstances<T> {
1029
+ private readonly options;
890
1030
  private entries;
1031
+ private expiries;
1032
+ constructor(options?: SharedInstancesOptions);
891
1033
  /**
892
1034
  * Returns the instance for this key, calling `create` the first time.
893
1035
  *
@@ -896,6 +1038,8 @@ declare class SharedInstances<T> {
896
1038
  * instead of loading the model twice.
897
1039
  */
898
1040
  load(key: unknown, create: () => Promise<T>): Promise<T>;
1041
+ /** Forgets an instance whose time is up */
1042
+ private expire;
899
1043
  /** The instance for this key, loaded or being loaded, without loading it. */
900
1044
  get(key: unknown): Promise<T> | undefined;
901
1045
  /** Whether an instance is loaded, or being loaded, for this key. */
@@ -1054,4 +1198,4 @@ declare class ReconnectingSocket extends EventEmitter<ReconnectingSocketEvents>
1054
1198
 
1055
1199
  declare function waitForParams<CallParams>(socket: WebSocket$1, validate: (params: any) => CallParams): Promise<CallParams>;
1056
1200
 
1057
- export { AUTO_END_CALL_PROMPT, AUTO_END_CALL_TOOL_NAME, AUTO_IGNORE_USER_NOISE_PROMPT, AUTO_IGNORE_USER_NOISE_TOOL_NAME, AUTO_SEMANTIC_TURN_PROMPT, AUTO_SEMANTIC_TURN_TOOL_NAME, Agent, type AgentEvents, type AgentOptions, type AudioMessage, Classifier, type ClassifierEvents, type ClassifierInput, type DeepPartial, type ExtractJsonOptions, type ExtractOptions, type ExtractTagOptions, FallbackAgent, type FallbackAgentOptions, FallbackSTT, type FallbackSTTOptions, FallbackTTS, type FallbackTTSOptions, Logger, type MicdropAnswerMetadata, type MicdropCallSummary, type MicdropClassification, type MicdropClassifierOptions, MicdropClientCommands, type MicdropConfig, type MicdropConversation, type MicdropConversationItem, type MicdropConversationMessage, type MicdropConversationToolCall, type MicdropConversationToolResult, MicdropError, MicdropErrorCode, MicdropRecorder, type MicdropRecorderEvents, MicdropServer, MicdropServerCommands, type MicdropServerEvents, type MicdropToolCall, type MicdropTurnInput, MockAgent, MockSTT, MockTTS, Pcm16Resampler, Realtime, type RealtimeEvents, type RealtimeOptions, ReconnectingSocket, type ReconnectingSocketEvents, type ReconnectingSocketHandshake, type ReconnectingSocketOptions, type ReconnectingSocketStatus, STT, type STTEvents, SentenceSplitter, SentenceTTS, SharedInstances, TTS, type TTSEvents, type Tool, type TurnDetector, currentTurn, float32ToPcm16, getTurnClassification, handleError, pcm16ToFloat32, turnInput, waitForParams };
1201
+ export { AUTO_END_CALL_PROMPT, AUTO_END_CALL_TOOL_NAME, AUTO_IGNORE_USER_NOISE_PROMPT, AUTO_IGNORE_USER_NOISE_TOOL_NAME, AUTO_SEMANTIC_TURN_PROMPT, AUTO_SEMANTIC_TURN_TOOL_NAME, Agent, type AgentEvents, type AgentOptions, type AudioMessage, Classifier, type ClassifierEvents, type ClassifierInput, DEFAULT_SAMPLE_RATE, type DeepPartial, type ExtractJsonOptions, type ExtractOptions, FallbackAgent, type FallbackAgentOptions, FallbackSTT, type FallbackSTTOptions, FallbackTTS, type FallbackTTSOptions, Logger, type MicdropAnswerMetadata, type MicdropCallSummary, type MicdropClassification, type MicdropClassifierOptions, MicdropClientCommands, type MicdropConfig, type MicdropConversation, type MicdropConversationItem, type MicdropConversationMessage, type MicdropConversationToolCall, type MicdropConversationToolResult, MicdropError, MicdropErrorCode, type MicdropModel, MicdropRecorder, type MicdropRecorderEvents, MicdropServer, MicdropServerCommands, type MicdropServerEvents, type MicdropToolCall, type MicdropTurnInput, type MicdropVoice, MockAgent, MockSTT, MockTTS, Pcm16Aligner, Pcm16Resampler, Realtime, type RealtimeEvents, type RealtimeOptions, ReconnectingSocket, type ReconnectingSocketEvents, type ReconnectingSocketHandshake, type ReconnectingSocketOptions, type ReconnectingSocketStatus, STT, type STTEvents, SentenceSplitter, SentenceTTS, SharedInstances, type SharedInstancesOptions, TTS, type TTSEvents, type Tool, type TurnDetector, cachedList, cachedModels, cachedVoices, currentTurn, float32ToPcm16, getTurnClassification, handleError, pcm16ToFloat32, turnInput, voiceGender, voicesForLanguage, waitForParams };