# 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=33001 npm start ``` You should see: ``` DECTalk TTS Server running on http://localhost:33001 Health check: http://localhost:33001/health Simple API: http://localhost:33001/say?text=Hello MiniMax-compatible API: POST http://localhost:33001/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:33001/health # Test simple endpoint (saves to test.mp3) curl "http://127.0.0.1:33001/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:33001/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:33001 [p]ttstoy mode dectalk [p]ttstoy mode ``` You should see: ``` Current TTS Mode: 🤖 DECTALK DECTalk API URL: http://127.0.0.1:33001 ``` ## 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 33001 lsof -i :33001 # Use a different port PORT=33002 npm start # Update TTSTOY [p]ttstoy dectalkurl http://127.0.0.1:33002 ``` ### "Cannot reach DECTalk API" 1. Check server is running: ```bash curl http://127.0.0.1:33001/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/