sugo-module-say
Say command module for SUGOS. (Supports only OSX)
Last updated 10 months ago by realglobe .
Apache-2.0 · Repository · Bugs · Original npm · Tarball
$ cnpm install sugo-module-say 
SYNC missed versions from official npm registry.

sugo-module-say

Build Status npm Version JS Standard

Say command module for SUGOS. (Supports only OSX)

Requirements

Mac Node.js NPM

This modules uses say command of OSX, thus you need a mac.

Installation

$ npm install sugo-module-say --save

Usage

Register module to SUGO-Actor

#!/usr/bin/env node

/**
 * Example usage to register module on actor
 * @see https://github.com/realglobe-Inc/sugo-actor
 */
'use strict'

const sugoModuleSay = require('sugo-module-say')
const sugoActor = require('sugo-actor')
const co = require('co')

co(function * () {
  let actor = sugoActor('http://my-sugo-cloud.example.com/actors', {
    key: 'my-actor-01',
    modules: {
      // Register the module
      say: sugoModuleSay({})
    }
  })
  yield actor.connect()
}).catch((err) => console.error(err))

Then, call the module from remote caller.

#!/usr/bin/env node

/**
 * Example to call from caller
 * @see https://github.com/realglobe-Inc/sugo-caller
 */
'use strict'

const co = require('co')
const assert = require('assert')
const sugoCaller = require('sugo-caller')

co(function * () {
  let caller = sugoCaller('http://my-sugo-cloud.example.com/callers', {})
  let actor = caller.connect('my-actor-01')

  // Access to the module
  let say = actor.say()

  // Send ping
  let pong = yield say.ping()
  assert.ok(pong)

  // List available voices
  let voices = yield say.voices()
  console.log(voices)

  // Speech text
  say.say('Hi, there', { voice: voices[ 0 ] })

}).catch((err) => console.error(err))

Methods

The following methods are available from remote callers for the module.

.voices() -> array

List available voices

.say(text, options)

Say texts

Param Type Description
text string Text to say
options Object Optional settings

.ping(pong) -> string

Test the reachability of a module.

Param Type Description
pong string Pong message to return

.assert() -> boolean

Test if the actor fulfills system requirements

License

This software is released under the Apache-2.0 License.

Links

Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (11)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |