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/recognize-file(options) → {RecognizeStream}
Create and return a RecognizeStream from a File or Blob (e.g. from a file , a dtagdrop targe, or an ajax request)
Parameters:
| Name | Type | Description | |||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Also passed to {MediaElementAudioStream} and to {RecognizeStream} Properties
|
- Source:
Returns:
- Type
- RecognizeStream
module:watson-speech/speech-to-text/recognize-microphone(options) → {RecognizeStream}
Create and return a RecognizeStream from the user's microphone If the options.file is set, it is used instead of the microphone
Parameters:
| Name | Type | Description | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Also passed to {MediaElementAudioStream} and to {RecognizeStream} Properties
|
Returns:
- Type
- RecognizeStream
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 (loading the top-level module automatically includes a pollyfill, but loading this sub-module directly doesn't.)
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Source:
- To Do:
-
- define format in @returns 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
noTimestamps(result) → {Boolean}
Returns true if the result is missing it's timestamps
Parameters:
| Name | Type | Description |
|---|---|---|
result |
Object |
- Source:
Returns:
- Type
- Boolean
playFile(file) → {Promise.<FilePlayer>}
Determines the file's content-type and then resolves to a FilePlayer instance
Parameters:
| Name | Type | Description |
|---|---|---|
file |
File | Blob |
- Source:
Returns:
- Type
- Promise.<FilePlayer>