Add ttstoy cog

This commit is contained in:
2026-06-05 16:41:55 -05:00
parent 0e9f4a5224
commit 6739b2d6f1
975 changed files with 8216 additions and 0 deletions
+158
View File
@@ -0,0 +1,158 @@
# Testing DECTalk Server with TTSTOY
Quick testing guide to verify everything works.
## Step 1: Start the DECTalk Server
```bash
cd ~/Desktop/ttstoy/dectalk-server
PORT=3001 npm start
```
You should see:
```
DECTalk TTS Server running on http://localhost:3001
Health check: http://localhost:3001/health
Simple API: http://localhost:3001/say?text=Hello
MiniMax-compatible API: POST http://localhost:3001/v1/t2a_v2
```
## Step 2: Test the API Directly
Open a new terminal and test:
```bash
# Test health check
curl http://127.0.0.1:3001/health
# Test simple endpoint (saves to test.mp3)
curl "http://127.0.0.1:3001/say?text=Hello%20world" -o test.mp3
# Play the audio
ffplay test.mp3
# or
mpv test.mp3
# Test MiniMax-compatible endpoint
curl -X POST http://127.0.0.1:3001/v1/t2a_v2 \
-H "Content-Type: application/json" \
-d '{"text": "Testing DECTalk compatibility", "voice_setting": {"voice_id": "default"}}' \
| jq '.base_resp'
```
Expected output:
```json
{
"status_code": 0,
"status_msg": "Success"
}
```
## Step 3: Configure TTSTOY
In Discord:
```
[p]ttstoy dectalkurl http://127.0.0.1:3001
[p]ttstoy mode dectalk
[p]ttstoy mode
```
You should see:
```
Current TTS Mode: 🤖 DECTALK
DECTalk API URL: http://127.0.0.1:3001
```
## Step 4: Test TTS in Discord
```
[p]tts Hello, I am DECTalk, a text to speech system.
```
The bot should:
1. Generate audio using DECTalk
2. Upload the MP3 file to Discord
3. Play it in voice chat
## Step 5: Test with Emoji SFX
```
[p]tts Hello 🎉 this is a party 🔥
```
The bot should mix DECTalk voice with sound effects.
## Troubleshooting
### Server won't start (port in use)
```bash
# Find what's using port 3001
lsof -i :3001
# Use a different port
PORT=3002 npm start
# Update TTSTOY
[p]ttstoy dectalkurl http://127.0.0.1:3002
```
### "Cannot reach DECTalk API"
1. Check server is running:
```bash
curl http://127.0.0.1:3001/health
```
2. Check server logs in the terminal where you started it
3. Verify URL in TTSTOY:
```
[p]ttstoy dectalkurl
```
### Audio not playing
1. Make sure ffmpeg is installed:
```bash
ffmpeg -version
```
2. Check bot logs for errors
3. Test the `/say` endpoint directly and play the audio
### "say: command not found" (Linux)
The current server uses macOS `say` command. On Linux, you need to:
1. Install actual DECTalk or use espeak:
```bash
# Option 1: espeak (simple)
sudo apt install espeak
# Option 2: Install dectalk-tts
npm install -g dectalk-tts
```
2. Modify `server.js` to use the appropriate command
## Success Checklist
- [ ] DECTalk server starts without errors
- [ ] `/health` endpoint returns `{"status": "ok"}`
- [ ] `/say` endpoint generates audio file
- [ ] TTSTOY mode switches to dectalk
- [ ] `[p]tts` command works in Discord
- [ ] Audio plays in voice chat
- [ ] Emoji SFX work correctly
## Next Steps
Once everything works:
1. Set up auto-start with systemd or PM2
2. Configure firewall if needed
3. Consider using actual DECTalk binary for authentic voice
4. Add cleanup for old audio files in output/