Exemple #1
0
def test_funcs():
    print('Testing basic functions')
    ph = speech.translate('hello world')
    assert ph == ' /HEHLOW WERLD'
    speech.pronounce('PIHTHUN', pitch=32, speed=60, mouth=100, throat=150)
    speech.say('hello')
    speech.sing('YEHSTERDEY5')
def test_funcs():
    print('Testing basic functions')
    ph = speech.translate('hello world')
    assert ph == ' /HEHLOW WERLD'
    speech.pronounce('PIHTHUN', pitch=32, speed=60, mouth=100, throat=150)
    speech.say('hello')
    speech.sing('YEHSTERDEY5')
Exemple #3
0
def announce(phrase, destinationReached=0):
    speech.sing("um", speed=138, pitch=24)
    speech.sing("um", speed=138, pitch=24)
    microbit.sleep(250)
    speech.say(phrase)
    if destinationReached == 1:
        microbit.sleep(30)
        speech.sing("um", speed=75, pitch=48)
        microbit.sleep(1)
        speech.sing("um", speed=75, pitch=32)
        microbit.sleep(1)
        speech.sing("um", speed=75, pitch=24)
Exemple #4
0
def canta():
    enciende_farol()
    microbit.display.show(microbit.Image.MUSIC_QUAVERS)

    # The say method attempts to convert English into phonemes.
    speech.say("Puedo cantar!")
    microbit.sleep(1000)
    speech.say("Escuchame!")
    microbit.sleep(1000)

    # Clearing the throat requires the use of phonemes. Changing
    # the pitch and speed also helps create the right effect.
    speech.pronounce("AEAE/HAEMM", pitch=200, speed=100)  # Ahem
    microbit.sleep(1000)

    # Singing requires a phoneme with an annotated pitch for each syllable.
    solfa = [
        "#115DOWWWWWW",  # Doh
        "#103REYYYYYY",  # Re
        "#94MIYYYYYY",  # Mi
        "#88FAOAOAOAOR",  # Fa
        "#78SOHWWWWW",  # Soh
        "#70LAOAOAOAOR",  # La
        "#62TIYYYYYY",  # Ti
        "#58DOWWWWWW",  # Doh
    ]

    # Sing the scale ascending in pitch.
    song = ''.join(solfa)
    speech.sing(song, speed=100)
    # Reverse the list of syllables.
    solfa.reverse()
    song = ''.join(solfa)
    # Sing the scale descending in pitch.
    speech.sing(song, speed=100)

    microbit.display.show(microbit.Image.HAPPY)
    apaga_farol()
def voiceSing(phoneme):
    speech.sing(phoneme, speed=80, throat=myVoice.throat, mouth=myVoice.mouth)
Exemple #6
0
line1 = [
    '#26DEYYYYYYYYY', '#31ZIYIYIYIYIYIYIY', '#39DEYYYYYYYYY',
    '#52ZIYIYIYIYIYIYIY', '#46GIXV', '#42MIYIY', '#39YAOW', '#46AEAEAEN',
    '#39SERER', '#52DUXUXUXUXUXUXUXUXUXUXUXUX'
]

line2 = [
    '#35AYYYYYYMM', '#26/HAEAEAEAEAEAEF', '#31KREYYYYYYY',
    '#39ZIYIYIYIYIYIYIY', '#46AXLL', '#42FAOR', '#39DHER', '#35LUHUHUHV',
    '#31AXAXV', '#35YUXUXUXUXUXUXUXUXUXUX'
]

line3 = [
    '#31IHT', '#29WOWNT', '#31BIY', '#35ER', '#26STAYYYYY', '#31LIHSH',
    '#35MAE', '#39RIXIXIXIXIXIXIXIXIXIXIXIXIXJ', '#35AYY', '#31KAEAEAEAENT',
    '#39ER', '#46FAOAOAORD', '#39ER', '#46KAA',
    '#52RIXIXIXIXIXIXIXIXIXIXIXIXIXJ'
]

