> For a complete documentation index, fetch https://docs.voximplant.ai/llms.txt

# Scenario globals

## Functions

### base64\_decode

Decodes the data in the Base64 encoding

```ts
base64_decode(data: string): number[]
```

**Parameters**

**`data`** `string` — required

---

### base64\_encode

Encodes a string or array of integers from 0 to 255 to the Base64 encoding

```ts
base64_encode(data: string | number[]): string
```

**Parameters**

**`data`** `string | number[]` — required

---

### bytes2hex

Creates a hex string from given bytes array.

```ts
bytes2hex(data: number[], toUpperCase: boolean): string
```

**Parameters**

**`data`** `number[]` — required

---

**`toUpperCase`** `boolean` — required

---

### bytes2str

Creates a string from an array of numbers with specified encoding

```ts
bytes2str(data: number[], encoding: string): string
```

**Parameters**

**`data`** `number[]` — required

---

**`encoding`** `string` — required

---

### clearInterval

Cancels a timed, repeating action which is previously established by a call to setInterval().

```ts
clearInterval(intervalID: number): void
```

**Parameters**

**`intervalID`** `number` — required

---

### clearTimeout

Cancels a timeout previously established by calling setTimeout().

```ts
clearTimeout(timeoutID: number): void
```

**Parameters**

**`timeoutID`** `number` — required

---

### getLocalTime

Converts the date to the specified local timezone. Note that `new Date()` always returns time in the UTC+0 timezone.

```ts
getLocalTime(timezone: string, date: Date): Date
```

**Parameters**

**`timezone`** `string` — required

---

**`date`** `Date` — required

---

### hex2bytes

Creates an array of numbers from parsing a hex string

```ts
hex2bytes(data: string): number[]
```

**Parameters**

**`data`** `string` — required

---

### levenshtein\_distance

Count the number of deletions, insertions, or substitutions required to transform str1 into str2. The number shows a measure of the similarity between two strings. It is also known as edit distance.

```ts
levenshtein_distance(str1: string, str2: string): number
```

**Parameters**

**`str1`** `string` — required

---

**`str2`** `string` — required

---

### require

```ts
require(module: Modules): void
```

**Parameters**

**`module`** `Modules` — required

---

### setInterval

Repeatedly calls a function or executes a code snippet, with a fixed time delay between each call.

```ts
setInterval(callback: () => any, timeout?: number): number
```

**Parameters**

**`callback`** `() => any` — required

---

**`timeout`** `number`

---

### setTimeout

Sets a timer which executes a function or specified piece of code once after the timer expires.

```ts
setTimeout(callback: () => any, timeout?: number): number
```

**Parameters**

**`callback`** `() => any` — required

---

**`timeout`** `number`

---

### str2bytes

Creates an array of numbers from parsing string in specified codepage

```ts
str2bytes(data: string, encoding: string): number[]
```

**Parameters**

**`data`** `string` — required

---

**`encoding`** `string` — required

---

### trace

```ts
trace(data: string): void
```

**Parameters**

**`data`** `string` — required

---

### uuidgen

Generates unique identifier and returns it is string representation.

```ts
uuidgen(): string
```

## Type aliases

### PlaybackParameters

Avatar voice channel playback parameters. Can be passed via the `VoiceChannelParameters.playback` parameter.

```ts
type PlaybackParameters = TTSPlaybackParameters | URLPlaybackParameters | SequencePlaybackParameters
```

### RecorderLayoutPriority

An object that specifies video frame layout priority. Can be passed via the `CallRecordParameters.videoParameters` and `RecorderParameters.videoParameters` parameter.
Add the following line to your scenario code to use the type:

```
require(Modules.Recorder);
```

```ts
type RecorderLayoutPriority = 'vad' | string[]
```

### SequencePlaybackSegment

Sequence of the voice channel TTS and URL playback segments. Can be passed via the `SequencePlaybackParameters.segments` parameter.

```ts
type SequencePlaybackSegment = TTSPlaybackParameters | URLPlaybackParameters
```

### SequencePlayerSegment

Sequence player segment, represented by TTS or URL [Player](/api-reference/voxengine/player). Can be passed via the `SequencePlayerParameters.segments` parameter.

```ts
type SequencePlayerSegment = TTSPlayerSegment | URLPlayerSegment
```

### SmartQueue

Represents an instance of a Smart Queue. Queue identifier or queue name must be provided.

```ts
type SmartQueue = {
      /**
       * Queue's identification number.
       */
      id: number;

      /**
       * Queue's name.
       */
      name?: string;
    } | {
      /**
       * Queue's identification number.
       */
      id?: number;

      /**
       * Queue's name.
       */
      name: string;
    }
```

### VoxMediaUnit

```ts
type VoxMediaUnit = Call | Player | SequencePlayer | ASR | Conference | Recorder | WebSocket | StreamingAgent | Gemini.LiveAPIClient | OpenAI.Beta.RealtimeAPIClient | OpenAI.RealtimeAPIClient | ElevenLabs.AgentsClient | Ultravox.WebSocketAPIClient | Cartesia.AgentsClient | Deepgram.VoiceAgentClient | XAI.VoiceAgentAPIClient | Silero.VAD | Pipecat.TurnDetector | DeepFilterNet.NoiseSuppression | Hush.NoiseSuppression
```