How googlecloudplatform/text-to-speech-epg-demo works
This demo lets an EPG user request spoken program text and play the resulting audio. The UI sends text and voice options to a Go HTTP service, which checks for cached audio, synthesizes a miss, stores the MP3, signs an access URL, and returns it for playback through the CDN. The README documents this end-to-end flow and startup secret loading. Several helper implementations are sampled, but the UI’s JavaScript and secret-loading implementation are not; those links are shown only where documented or directly visible in the excerpts.
Main entry points: main.go Speech HTTP API · index.html Mock EPG UI · text_to_speech_helpers.go Speech synthesis · secret_manager_helpers.go Signing-key loader
Components 15
EPG Demo
- Mock EPG UI
epg-ui/src/index.html - EPG items
epg-ui/src/epg-items.json
Speech Requests
- Speech HTTP API
get-speech-service/src/main.go - Cache lookup
get-speech-service/src/main.go - Request hashing
get-speech-service/src/crypto_helpers.go
Audio Pipeline
- Audio storage
get-speech-service/src/gcs_helpers.go - Speech synthesis
get-speech-service/src/text_to_speech_helpers.go
Secure Delivery
- URL signing
get-speech-service/src/gcs_helpers.go - Signing-key loader
get-speech-service/src/secret_manager_helpers.go
Other components
- EPG user
- Speech client
- Cloud Text-to-Speech
- Secret Manager
- Cloud CDN
- Audio listener
Connections 19
- EPG user → Mock EPG UI: selects text
README.md - EPG items → Mock EPG UI: provides items
- Mock EPG UI → Speech HTTP API: requests speech
README.md - Speech client → Speech HTTP API: posts text
README.md - Speech HTTP API → Cache lookup: fetches audio
get-speech-service/src/main.go - Cache lookup → Request hashing: hashes request
get-speech-service/src/main.go - Cache lookup → Audio storage: checks object
get-speech-service/src/main.go - Cache lookup → Speech synthesis: generates on miss
README.md - Speech synthesis → Cloud Text-to-Speech: synthesizes text
get-speech-service/src/text_to_speech_helpers.go - Speech synthesis → Audio storage: uploads MP3
get-speech-service/src/text_to_speech_helpers.go - Speech HTTP API → URL signing: signs audio URL
get-speech-service/src/main.go - URL signing → Signing-key loader: decodes key
get-speech-service/src/gcs_helpers.go - Speech HTTP API → Signing-key loader: loads key at startup
get-speech-service/src/main.go - Signing-key loader → Secret Manager: reads signing key
README.md - Speech HTTP API → Speech client: returns signed URL
README.md - Mock EPG UI → Cloud CDN: loads audio
README.md - Speech client → Cloud CDN: loads audio
README.md - Cloud CDN → Audio storage: fetches cache miss
README.md - Mock EPG UI → Audio listener: plays audio
README.md