Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

C library for speech recognition using the Google Speech API

branch: master
README
Speech recognizer library in C using the Google Speech API.

Requires libcurl >= 7.25.0, libjsonz, libflac and libogg.
For iOS, you have to grab these libraries either from Cydia or my web page.
Libjsonz is already in Cydia for an iOS build; for desktop, you can alternatively find it here: http://github.com/H2CO3/libjsonz
Libflac, libogg and libcurl should be already in your favourite Unix distro's package management system.
For iOS, you can download the Debian packages from here:
	cURL 7.25.0:	http://apaczai.elte.hu/~13akga/content/download.php?file=curl_7.25.0_iphoneos-arm.deb
	libogg:		http://apaczai.elte.hu/~13akga/content/download.php?file=libogg_1.3.0_iphoneos-arm.deb
	libflac:	http://apaczai.elte.hu/~13akga/content/download.php?file=libflac_1.2.1_iphoneos-arm.deb

Tested on iOS 4.2.1 and Ubuntu 11.10.

If immediate recording of FLAC audio is possible on a platform, then it should be done using 16000 samples/second, 2 channels, 16 bit/sample (signed
little endian); and only the functions in send_data.h have to be used:
	sprec_get_file_contents() reads a file and returns a pointer to its contents.
	sprec_send_audio_data() takes a pointer to the contents of a FLAC file and sends it to the Google Speech API along with the appropriate
	headers and other parameters. Returns the server's response.
	sprec_get_text_from_json() parses the JSON response and finds the actual text.

If immediate FLAC recording is not available, then the audio should be recorded in WAV (uncompressed interleaved PCM), 16 bits/sample,
signed, little endian, 2 channels and 16000 Hz sample rate. Then the resulting WAV file should be converted to a FLAC one using
sprec_flac_encode() in FLAC_encoder.h. Then one can proceed as described above. You can use the sprec_record_wav() function for this purpose.

To simplify this task, two convenience functions, sprec_recognize_sync() and
sprec_recognize_async() are also available (the latter needs POSIX threads).

See examples/tool.c and examples/simple.c for usage information.

Something went wrong with that request. Please try again.