FantasyTalking Installatiehandleiding
Vereisten
Zorg er voordat je FantasyTalking installeert voor dat je ontwikkelomgeving aan de volgende vereisten voldoet. Wat betreft besturingssystemen ondersteunt het project Windows, macOS en Linux. Het gebruik van een 64-bits systeem wordt aanbevolen voor optimale prestaties. Node.js versie 14.0 of hoger is vereist, en Python versie 3.7 of hoger. Als je de Python-backend gebruikt, moet ook het audioverwerkingsprogramma FFmpeg worden geïnstalleerd.
Wat betreft hardware wordt voor een soepele spraaksynthese-ervaring een systeem met ten minste 4 GB RAM en een dual-core processor aanbevolen. Voor toepassingen die realtime spraaksynthese vereisen, wordt het gebruik van SSD-opslag aanbevolen om I/O-latency te verminderen. Als je modeltraining of aangepaste spraakontwikkeling wilt uitvoeren, is een CUDA-geschikte grafische kaart nodig.
Installatiemethoden
FantasyTalking ondersteunt meerdere installatiemethoden. Ontwikkelaars kunnen de meest geschikte methode kiezen op basis van hun behoeften en technologiestack.
Met npm (Node.js)
# Install core library
npm install fantasy-talking
# Install optional components
npm install fantasy-talking-ui # Web UI components
npm install fantasy-talking-node # Node.js backend support
Met pip (Python)
# Install core library
pip install fantasy-talking
# Install optional components
pip install fantasy-talking[ui] # Web UI components
pip install fantasy-talking[all] # All optional components
Bouwen vanuit de broncode
# Clone repository
git clone https://github.com/fantasytalking/fantasy-talking.git
cd fantasy-talking
# Install Node.js dependencies
npm install
# Install Python dependencies (optional)
pip install -r requirements.txt
# Build project
npm run build
Snel aan de slag
JavaScript/TypeScript-voorbeeld
const FantasyTalking = require('fantasy-talking');
// Initialize client
const client = new FantasyTalking({
apiKey: 'your-api-key',
// Optional: specify voice style
voice: {
style: 'neutral',
language: 'en-US',
speed: 1.0,
pitch: 1.0
}
});
// Synthesize speech
async function synthesize() {
const audio = await client.speak('Hello, this is a test voice from FantasyTalking');
console.log('Speech synthesis successful');
// Save to file
const fs = require('fs');
fs.writeFileSync('output.wav', audio);
// Or play directly
client.play(audio);
}
synthesize();
Python-voorbeeld
from fantasy_talking import FantasyTalking
# Initialize client
client = FantasyTalking(
api_key='your-api-key',
voice={
'style': 'neutral',
'language': 'en-US',
'speed': 1.0,
'pitch': 1.0
}
)
# Synthesize speech
audio = client.speak('Hello, this is a test voice from FantasyTalking')
# Save to file
with open('output.wav', 'wb') as f:
f.write(audio)
print('Speech synthesis successful')
Configuratieopties
FantasyTalking biedt rijke configuratieopties die kunnen worden aangepast aan specifieke behoeften.
Basaalconfiguratie
| Parameter | Type | Standaard | Beschrijving |
|---|---|---|---|
| apiKey | string | - | API-sleutel, vereist |
| apiUrl | string | Default | Adres van de API-server |
| timeout | number | 30000 | Time-out van verzoek (ms) |
| retries | number | 3 | Aantal nieuwe pogingen voor verzoek |
Spraakconfiguratie
| Parameter | Type | Standaard | Beschrijving |
|---|---|---|---|
| voice.style | string | neutral | Spraakstijl: neutral, happy, sad, angry, excited |
| voice.language | string | en-US | Taalcode |
| voice.speed | number | 1.0 | Spreeksnelheid, bereik 0.5-2.0 |
| voice.pitch | number | 1.0 | Toonhoogte, bereik 0.5-2.0 |
| voice.volume | number | 1.0 | Volume, bereik 0-1.0 |
Geavanceerde configuratie
Voor gevorderde gebruikers kunnen meer parameters worden geconfigureerd voor fijnere controle:
const client = new FantasyTalking({
apiKey: 'your-api-key',
// Audio output format
audio: {
format: 'wav', // wav, mp3, ogg
sampleRate: 16000, // 8000, 16000, 24000, 48000
bitDepth: 16 // 8, 16, 24
},
// Dialogue configuration
dialogue: {
enable: true,
contextWindow: 5, // Number of dialogue turns to preserve
systemPrompt: 'You are a friendly voice assistant'
},
// Streaming output
stream: {
enable: true,
chunkSize: 1024 // Chunk size for streaming output
}
});
Service-implementatie
Docker-implementatie
Het project biedt Docker-images voor eenvoudige implementatie:
# Pull image
docker pull fantasytalking/server:latest
# Run container
docker run -d \
--name fantasy-talking \
-p 8080:8080 \
-e API_KEY=your-api-key \
-e PORT=8080 \
fantasytalking/server:latest
Zelfgehoste service
Voor volledige controle kun je je eigen backend-service implementeren:
# Clone backend code
git clone https://github.com/fantasytalking/server.git
cd server
# Configure environment variables
cp .env.example .env
# Edit .env file, fill in API key and other configurations
# Start service
npm run start
Nadat de service is gestart, kun je spraaksyntheseverzoeken doen via de RESTful API. Raadpleeg de officiële documentatie voor gedetailleerde API-documentatie.
Installatie verifiëren
Na de installatie kun je verifiëren dat FantasyTalking correct werkt:
# Test with command line tool
fantasy-talking --text "Test voice" --output test.wav
# Or run example
npm run example
Als alles werkt, zou je moeten zien dat het spraakbestand succesvol is gegenereerd. Raadpleeg de pagina met veelgestelde vragen voor veelvoorkomende installatieproblemen en oplossingen.
