Pebble.Dictation
Voice dictation via the Pebble microphone and phone speech recognition.
Start a session with start, subscribe to onStatus and onResult, and call stop to cancel early if needed.
import Pebble.Dictation as Dictation
type Msg
= StartDictation
| DictationStatus Dictation.Status
| DictationResult (Result Dictation.Error String)
update msg model =
case msg of
StartDictation ->
( model, Dictation.start )
DictationResult (Ok text) ->
( { model | transcript = text }, Cmd.none )
_ ->
( model, Cmd.none )
subscriptions _ =
Sub.batch
[ Dictation.onStatus DictationStatus
, Dictation.onResult DictationResult
]
For a runnable example, use the watch-demo-dictation project template in the IDE.
Native Pebble C API
- Dictation on developer.repebble.com
Union Types
Error
type Error
= NoMicrophone
| PhoneDisconnected
| Cancelled
| Failed StringDictation session errors.
Status
type Status
= Starting
| Recognizing
| FinishedDictation session lifecycle status.
Commands
start
start : Cmd msgStart a dictation session.
stop
stop : Cmd msgStop an in-progress dictation session.
Subscriptions
onStatus
onStatus : (Status -> msg) -> Sub msgReceive dictation status updates.
onResult
onResult : (Result Error String -> msg) -> Sub msgReceive the transcribed text or an error when the session completes.