Methods
getContentTypeFromFile(file) → {Promise}
Reads the first few bytes of a binary file and resolves to the content-type if recognized & supported
Parameters:
| Name | Type | Description |
|---|---|---|
file |
File | Blob |
- Source:
Returns:
- Type
- Promise
module:watson-speech/speech-to-text/get-models(options) → {Promise.<T>}
Returns a promise that resolves to an array of objects representing the available voice models. Example:
[{
"url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/en-UK_BroadbandModel",
"rate": 16000,
"name": "en-UK_BroadbandModel",
"language": "en-UK",
"description": "UK English broadband model."
},
//...
]Requires fetch, pollyfill available at https://github.com/github/fetch
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Source:
- To Do:
-
- define format in @return statement
Returns:
- Type
- Promise.<T>
module:watson-speech/speech-to-text/recognize-file(options) → {RecognizeStream|SpeakerStream|FormatStream|ResultStream|TimingStream}
Create and return a RecognizeStream from a File or Blob (e.g. from a file , a dragdrop target, or an ajax request)
Parameters:
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Also passed to {MediaElementAudioStream} and to {RecognizeStream} Properties
|
- Source:
Returns:
- Type
- RecognizeStream | SpeakerStream | FormatStream | ResultStream | TimingStream
module:watson-speech/speech-to-text/recognize-microphone(options) → {RecognizeStream|SpeakerStream|FormatStream|ResultStream}
Create and return a RecognizeStream sourcing audio from the user's microphone
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Also passed to {RecognizeStream}, and {FormatStream} when applicable Properties
|
Returns:
- Type
- RecognizeStream | SpeakerStream | FormatStream | ResultStream
module:watson-speech/text-to-speech/get-voices(options) → {Promise.<T>}
Returns a promise that resolves to an array of objects representing the available voices. Example:
[{
"name": "en-US_MichaelVoice",
"language": "en-US",
"customizable": true,
"gender": "male",
"url": "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/en-US_MichaelVoice",
"description": "Michael: American English male voice."
},
//...
]Requires fetch, pollyfill available at https://github.com/github/fetch
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Source:
- To Do:
-
- define format in @return statement
Returns:
- Type
- Promise.<T>
module:watson-speech/text-to-speech/synthesize(options) → {Audio}
Synthesize and play the supplied text over the computers speakers.
Creates and returns a HTML5 <audio> element
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
Returns:
- Type
- Audio
playFile(file) → {Promise.<FilePlayer>}
Determines the file's content-type and then resolves to a FilePlayer instance
Parameters:
| Name | Type | Description |
|---|---|---|
file |
File | Blob | String | binary data or URL of audio file (binary data playback may not work on mobile Safari) |
- Source:
Returns:
- Type
- Promise.<FilePlayer>