← all repositories
Baidu-AIP/speech-demo

Baidu's speech API: the reference implementation nobody asked for

A multi-language Rosetta Stone for calling Baidu's speech REST endpoints, mostly so you don't have to read their docs.

speech-demo
Velocity · 7d
+0.2
★ / day
Trend
steady
star history

What it does

This repo holds copy-pasteable examples in Java, PHP, Python, C, and Bash for two Baidu cloud services: speech-to-text (ASR) and text-to-speech (TTS). Everything hits the same REST endpoints over HTTP; the code shows how to fetch an OAuth token, attach it to requests, and shuttle audio or text back and forth.

The interesting bit

The value isn’t in the code—it’s in the legwork. Baidu’s official docs live on a separate subdomain and the token endpoint doesn’t support CORS, so browser-only use is deliberately broken out into a second repo. This one gathers the working server-side patterns in one place, including a note that Windows users can fall back to Cygwin for the C samples.

Key highlights

  • Covers both ASR and TTS with identical language coverage
  • Includes sample audio files so the recognition demo runs immediately
  • Explicitly flags the CORS split: TTS works cross-origin, token auth does not
  • Shell and C versions included, not just the usual scripting languages
  • No dependencies beyond standard HTTP libraries; the Java code is plain HttpURLConnection

Caveats

  • The README is sparse: no error handling, no rate-limit notes, no SDK—just raw REST calls
  • Stars (708) suggest mild interest, but issues and PRs are not visible in the provided source

Verdict

Grab this if you’re integrating Baidu speech into a legacy stack and need a quick, verifiable starting point in your language of choice. Skip it if you wanted an official SDK, retry logic, or streaming WebSocket support—this is strictly request/response HTTP plumbing.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.