Utility for converting text to speech using Deepgram API.
// Source: https://github.com/activepieces/activepieces | License: MIT | Copyright 2020-2024 Activepieces Inc
// Provided via justclaw.it.com; keep this notice with the code.
import { HttpMethod } from '@activepieces/pieces-common';
import { DEEPGRAM_TIMEOUTS, deepgramClient } from './client';
import { MAX_TTS_CHARACTERS } from './constants';
const WAV_ENCODINGS = ['linear16', 'mulaw', 'alaw'];
const EXTENSIONS: Record<string, string> = {
mp3: 'mp3',
opus: 'ogg',
flac: 'flac',
aac: 'aac',
};
function checkText(text: unknown): string {
const value = typeof text === 'string' ? text : '';
if (value.trim().length === 0) {
throw new Error('Enter the text to convert to speech.');
}
if (value.length > MAX_TTS_CHARACTERS) {
throw new Error(
`Deepgram converts at mo
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key