Audio documents
Most documents hold textual knowledge that is split into chunks and retrieved to ground the agent's responses. An audio document is different: it stores one or more pre-recorded audio files for playback during a call, and is not split into chunks or used for retrieval.
Audio documents are referenced by name and used to:
- play fixed prompts from a Flow's
Sayconversation node, via the#play_fileand#play_digitsdirectives – see Playing pre-recorded audio. - replace specific LLM-generated phrases of an Agent with a recording, via the
prerecorded_audioadvanced configuration parameter – see Play prerecorded audio files instead of specific LLM responses.
Playing a recording instead of synthesizing speech reduces TTS usage and cost, and avoids mispronunciation of known, fixed phrases.
Preparing the audio files
- Use the
wav/lpcm16format where possible. Other formats supported by the Voice.AI ConnectplayUrlAPI are also accepted – see theplay_urlpre-defined tool for the full list. - Each file's extension must be
.wavor.pcm. -
For example, to convert a file to the recommended format with
ffmpeg:ffmpeg -i input_file.ext -acodec pcm_s16le output.wav
Uploading the files as a document
- In the Navigation pane, expand AI Agents, and then click Documents.
- Click Add new document.
- In the Name field, enter a unique name (up to 32 characters; letters, digits, or underscores only). This is the name you reference when playing the audio.
- Select Upload File, then click Upload file. In the file picker, change the file-type selector to All files so that
.wav/.pcmfiles become selectable, and choose the audio files you prepared (and, optionally, their transcript files). - Click Create.
How files within a document are selected
- If a document contains multiple audio files, a random file is played each time the document is referenced without a specific file name. This is useful when you have several variants of the same phrase – for example, different recordings of a welcome message.
- To address a specific recording, reference it by file name – for example
#play_file <document> welcome.wav. The.wav/.pcmextension may be omitted; the matching file is resolved automatically. - For
#play_digits, the document must contain one file per digit, named0.wav…9.wav(or.pcm). - If you need different recordings for different phrases, create a separate document for each.
Transcript files
Alongside the recordings, you can upload a transcript of each audio file – the text that the recording speaks. When the file is played – from a Flow Say node's audio playback or an agent's prerecorded_audio playback – its transcript appears in the conversation log alongside the played audio, so you can see what each recording said.
- A transcript file must share the same base name as its audio file, with a
.txtor.jsonextension – for examplewelcome.txt(orwelcome.json) forwelcome.wav, or0.txtfor0.wav. - Each audio file may have at most one transcript – either
.txtor.json, not both. - A transcript must correspond to an audio file in the same document; a transcript with no matching recording is rejected.
- Removing an audio file also removes its matching transcript file.
- Transcript files are not played and are not split into chunks; they only supply the log text for the played recording.
Two formats are supported:
.txt– the file content is the transcript text.-
.json– a list of word entries, each with awordfield; thewordvalues are joined with spaces to form the transcript. This matches the word-level output of the AC DNN speech-to-text engine, for example:[ { "word": "your", "confidence": 0.999, "duration": 39, "location": 9 }, { "word": "reference", "confidence": 0.998, "duration": 51, "location": 48 }, { "word": "number", "confidence": 0.997, "duration": 46, "location": 99 } ]
Upload the transcript files together with the recordings (in the file picker, use the All files type so that .txt / .json files are selectable). The info pane's View action shows a transcript file's actual content.
Audio documents are not split into chunks and must not be added to the Documents tab of an Agent or Flow. Reference them only by name – in a flow #play_* directive or in the prerecorded_audio parameter.