NaturalReaderSpeech

javadoc

Examples:


#file : service/NaturalReaderSpeech.py edit raw
#########################################
# NaturalReaderSpeech.py
# description: Natural Reader based speech service.
# categories: speech
# more info @: http://myrobotlab.org/service/NaturalReaderSpeech
#########################################


# cycle through NaturalReaderSpeech voices
# with i2c connected jaw servo
# Author: Acapulco Rolf
# Date: October 4th 2017
# Build: myrobotlab development build version 2555

from time import sleep
from org.myrobotlab.service import Speech
lang="EN" #for NaturalReaderSpeech
Voice="Ryan"
voiceType = Voice

# start the service
speech = Runtime.start("Speech", "NaturalReaderSpeech")
speech.setVoice(voiceType)
speech.setLanguage(lang)

# 50 Hz servo frequency
frequency	=  50

adaFruit16c1 = Runtime.createAndStart("AdaFruit16C1","Adafruit16CServoDriver")
raspi = Runtime.createAndStart("RasPi","RasPi")
adaFruit16c1.setController("RasPi","1","0x40")
adaFruit16c1.setPWMFreq(0,frequency)

jawPin = 8
jawServo = Runtime.createAndStart("jaw","Servo")
mouth = Runtime.createAndStart("Mouth","MouthControl")
sleep(20) # fix for servo attach timing issue as at myrobotlab 236x development builds

jawServo.attach(adaFruit16c1,jawPin,150,-1)
jaw = mouth.getJaw()
sleep(1)
jaw.attach(adaFruit16c1,jawPin)

jawServo.setMinMax(140,180) # set min and max jaw position accordingly for your own use-case
			    # these min/max settings work for me for this particular jaw: https://www.thingiverse.com/thing:992918
			    # @Mats, thanks :)
jawServo.setRest(175)
jawServo.moveTo(100)
jawServo.rest()
mouth.setmouth(140,175)
mouth.autoAttach = False
mouth.setMouth(speech)


def onEndSpeaking(text):
	sleep(.5)
	#Start of main script
	sleep(1)
	speech.speakBlocking(text)
	mouth.jaw.moveTo(175)


def saystuff():
	myvoices = ['Ryan','Rich','Mike','Graham','Laura','Charles','Crystal','Heather','Ella','Rod','Peter','Audrey','Lucy','Rachel','Rosy','Ryan']
	myvoicescount = len(myvoices)
	for i in range(0,myvoicescount):
		speech.setVoice(myvoices[i])
		onEndSpeaking ("I'm completely operational, and all my circuits are functioning perfectly.")


saystuff()

hairygael's picture

Gee Grog!!Since today

Gee Grog!!

Since today 06/11/2017 NaturalReaderSpeech doesn't work anymore.

Last night it was still working fine.

Did something happen while I was sleeping?

Ahaha!

I get this:

22:31:49.481 [python.interpreter.2] INFO  c.myrobotlab.audio.AudioProcessor - playing file : audioFile\NaturalReaderSpeech\Ryan\5f19b1b551d53aecf279dbd9317987f4.mp3  mode : blocking trackId : 1510003909481004
22:31:49.560 [default:track] INFO  c.myrobotlab.service.AudioFile - Audio File publishAudioEnd
22:31:49.560 [default:track] INFO  c.myrobotlab.audio.AudioProcessor - notifying others
22:31:49.562 [python.input] INFO  c.myrobotlab.framework.Service - Start listening event seen.
22:31:49.693 [New I/O worker #16] WARN  c.myrobotlab.codec.ApiFactory - msg . --> runtime.getEnvironments() - 1510003909693

 

GroG's picture

Same thing as Google,

Same thing as Google, Acapela, and many others ..  they changed the interface, require a token, and requie payment for access.

This will continue, until we get funds and infrastructure to purchase a communal license, or we focus on improving MaryTTS.