Skip to content

joshcorwin/RpwsVoice

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RpwsVoice

RPWS speech to text server for the Pebble smartwatch. Provides a sort of proxy between Google speech to text to emulate the Nuance voice API, and to enforce usage quotas. Usage quotas are needed to keep RPWS free.

How it Works

I'm pretty proud of the solution I came up with for RPWS Voice. RPWS Voice uses the hostname provided to determine the region, enviornment, and, most importantly, user account sending the request. When a user sets up RPWS for the first time, a URL to a configuration file is passed into the Pebble app so it can use the RPWS services. RPWS adds your unique access token to the configuration file for two reasons. One, you'll already be signed in and you won't need to sign into the Pebble app again. Two, it provides services to identify who you are, even if the Pebble app does not send authentication.

A configuration URL looks like this: https://config.pebbleapis.romanport.com/official/v2/android/?token=eBVQYih6V35LLZ5dc1SCIRmP0mSsWoBkjWS4mB8zE3. The token is provided at the end. When that URL is requested, the configuration server sends a request with your token to the RPWS Voice server. The RPWS Voice server will generate a 16 character, all lowercase, "voice token" to be used. We need this voice token to be all lowercase because it will be used in the hostname of the RPWS Voice request.

Because the Pebble config file can only provide the hostnames of the dictation servers, I need to use the hostname to contain all data for the request. The configuration server will use the voice token sent and insert it into the hostname for the voice server. The format of the voice server hostname looks like this: {region}-{voice token}-{enviornment (prod/dev)}.voice.get-rpws.com. Any subdomain of voice.get-rpws.com will be resolved to the RPWS Voice server. The configuration server inserts the voice token and region to produce the final hostname the Pebble app will use. For example, the en-US region for this user will look like this: enus-tchojbiueduxxhbh-prod.voice.get-rpws.com, where tchojbiueduxxhbh is the "voice token" for the RPWS token, eBVQYih6V35LLZ5dc1SCIRmP0mSsWoBkjWS4mB8zE3, used to make the request.

Once a dictation request is made, the RPWS Voice server reads the host header in the HTTP request to determine what domain was accessed. It will read the format and determine the region, enviornment, and voice token used. The RPWS Voice server looks up the voice token and finds it's RPWS token. The RPWS Voice server will connect to the RPWS master server to download the user information for the user. The only user info that we care about on this end is their unique RPWS UUID, E-Mail address, and name.

The RPWS Voice server uses the unique RPWS UUID to create a small account on the voice server. This small account contains the quota data. Once it's verified that the user has enough credits to make the voice dictation, the (borderline standard breaking) data from the Pebble is read and converted to audio data useful for Google. The encoded audio data is in the Speex format. This audio data is sent to Google and is converted to text. Once the RPWS Voice server gets the text data, it is converted to the format used by the original Nuance API used by Pebble before services were shut down. Then, the account is updated and one credit is subtracted.

About

RPWS speech to text server for the Pebble smartwatch.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%