### PlayAI TTS Getting Started
Source: https://docs.play.ai/documentation/text-to-speech/introduction
Guides users on how to begin using the PlayAI Text-to-Speech service, directing them to a quick start guide for immediate implementation and a tutorial for creating AI podcasts using dialogs.
```jsx
import { Heading } from "@playai/ui";
Getting Started
- Quick Start: Follow our TTS Quickstart guide
- Create an AI Podcast: Explore dialog creation
```
--------------------------------
### PlayNote Getting Started
Source: https://docs.play.ai/documentation/playnote/introduction
Provides guidance on how to get started with PlayNote, directing users to a quick start tutorial and the API reference documentation.
```markdown
## Getting Started
1. **Quick Start**: Follow our [PlayNote tutorial](/documentation/playnote/playnote-quickstart)
2. **API Reference**: Explore our [PlayNote APIs](/api-reference/playnote)
```
--------------------------------
### Quickstart: PlayAI Showcase TTS Websocket Demo
Source: https://docs.play.ai/api-reference/text-to-speech/websocket
Guides users through cloning the play-showcase repository, navigating to the tts-websocket demo, installing dependencies, and running the application locally to get started quickly.
```bash
git clone https://github.com/playht/playai-showcase.git
cd tts-websocket
npm install
npm start
```
--------------------------------
### Setup PlayAI WebSocket Demo
Source: https://github.com/playht/playai-showcase/tree/main/tts-websocket
This snippet outlines the essential steps to set up and run the PlayAI WebSocket Demo. It covers cloning the repository, navigating to the specific demo directory, installing Node.js dependencies using npm, and starting the application server.
```shell
# Clone this repository
git clone https://github.com/playht/playai-showcase.git
# Navigate to the tts-websocket demo app
cd tts-websocket
# NPM install
npm install
# Run the server and follow the instructions
npm start
```
--------------------------------
### Getting Started and Resources Links
Source: https://docs.play.ai/documentation/playnote/introduction
This snippet highlights navigation elements within the documentation, specifically linking to a quick start tutorial and the API reference. It also points to essential resources like rate limits, error messages, and a troubleshooting guide.
```markdown
## Getting Started
1. **Quick Start**: Follow our [PlayNote tutorial](/documentation/playnote/playnote-quickstart)
2. **API Reference**: Explore our [PlayNote APIs](/api-reference/playnote)
## Best Practices
1. **Content Preparation**
* Structure your content clearly
* Use appropriate formatting
* Include clear section breaks
2. **Voice Selection**
* Choose voices that match your content
* Consider using different voices for different speakers
* Test voice combinations
3. **Output Quality**
* Monitor audio quality
* Check for proper pacing
* Verify content accuracy
## Resources
* [Rate Limits](/documentation/resources/rate-limits)
* [Error Messages](/documentation/resources/error-messages)
* [Troubleshooting Guide](/documentation/resources/troubleshooting)
```
--------------------------------
### Quickstart: Clone and Run Play AI Showcase
Source: https://docs.play.ai/api-reference/text-to-speech/websocket
Clone the playai-showcase repository and navigate to the tts-websocket demo app. Install dependencies and start the server to get started quickly.
```shellscript
# Clone this repository
git clone https://github.com/playht/playai-showcase.git
# Navigate to the tts-websocket demo app
cd tts-websocket
# NPM install
npm install
# Run the server and follow the instructions
npm start
```
--------------------------------
### Example Setup Messages
Source: https://context7_llms
Demonstrates various configurations for audio input and output formats and sample rates in setup messages.
```json
// mulaw 16KHz as input
{ "type": "setup", "apiKey": "...", "inputEncoding": "mulaw", "inputSampleRate": 16000 }
// 24Khz mp3 output
{ "type": "setup", "apiKey": "...", "outputFormat": "mp3", "outputSampleRate": 24000 }
// mulaw 8KHz in and out
{ "type": "setup", "apiKey": "...", "inputEncoding": "mulaw", "inputSampleRate": 8000, "outputFormat": "mulaw", "outputSampleRate": 8000 }
```
--------------------------------
### Example Setup Messages
Source: https://docs.play.ai/llms-full.txt
Demonstrates various configurations for audio input and output formats and sample rates in setup messages.
```json
// mulaw 16KHz as input
{ "type": "setup", "apiKey": "...", "inputEncoding": "mulaw", "inputSampleRate": 16000 }
// 24Khz mp3 output
{ "type": "setup", "apiKey": "...", "outputFormat": "mp3", "outputSampleRate": 24000 }
// mulaw 8KHz in and out
{ "type": "setup", "apiKey": "...", "inputEncoding": "mulaw", "inputSampleRate": 8000, "outputFormat": "mulaw", "outputSampleRate": 8000 }
```
--------------------------------
### Go Basic Structure and Imports
Source: https://docs.play.ai/documentation/text-to-speech/tts-quickstart
This snippet showcases a typical Go program structure, starting with the package declaration and followed by importing necessary standard libraries like bytes, encoding/json, fmt, io, net/http, and os. It's a foundational example for Go development.
```go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
)
```
--------------------------------
### PlayAI Text-to-Speech Quickstart Example
Source: https://docs.play.ai/documentation/text-to-speech/tts-quickstart
This snippet demonstrates the basic structure for a PlayAI Text-to-Speech quickstart page. It includes metadata for SEO and page structure, along with placeholder content for the main body.
```javascript
function MDXContent(props = {}) {
const {wrapper: MDXLayout} = {
..._provideComponents(),
...props.components
};
return MDXLayout ? _jsx(MDXLayout, {
...props,
children: _jsx(_createMdxContent, {
...props
})
}) : _createMdxContent(props);
}
return {
default: MDXContent
};
function _createMdxContent(props) {
const _components = {
p: "p",
..._provideComponents(),
...props.components
};
return _jsx(_components.p, {
children: "Get started with PlayAI Text-to-Speech in minutes"
});
}
```
--------------------------------
### PlayNote Quickstart: Generate Conversation from PDF
Source: https://docs.play.ai/documentation/agent/agent-quickstart
A quickstart guide to transform PDF documents into engaging multi-speaker conversations using PlayNote. Follow these steps to quickly generate your first AI-powered podcast from a PDF.
```markdown
## Quickstart: Generate Conversation from PDF
1. Upload your PDF document to the PlayNote platform.
2. Select desired voice profiles and conversation styles.
3. Generate the podcast and download the audio file.
```
--------------------------------
### Text-to-Speech (TTS) API Quickstart
Source: https://docs.play.ai/documentation/tutorials/agent/web-embed-tutorial
Learn how to use PlayAI's Text-to-Speech API for natural conversations. This guide covers basic usage and setup.
```markdown
## TTS API Quickstart
1. **Get API Key:** Obtain your API key from the PlayAI developer console.
2. **Make a request:** Use the `/api/v1/tts/stream` endpoint to convert text to speech.
3. **Specify parameters:** Include `text`, `voice`, and `language` in your request.
4. **Receive audio:** The API will return audio bytes for playback.
```
--------------------------------
### Example Setup Messages with Various Options
Source: https://docs.play.ai/api-reference/agents/websocket
Provides examples of JSON messages used for session setup. These messages configure audio input formats (like mulaw 16KHz) and specify API keys, demonstrating different configuration possibilities.
```json
// mulaw 16KHz as input
{
"type": "setup",
"apiKey": "...",
"audio": {
"input": {
"encoding": "mulaw",
"sampleRate": 16000
}
}
}
```
```json
// linear 16KHz as input
{
"type": "setup",
"apiKey": "...",
"audio": {
"input": {
"encoding": "linear16",
"sampleRate": 16000
}
}
}
```
```json
// mulaw 8KHz as input
{
"type": "setup",
"apiKey": "...",
"audio": {
"input": {
"encoding": "mulaw",
"sampleRate": 8000
}
}
}
```
--------------------------------
### PlayAI TTS Websocket Demo Setup
Source: https://context7_llms
Instructions for setting up and running the TTS WebSocket demo application locally by cloning the playai-showcase repository and installing dependencies.
```shell
# Clone this repository
git clone https://github.com/playht/playai-showcase.git
# Navigate to the tts-websocket demo app
cd tts-websocket
# NPM install
npm install
# Run the server and follow the instructions
npm start
```
--------------------------------
### PlayAI TTS Websocket Demo Setup
Source: https://docs.play.ai/llms-full.txt
Instructions for setting up and running the TTS WebSocket demo application locally by cloning the playai-showcase repository and installing dependencies.
```shell
# Clone this repository
git clone https://github.com/playht/playai-showcase.git
# Navigate to the tts-websocket demo app
cd tts-websocket
# NPM install
npm install
# Run the server and follow the instructions
npm start
```
--------------------------------
### Set Up PlayAI Environment Variables
Source: https://docs.play.ai/documentation/text-to-speech/tts-quickstart
Configure your environment by setting PlayAI API key and User ID as environment variables. This ensures secure credential management for API requests. The example shows setup for macOS/Linux (zsh).
```bash
echo 'export PLAYAI_KEY="your_api_key_here"' >> ~/.zshrc
echo 'export PLAYAI_USER_ID="your_user_id_here"' >> ~/.zshrc
source ~/.zshrc
```
--------------------------------
### MCP Server Path Example
Source: https://docs.play.ai/documentation/resources/mcp
Illustrates the typical file path for the MCP server installation, highlighting the need to replace '[username]' with your actual system username.
```text
/Users/[username]/.mcp/playhtinc/src/index.js
```
--------------------------------
### TTS API Quickstart
Source: https://docs.play.ai/documentation/agent/agent-quickstart
Learn how to use PlayAI's Text-to-Speech (TTS) API for natural conversations. This guide covers the basic steps to convert text into speech using our high-quality models.
```markdown
## TTS API Quickstart
This guide demonstrates how to make your first TTS API call to generate natural-sounding speech from text.
```
--------------------------------
### JavaScript TTS Quickstart Example
Source: https://docs.play.ai/api-reference/text-to-speech/endpoints/v1/list-voices
A basic JavaScript snippet demonstrating how to use the Text-to-Speech API for quick integration. This example likely involves making an API call to synthesize speech.
```JavaScript
"use strict";
```
--------------------------------
### PlayNote Quickstart: Generate Conversation from PDF
Source: https://docs.play.ai/documentation/agent-sdks/flutter-sdk
A quickstart guide to transform PDF documents into engaging multi-speaker conversations using PlayNote. Follow these steps to quickly generate your first AI-powered podcast from a PDF.
```markdown
## Quickstart: Generate Conversation from PDF
1. Upload your PDF document to the PlayNote platform.
2. Select desired voice profiles and conversation styles.
3. Generate the podcast and download the audio file.
```
--------------------------------
### Clone and Run Play AI Showcase Demo
Source: https://docs.play.ai/api-reference/text-to-speech/websocket
Instructions to clone the playai-showcase repository, navigate to the tts-websocket demo app, install dependencies, and run the application locally. This is a quickstart guide for users wanting to get started quickly.
```shellscript
# Clone this repository
git clone https://github.com/playht/playai-showcase.git
# Navigate to the tts-websocket demo app
cd tts-websocket
# NPM install
npm install
# Run the server and follow the instructions
npm start
```
--------------------------------
### PlayNote Quickstart: PDF to Conversation
Source: https://docs.play.ai/documentation/tutorials/agent/web-embed-examples
Learn how to transform PDF documents into engaging multi-speaker conversations using PlayNote. This quickstart guide covers the essential steps to get started.
```APIDOC
PlayNote PDF to Conversation Quickstart:
1. **Upload PDF**: Use the PlayNote API or UI to upload your PDF document.
- Endpoint: `POST /api/v1/playnote/upload-pdf`
- Request Body: `{\"file\": \"base64_encoded_pdf_content\", \"fileName\": \"document.pdf\"}`
- Returns: `{\"documentId\": \"unique_doc_id\"}`
2. **Generate Conversation**: Initiate the conversation generation process.
- Endpoint: `POST /api/v1/playnote/generate-conversation`
- Request Body: `{\"documentId\": \"unique_doc_id\", \"speakers\": 2, \"language\": \"en-US\"}`
- Returns: `{\"conversationId\": \"unique_conv_id\", \"status\": \"processing\"}`
3. **Retrieve Conversation**: Fetch the generated conversation once processing is complete.
- Endpoint: `GET /api/v1/playnote/conversation/{conversationId}`
- Returns: `{\"conversationId\": \"unique_conv_id\", \"status\": \"completed\", \"audioUrl\": \"http://example.com/audio.mp3\", \"transcript\": [...]}`
**Dependencies**: Requires a valid PlayAI API key.
**Limitations**: Maximum PDF file size and page count may apply.
```
--------------------------------
### Agent Flutter SDK Integration
Source: https://docs.play.ai/documentation/agent/agent-quickstart
Integrate AI agents into your Flutter applications using the PlayAI Flutter SDK. This guide helps you get started with AI-powered features in your mobile apps.
```dart
// Example usage for Agent Flutter SDK
// import 'package:playai_flutter_sdk/playai_flutter_sdk.dart';
// final agentClient = AgentClient(apiKey: 'YOUR_API_KEY');
// agentClient.initialize();
```
--------------------------------
### PlayAI Documentation Navigation Links
Source: https://docs.play.ai/documentation/tutorials/agent/web-embed-tutorial
Links to key sections within the PlayAI documentation, including getting started guides, use cases, and specific feature details.
```APIDOC
Documentation Navigation:
Playground:
- Link: https://play.ai/api/sandbox
- Description: Interactive environment to test PlayAI APIs.
API Keys:
- Link: https://play.ai/api/keys
- Description: Manage your PlayAI API credentials.
Get Started:
- Introduction: Comprehensive overview of the PlayAI platform.
- Use Cases: Explore real-world applications of PlayAI products.
Text-to-Speech:
- Introduction: Turn text into lifelike speech with PlayAI's API.
- Quickstart: Get started with Text-to-Speech in minutes.
- Models: Browse available state-of-the-art TTS models.
- Voices: Information on using pre-built voices and creating custom ones.
- Voice Cloning: Guide to creating custom voices from audio samples.
Agent:
- Introduction: Deploy voice-powered agents to web, apps, and telephony.
- Quickstart: Build your first AI voice agent.
- Knowledge Base: Give agents access to your documents and websites.
- Actions and Integrations: Empower agents to perform actions.
- Web Embed: Embed a PlayAI Agent on your website.
```
--------------------------------
### Agent Flutter SDK Integration
Source: https://docs.play.ai/documentation/agent-sdks/flutter-sdk
Integrate AI agents into your Flutter applications using the PlayAI Flutter SDK. This guide helps you get started with AI-powered features in your mobile apps.
```dart
// Example usage for Agent Flutter SDK
// import 'package:playai_flutter_sdk/playai_flutter_sdk.dart';
// final agentClient = AgentClient(apiKey: 'YOUR_API_KEY');
// agentClient.initialize();
```
--------------------------------
### PlayAI Documentation Configuration
Source: https://docs.play.ai/documentation/agent/agent-quickstart
Configuration object for the Mintlify documentation site, defining theme, colors, logo, favicon, API settings, navbar links, and navigation structure for different sections like Get Started, Text-to-Speech, and Agent.
```json
{
"docsConfig": {
"theme": "maple",
"$schema": "https://mintlify.com/docs.json",
"name": "PlayAI Docs",
"colors": {
"primary": "#34C759",
"light": "#34C759",
"dark": "#30D158"
},
"logo": {
"light": "https://mintlify.s3.us-west-1.amazonaws.com/playhtinc/media/wordmark-light.svg",
"dark": "https://mintlify.s3.us-west-1.amazonaws.com/playhtinc/media/wordmark-dark.svg"
},
"favicon": "/media/playai-dark.svg",
"api": {
"openapi": "openapi.yml",
"playground": {
"display": "interactive"
},
"examples": {
"defaults": "required"
}
},
"navbar": {
"links": [
{
"label": "Community (Discord)",
"href": "https://discord.gg/gTzFUdnABC"
},
{
"label": "Support",
"href": "mailto:support@play.ht"
}
],
"primary": {
"type": "button",
"label": "Website",
"href": "https://play.ai"
}
},
"navigation": {
"global": {
"anchors": [
{
"anchor": "Playground",
"icon": "play",
"href": "https://play.ai/api/sandbox"
},
{
"anchor": "Get Your API Key",
"icon": "key",
"href": "https://play.ai/api/keys"
}
]
},
"tabs": [
{
"tab": "Documentation",
"groups": [
{
"group": "Get Started",
"icon": "rocket",
"pages": [
"documentation/get-started/overview",
"documentation/get-started/use-cases"
]
},
{
"group": "Text-to-Speech",
"icon": "microphone",
"pages": [
"documentation/text-to-speech/introduction",
"documentation/text-to-speech/tts-quickstart",
"documentation/text-to-speech/tts-models",
"documentation/text-to-speech/tts-voices",
"documentation/text-to-speech/voice-cloning"
]
},
{
"group": "Agent",
"icon": "robot",
"pages": [
"documentation/agent/introduction",
"documentation/agent/agent-quickstart",
"documentation/agent/crawl-website"
]
}
]
}
]
}
}
}
```
--------------------------------
### Create an AI Podcast Tutorial
Source: https://docs.play.ai/documentation/agent/agent-quickstart
Learn how to create engaging AI-powered podcasts using PlayAI. This tutorial covers leveraging TTS capabilities to produce professional-sounding audio content.
```markdown
## Create an AI Podcast
Discover the steps to craft compelling AI podcasts, from script preparation to final audio output using PlayAI's advanced TTS technology.
```
--------------------------------
### Create First Audio with Play AI (Bash)
Source: https://docs.play.ai/documentation/text-to-speech/tts-quickstart
Executes a script to generate your initial audio output using Play AI. This example demonstrates a basic usage pattern for the Play AI service.
```shellscript
# Example script to create audio
# Replace with actual Play AI command or SDK usage
# This is a placeholder based on the provided structure
play_ai --text "Hello, Play AI!" --output audio.wav
```
--------------------------------
### Initialize Play AI SDK/Client Setup
Source: https://context7_llms
This snippet demonstrates the initial setup for interacting with Play AI services, focusing on importing necessary libraries and configuring authentication headers. It covers common languages used in AI development.
```python
import requests
import os
import time
# Set up headers with your API secrety key and user ID
user_id = os.getenv("PLAYAI_USER_ID")
secret_key = os.getenv("PLAYAI_API_KEY")
headers = {
'X-USER-ID': user_id,
'Authorization': secret_key,
'Content-Type': 'application/json',
}
```
```javascript
const axios = require('axios');
require('dotenv').config();
// Set up headers with your API secret key and user ID
const headers = {
'X-USER-ID': process.env.PLAYAI_USER_ID,
'Authorization': process.env.PLAYAI_API_KEY,
'Content-Type': 'application/json',
};
```
```go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"time"
)
```
```dart
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:dotenv/dotenv.dart';
```
```swift
import Foundation
```
```rust
use reqwest::Client;
use serde::{Deserialize, Serialize};
use std::env;
use tokio;
```
--------------------------------
### PlayAI Documentation Navigation and Configuration
Source: https://docs.play.ai/documentation/agent/agent-quickstart
This entry details the structure and configuration of the PlayAI documentation site, including global anchors for quick access to key features like the Playground and API Key generation, and a structured navigation system for various product sections.
```APIDOC
docsConfig:
global:
anchors:
- anchor: "Playground"
icon: "play"
href: "https://play.ai/api/sandbox"
- anchor: "Get Your API Key"
icon: "key"
href: "https://play.ai/api/keys"
tabs:
- tab: "Documentation"
groups:
- group: "Get Started"
icon: "rocket"
pages:
- title: "Welcome to PlayAI"
sidebarTitle: "Introduction"
icon: "rocket"
description: "Comprehensive platform for building world-class voice AI solutions"
href: "/documentation/get-started/overview"
- title: "Use Cases"
icon: "lightbulb-on"
description: "Explore real-world applications and use cases for PlayAI products"
href: "/documentation/get-started/use-cases"
- group: "Text-to-Speech"
icon: "microphone"
pages:
- title: "Text to Speech"
sidebarTitle: "Introduction"
description: "Turn text into lifelike speech with PlayAI's API"
icon: "book-open"
href: "/documentation/text-to-speech/introduction"
- title: "Text-to-Speech Quickstart"
sidebarTitle: "Quickstart"
icon: "bolt"
description: "Get started with PlayAI Text-to-Speech in minutes"
href: "/documentation/text-to-speech/tts-quickstart"
- title: "Models"
description: "Explore our state-of-the-art text-to-speech models"
icon: "cubes"
href: "/documentation/text-to-speech/tts-models"
- title: "Voices"
description: "How to use our pre-built voices or create your own"
icon: "volume-high"
href: "/documentation/text-to-speech/tts-voices"
- title: "Voice Cloning"
description: "Learn how to create custom voices from your own audio samples"
icon: "bring-front"
href: "/documentation/text-to-speech/voice-cloning"
- group: "Agent"
icon: "robot"
pages:
- title: "PlayAI Agent"
sidebarTitle: "Introduction"
description: "Deploy voice-powered agents to web, apps, and telephony in minutes"
icon: "book-open"
href: "/documentation/agent/introduction"
- title: "Create Your First Agent"
sidebarTitle: "Quickstart"
icon: "bolt"
description: "Build your first AI voice agent in minutes"
href: "/documentation/agent/agent-quickstart"
- title: "Knowledge Base"
description: "Learn how to give agents access to your documents and websites"
icon: "brain-circuit"
href: "/documentation/agent/crawl-website"
- title: "Actions and Integrations"
icon: "plug"
description: "Learn how to empower your agents to perform actions on your or your users' behalf"
href: "/documentation/agent/actions-integrations"
- title: "Web Embed"
description: "Learn how to embed a PlayAI Agent on your website"
icon: "square-code"
href: "/documentation/agent/web-embed"
- group: "Agent SDKs"
icon: "code-fork"
```
--------------------------------
### Start Local MCP Server
Source: https://docs.play.ai/documentation/resources/mcp
Starts the locally installed PlayAI MCP server. This script acts as a bridge between AI tools and PlayAI services, running on your machine.
```bash
node /Users/[username]/.mcp/playhtinc/src/index.js
```
--------------------------------
### Python SDK Authentication Setup
Source: https://docs.play.ai/documentation/text-to-speech/tts-quickstart
This Python code snippet demonstrates how to retrieve API keys and user IDs from environment variables and configure the necessary headers for making authenticated requests to the PlayAI service. It imports the 'requests' and 'os' libraries.
```python
import requests
import os
# Get credentials from environment variables
api_key = os.getenv("PLAYAI_KEY")
user_id = os.getenv("PLAYAI_USER_ID")
# Set up headers
headers = {
'Authorization': "f'Bearer \"
```
--------------------------------
### PlayNote API Reference
Source: https://docs.play.ai/api-reference/text-to-speech/endpoints/v1/stream-speech
Documentation for the PlayNote feature, covering its introduction and quickstart guide.
```APIDOC
PlayNote API:
Introduction: Overview of the PlayNote feature.
Quickstart: Guide to getting started with PlayNote.
```
--------------------------------
### Go File Creation and Error Handling
Source: https://docs.play.ai/documentation/text-to-speech/tts-quickstart
Illustrates file creation in Go using `os.Create`. This snippet shows how to create a file named 'hello.wav' and handle potential errors during the creation process. It's a common pattern for writing data to disk.
```go
out, err := os.Create("hello.wav")
if err != nil {
// Handle error
}
```
--------------------------------
### Setup PlayNote Creation (Swift)
Source: https://context7_llms
This Swift snippet sets up the necessary components for creating a PlayNote via the Play.ai API. It retrieves API keys and user IDs from environment variables, defines the API endpoint, and constructs the headers required for authentication and content negotiation. The snippet is incomplete, showing only the initial setup.
```swift
import Foundation
let SOURCE_FILE_URL = "https://godinton.kent.sch.uk/media/2601/goldilocks-story.pdf"
let url = URL(string: "https://api.play.ai/api/v1/playnotes")!
guard let apiKey = ProcessInfo.processInfo.environment["PLAYAI_API_KEY"],
let userId = ProcessInfo.processInfo.environment["PLAYAI_USER_ID"] else {
fatalError("Please set PLAYAI_API_KEY and PLAYAI_USER_ID environment variables")
}
let headers = [
"AUTHORIZATION": apiKey,
"X-USER-ID": userId,
"accept": "application/json"
]
let files: [String: Any] = [
"sourceFileUrl": SOURCE_FILE_URL,
"synthesisStyle": "podcast",
"voice1": "s3://voice-cloning-zero-shot/baf1ef41-36b6-428c-9bdf-50ba54682bd8/original/manifest.json",
"voice1Name": "Angelo",
```
--------------------------------
### Install MCP CLI and Add PlayAI Server
Source: https://docs.play.ai/llms-full.txt
Commands to install the Mintlify MCP CLI tool globally and add the PlayAI MCP server to your local setup. This involves using npm and npx.
```bash
npm install -g @mintlify/mcp
```
```bash
npx @mintlify/mcp add playhtinc
```
--------------------------------
### Install MCP CLI and Add PlayAI Server
Source: https://context7_llms
Commands to install the Mintlify MCP CLI tool globally and add the PlayAI MCP server to your local setup. This involves using npm and npx.
```bash
npm install -g @mintlify/mcp
```
```bash
npx @mintlify/mcp add playhtinc
```
--------------------------------
### Next Steps and Related Features
Source: https://docs.play.ai/documentation/text-to-speech/tts-quickstart
Suggests further actions and features to explore, including trying different voices, creating multi-speaker dialogues, and utilizing the WebSocket API for audio streaming.
```APIDOC
Next Steps:
- Try Different Voices: Explore the voice library at /api-reference/text-to-speech/endpoints/v1/list-voices.
- Create Multi-speaker Dialogues: Learn to create conversations at /documentation/tutorials/tts/dialogs/create-ai-podcast.
- Stream Audio: Utilize the WebSocket API for real-time streaming at /api-reference/text-to-speech/websocket.
```
--------------------------------
### Go Package Main Structure
Source: https://docs.play.ai/documentation/text-to-speech/tts-quickstart
A basic Go program structure, indicating the 'main' package, which is the entry point for executable Go programs. This snippet shows the initial setup for a Go application.
```go
package main
```
--------------------------------
### Initialize Play AI SDK/Client Setup
Source: https://docs.play.ai/llms-full.txt
This snippet demonstrates the initial setup for interacting with Play AI services, focusing on importing necessary libraries and configuring authentication headers. It covers common languages used in AI development.
```python
import requests
import os
import time
# Set up headers with your API secrety key and user ID
user_id = os.getenv("PLAYAI_USER_ID")
secret_key = os.getenv("PLAYAI_API_KEY")
headers = {
'X-USER-ID': user_id,
'Authorization': secret_key,
'Content-Type': 'application/json',
}
```
```javascript
const axios = require('axios');
require('dotenv').config();
// Set up headers with your API secret key and user ID
const headers = {
'X-USER-ID': process.env.PLAYAI_USER_ID,
'Authorization': process.env.PLAYAI_API_KEY,
'Content-Type': 'application/json',
};
```
```go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"time"
)
```
```dart
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:dotenv/dotenv.dart';
```
```swift
import Foundation
```
```rust
use reqwest::Client;
use serde::{Deserialize, Serialize};
use std::env;
use tokio;
```
--------------------------------
### Advanced Setup Messages for Play AI API (JSON)
Source: https://docs.play.ai/api-reference/agents/websocket
Examples of setup messages demonstrating various configuration options for audio input and output formats and sample rates. These allow for fine-tuning the audio processing pipeline.
```json
// mulaw 16KHz as input
{ "type": "setup", "apiKey": "...", "inputEncoding": "mulaw", "inputSampleRate": 16000 }
// 24Khz mp3 output
{ "type": "setup", "apiKey": "...", "outputFormat": "mp3", "outputSampleRate": 24000 }
// mulaw 8KHz in and out
{ "type": "setup", "apiKey": "...", "inputEncoding": "mulaw", "inputSampleRate": 8000, "outputFormat": "mulaw", "outputSampleRate": 8000 }
```
--------------------------------
### Set Up PlayAI API Credentials
Source: https://docs.play.ai/documentation/text-to-speech/tts-quickstart
Securely set your PlayAI API key and user ID as environment variables. This is a crucial first step before making any API calls. The example shows how to add these to your shell's configuration file and then source it.
```shellscript
echo "export PLAYAI_KEY=\"your_api_key_here\"" >> ~/.zshrc
echo "export PLAYAI_USER_ID=\"your_user_id_here\"" >> ~/.zshrc
source ~/.zshrc
```