Skip to content

๐ŸŒ Section 06 โ€“ HTTP Integration

While Wyoming is optimized for streaming socket communication, it also supports basic HTTP interfaces via Flask for environments where streaming is not available or needed.


๐Ÿงฉ HTTP Services Provided

Wyoming includes three HTTP servers:

Path File Description
/asr wyoming/http/asr_server.py Accepts WAV uploads and returns transcript
/tts wyoming/http/tts_server.py Accepts text and returns audio
/intent wyoming/http/intent_server.py Accepts text and returns structured intent

๐Ÿงช Example: Speech-to-Text (ASR)

Endpoint: POST /asr
Content-Type: multipart/form-data
Fields: - audio โ€“ WAV file - name โ€“ ASR model name (optional)

Curl Example:

curl -F "audio=@sample.wav" http://localhost:5001/asr

Response:

{ "text": "hello world" }

๐Ÿ—ฃ๏ธ Example: Text-to-Speech (TTS)

Endpoint: POST /tts
Content-Type: application/json

Payload:

{ "text": "Hello!", "voice": { "language": "en" } }

Curl Example:

curl -X POST http://localhost:5002/tts \
     -H "Content-Type: application/json" \
     -d '{"text":"hello!"}' --output hello.wav

๐ŸŽฏ Example: Intent Recognition

Endpoint: POST /intent
Content-Type: application/json

Payload:

{ "text": "Turn off the lights" }

Response:

{
  "intent": {
    "name": "TurnOff",
    "entities": [ { "name": "device", "value": "lights" } ]
  }
}

โš™๏ธ Running the Servers

Each HTTP server is a standalone Python script and uses Flask. You can run them directly:

python3 wyoming/http/asr_server.py
python3 wyoming/http/tts_server.py
python3 wyoming/http/intent_server.py

๐Ÿ“ฆ Deployment Notes

  • Not optimized for large-scale concurrent users.
  • Recommended for local or single-user systems.
  • Ideal for Home Assistant Add-ons or debugging Wyoming services.

๐Ÿง  Tip

These HTTP services are thin wrappers around Wyoming socket clients.
They convert HTTP input to Wyoming Events and forward to backend services.

You can modify or extend them to fit your infrastructure.