line4 = [
    '#52BUHT', '#39YUXUXL', '#31LUXK', '#35SWIYIYIYIYT', '#52ER',
    '#39PAAAAAAN', '#31ER', '#35SIYIYIYT', '#31UHV', '#29ER', '#26BAY',
    '#31SIH', '#39KUXL', '#35MEYYYYD', '#52FER', '#39TUXUXUXUXUXUXUXUXUXUXUX'
]

speech.sing(''.join(line1))
speech.sing(''.join(line2))
speech.sing(''.join(line3))
speech.sing(''.join(line4))
Exemple #7
0
# The say method attempts to convert English into phonemes.
speech.say("I can sing!")
sleep(1000)
speech.say("Listen to me!")
sleep(1000)

# Clearing the throat requires the use of phonemes. Changing
# the pitch and speed also helps create the right effect.
speech.pronounce("AEAE/HAEMM", pitch=200, speed=100)  # Ahem
sleep(1000)

# Singing requires a phoneme with an annotated pitch for each syllable.
solfa = [
    "#58DOWWWWWW",  # Doh
    "#62REYYYYYY",  # Re
    "#70MIYYYYYY",  # Mi
    "#78FAOAOAOAOR",  # Fa
    "#88SOHWWWWW",  # Soh
    "#94LAOAOAOAOR",  # La
    "#103TIYYYYYY",  # Ti
    "#115DOWWWWWW",  # Doh
]

# Sing the scale descending in pitch.
song = ''.join(solfa)
speech.sing(song, speed=100)
# Reverse the list of syllables.
solfa.reverse()
song = ''.join(solfa)
# Sing the scale ascending in pitch.
speech.sing(song, speed=100)
Exemple #8
0
from microbit import *

from speech import sing, say, translate

solfa = [
    "#115DOWWWWWW",  # Doh
    "#103REYYYYYY",  # Re
    "#94MIYYYYYY",  # Mi
    "#88FAOAOAOAOR",  # Fa
    "#78SOHWWWWW",  # Soh
    "#70LAOAOAOAOR",  # La
    "#62TIYYYYYY",  # Ti
    "#58DOWWWWWW",  # Doh
]

sing(''.join(solfa))
Exemple #9
0
        elif cmd == 'speech.translate':
            print(escape(speech.translate(unescape(params[1]))))
        elif cmd == 'speech.pronounce':
            speech.pronounce(unescape(params[1]), \
                    pitch=int(params[2]), speed=int(params[3]), \
                    mouth=int(params[4]), throat=int(params[5]))
            confirm()
        elif cmd == 'speech.say':
            gc.collect()
            speech.say(unescape(params[1]), \
                    pitch=int(params[2]), speed=int(params[3]), \
                    mouth=int(params[4]), throat=int(params[5]))
            confirm()
        elif cmd == 'speech.sing':
            speech.sing(unescape(params[1]), \
                    pitch=int(params[2]), speed=int(params[3]), \
                    mouth=int(params[4]), throat=int(params[5]))
            confirm()
        elif cmd == 'speaker.on':
            speaker.on()
            confirm()
        elif cmd == 'speaker.off':
            speaker.off()
            confirm()
        elif cmd == 'microphone.sound_level':
            print(microphone.sound_level())
# mbv2_end
        else:
            print('ERROR: Unknown command.')
    except Exception as e:
        print('EXCEPTION: ' + str(e))
Exemple #10
0
speech.say("I can sing!")
sleep(1000)
speech.say("Listen to me!")
sleep(1000)

# Clearing the throat requires the use of phonemes. Changing
# the pitch and speed also helps create the right effect.
speech.pronounce("AEAE/HAEMM", pitch=200, speed=100)  # Ahem
sleep(1000)

