Simple application allows to transform speech/voice to text. Based on two speech engines (can be selected in application):
- You need to choose Speech Engine.
- Click 'Start' button. It will start record your voice. Just say something.
- To finish record session press 'Stop' button.
- You will see result of voice-to-text translation.
- You need allow access to use your microphone.
- You can test application only on
localhost
orhttps protocol
.
- node v6.11.*
- mongoDB
- angular-cli
- Docker (for development, not required)
- Docker-compose (for development, not required)
cd speech
npm install
After installing dependencies you should configure application.
At first open config/default.js
and fill:
- host - application host (required)
- mongoDB url - url to you mongoDB (required).
module.exports = {
host: 'http://localhost'
port: 3000
mongo: {
url: 'mongodb://mongo/dev',
},
...
}
- Open Create project link
- Fill project name and click "Create"
- Open left menu and select Api Manager -> Credentials
- Click "Create credentials" and select "Service account key"
- Select "Service account" or select "New service account"
- Fill "Service account name" and select role "Project" -> "Owner"
- Select "Key type" -> "JSON"
- Click "Create". It will start downloading file with credentials
- Open this file in text editor and copy all field to
config/default.js googleSpeech->credentials
- Open https://console.cloud.google.com/
- Open left menu and select Api Manager -> Credentials
- Click "Create credentials" and select "OAuth client ID"
- If you receive message
To create an OAuth client ID, you must first set a product name on the consent screen
click "Configure consent screen" - Fill "Product name shown to users". This field is required. Then click "Save"
- Then select web application
- Fill name. Fill "Authorized JavaScript origins" type your site host. Fill "Authorized redirect URIs
" type google callback. Callback consist of
host
+callback uri
, like thathttps://plus-speech.now.sh/api/auth/google/callback
- Click "Create"
- You will receive credential for OAuth.
- Open file
config/default.js
. FilloAuth -> google
withclientId
secret
from step 10. - You need to check
callback
field. It must be like callback from step 8 but without host. Exampleapi/auth/google/callback
- Open https://developers.facebook.com/
- My Apps -> Add a New App
- Fill application name and contact email and click Create App Id
- You should see "Product setup" and select "Facebook Login" and click "Get started"
- Click "Facebook Login" in left menu
- Check options:
- Client OAuth Login - yes
- Web OAuth Login - yes
- Embedded Browser OAuth Login - no
- Force Web OAuth Reauthentication - no
- Fill "Valid OAuth redirect URIs", like
host
+/api/auth/facebook/callback
press enter and click "Save changes". Note: You can use several callback on one application. - Click "Settings" in left menu
- Fill "Site Url" like
https://plus-speech.now.sh
click "Save changes". Note: You can use several sites. Each site separated by space. Examplehttps://plus-speech.now.sh/ http://localhost:3000
- Open file
config/default.js
. FilloAuth -> facebook
withclientId: App ID
,secret: App Secret
,App ID, App Secret
from "Settings" page. - You need to check
callback
field. It must be like callback from step 8 but without host. Exampleapi/auth/facebook/callback
- For production. Click "App review" in left menu. Turn off
Your app is in development and unavailable to the public
You can have different configuration for production and development mode.
For this you need to set field with another configuration in file config/prod.js
. You can paste only required fields.
(!) File structure config/prod.js
should be like config/default.js
When you start application with NODE_ENV=prod
application take configuration from config/prod.js
.
Important: check you have nodejs v6.11.* and mongoDB v3.4.*.
Before starting you need to generate/compress/collect all js files for front-end.
Run from project root folder.
Command to prepare client app for production: npm run production.prepare.front
from root directory.
Or you can use:
cd client
npm run build.production
Note: For building angular 2 used @angular/cli
.
Generated and compressed files are stored in folder client/dist
.
For start application run npm start
.
Application started with NODE_ENV=prod
.
Credentials are in config/prod.js
file
Important: check you have nodejs v6.11.* and mongoDB v3.4.*.
For start backend: npm run start.dev
For init project you need:
cd client
npm install
For the following runs use next commands:
cd client
npm run start.client
Note: Only for development. Client app connected with backend through proxy.
By default client app starts on http://localhost:4200
and connects with backend by default localhost:3000
.
Angular cli proxy configuration: client/proxy.conf.json
Or you can use for Docker-compose for development.
not necessary, just for dev mode
Important: check you have docker and docker-compose
Use Make
file for shortcuts. All commands make help
For start backend run docker-compose up
or make app
.
If you need stop docker-compose containers use make stop
For init project you need:
cd client
npm install
For the following runs use next commands:
cd client
npm run start.client
- express js
- angular 2
- RecordRTC
- Web Speech Api
- Google Speech Api