コード例 #1
0
# +croak or +whisper
# -a for amplitude (0 to 200)
# -s for speed 80 to 500
# -p for pitech 0 to 99

from picoh import picoh
import threading
from time import time, sleep, localtime, strftime
from random import randint

# Switch the speech synthesizer to epseak
picoh.setSynthesizer("espeak")

# Set the voice to english West Midlands accent medium speed.

picoh.setVoice("-ven-wm+m1 -s150")

#module level variable for breaking out of the blinking thread
blinking = False


#this is called on a separate thread to blink the eyes while running
def blinkLids():
    while (blinking):
        picoh.move(picoh.LIDBLINK, 0)
        sleep(0.2)
        picoh.move(picoh.LIDBLINK, 10)
        #wait for a random amount of time for realistic blinking
        sleep(randint(0, 4))

コード例 #2
0
ファイル: changingVoices.py プロジェクト: ohbot/picoh-python
# -s for speed 80 to 500
# -p for pitech 0 to 99

# ESPEAK-NG
# supports some of the ESPEAK but some is missing

# import the picoh module
from picoh import picoh

# Reset picoh
picoh.reset()

# Default synthesizer SAPI.  Default Voice as set in Control Panel
picoh.say("I.  I just took a ride")
# Quieter
picoh.setVoice("-a82")
picoh.say("In a silver machine.")
# Faster
picoh.setVoice("-r4")
picoh.say("And I'm still feeling mean.")
# Slower
picoh.setVoice("-r-4")
picoh.say("Do you wanna ride? See yourself going by.")
# American
picoh.setVoice("-vzira")
picoh.say("The other side of the sky.")
# Default voice
picoh.setVoice("")
picoh.say("I got a silver machine.")

# Switch to espeak-ng - some of the voice attributes aren't supported
コード例 #3
0
ファイル: changingVoices.py プロジェクト: ohbot/picoh-python
from picoh import picoh

import random

# Run 'say -v?' in Terminal to list options for voices. speechSpeed is 90 +.

picoh.reset()

picoh.say("Hi it is great to be here, i am finally running on a mac, wow")

picoh.wait(2)

picoh.setVoice("Karen")

picoh.setSpeechSpeed(150)

picoh.move(picoh.HEADTURN, random.randint(3, 6))

picoh.say("hello i am Karen")

picoh.setVoice("Alex")

picoh.setSpeechSpeed(90)

picoh.move(picoh.HEADTURN, random.randint(2, 6))

picoh.say("hello i am Alex slow")

picoh.setVoice("Oliver")

picoh.move(picoh.HEADTURN, random.randint(1, 6))
コード例 #4
0
ファイル: AzureSpeech.py プロジェクト: ohbot/picoh-python
from picoh import picoh

# A list of voices can be found here: https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support#text-to-speech
# You can register a free Azure account here: https://azure.microsoft.com/en-gb/free/

# Set up the Azure text to speech synth with your subscription key.
picoh.setSynthesizer('Azure', ID="################################")

# This will be spoken in the default Azure voice.
picoh.say("Woo now my voice comes from Azure")

# Change voice to MiaNeural
picoh.setVoice("MiaNeural")

picoh.say("My name is Mia")

# Change voice to HeatherRus and region to Canada.
picoh.setVoice("HeatherRUS", "en-CA")

picoh.say("And I am Heather")