# Singing requires a phoneme with an annotated pitch for each syllable.
solfa = [
    "#115DOWWWWWW",   # Doh
    "#103REYYYYYY",   # Re
    "#94MIYYYYYY",    # Mi
    "#88FAOAOAOAOR",  # Fa
    "#78SOHWWWWW",    # Soh
    "#70LAOAOAOAOR",  # La
    "#62TIYYYYYY",    # Ti
    "#58DOWWWWWW",    # Doh
]

# Sing the scale ascending in pitch.
song = ''.join(solfa)
speech.sing(song, speed=100)
# Reverse the list of syllables.
solfa.reverse()
song = ''.join(solfa)
# Sing the scale descending in pitch.
speech.sing(song, speed=100)
Exemple #11
0
from microbit import *
import music
import radio
import speech

radio.on()  #required to turn on bluetooth

#do two different variable, one to show the notes, the other to do the solfa
#notes change through left/right while solfa only plays when up
notes = ["E", "A", "D", "G", "B", "e"]
newNote = -1
solfa = [
    "#94PLAEYYY #94LOHWWWW #94IYIYIYIYIY #94NAATTTT",  # Mi/LOW E
    "#70PLAEYYY #70DHEHEH #70AEAEAEAE #70NAATTTT",  # La /  A
    "#52PLAEYYY #52DHEHEH #52DIYIYIYIY #52NAATTTTTT",  # Rey / D
    "#39PLAEYYY #39DHEHEH #39GIYIYIY #39NAATTTTTT",  # So / G
    "#31PLAEYYY #31DHEHEH #31BIYIYIY #31NAATTTTT",  # Ti / B
    "#23PLAEYY #23/HAYYYYY #23IYIYIYIY #23NAATTTTTT",  # Mi/ High E
]
display.show(Image.MUSIC_QUAVERS)

while True:
    incoming = radio.receive()
    if incoming != None and incoming != 'up':
        newNote = int(incoming)
        display.show(notes[newNote])
    if incoming == 'up' and newNote != -1:
        speech.sing(solfa[newNote])
def voiceSing(phoneme):
    speech.sing(phoneme,
                speed=80,
                throat=myVoice['throat'],
                mouth=myVoice['mouth'])
Exemple #13
0
from microbit import *
import speech

speech.sing("#46" + speech.translate("Twing"), speed=100)
speech.sing("#46" + speech.translate("Kul"), speed=100)
speech.sing("#31" + speech.translate("Twing"), speed=100)
speech.sing("#31" + speech.translate("Kul"), speed=100)
speech.sing("#28" + speech.translate("Lit"), speed=100)
speech.sing("#29" + speech.translate("Tul"), speed=100)
speech.sing("#31" + speech.translate("Star"), speed=200)
speech.sing("#35" + speech.translate("How"), speed=100)
speech.sing("#35" + speech.translate("Eye"), speed=100)
speech.sing("#37" + speech.translate("Wun"), speed=100)
speech.sing("#39" + speech.translate("Der"), speed=100)
speech.sing("#42" + speech.translate("What"), speed=100)
speech.sing("#42" + speech.translate("You"), speed=100)
speech.sing("#46" + speech.translate("Are"), speed=200)
speech.sing("#31" + speech.translate("Up"), speed=100)
speech.sing("#31" + speech.translate("Uh"), speed=100)
speech.sing("#35" + speech.translate("Buv"), speed=100)
speech.sing("#35" + speech.translate("The"), speed=100)
speech.sing("#37" + speech.translate("World"), speed=100)
speech.sing("#39" + speech.translate("So"), speed=100)
speech.sing("#42" + speech.translate("High"), speed=200)
speech.sing("#31" + speech.translate("Like"), speed=100)
speech.sing("#31" + speech.translate("Uh"), speed=100)
speech.sing("#35" + speech.translate("Die"), speed=100)
speech.sing("#35" + speech.translate("Mund"), speed=100)
speech.sing("#37" + speech.translate("In"), speed=100)
speech.sing("#39" + speech.translate("The"), speed=100)
speech.sing("#42" + speech.translate("Sky"), speed=200)