Halocode Speech recognition in Python


I’m trying to use Halocode Speech recognition in Python.
this code
halo.speech_recognition.start(halo.speech_recognition.SERVER_MICROSOFT, halo.speech_recognition.LAN_ENGLISH, 3)
halo.speech_recognition.get_error_message() reports “http client error”.

I also tried to include those line at the beginning, as stated in the docs, but I get the same error.
halo.speech_recognition.set_recognition_url(halo.speech_recognition.SERVER_MICROSOFT, “http://msapi.passport3.makeblock.com/ms/bing_speech/interactive”)
halo.speech_recognition.set_token(halo.speech_recognition.SERVER_MICROSOFT, “ed8xubrmidv”)

Any help welcome :slight_smile:



Hi domisol,

By passing directly from the Halocode. You seem to go through the “Sprite” and the “Cognitive Service” extension

import event, halo, time
halo.speech_recognition.set_recognition_address(url = “{NAVIGATEURL}”)
halo.speech_recognition.set_access_token(token = “{ACCESSTOKEN}”)

def on_start():
halo.wifi.start(ssid = ‘SSID???’, password = ‘PW???’, mode = halo.wifi.WLAN_MODE_STA)
while not halo.wifi.is_connected():

halo.led.show_ring('white white black black black white black black black white white white')

def on_button_pressed():
halo.led.show_all(211, 145, 32)
halo.speech_recognition.begin(1, ‘english’)
if str(halo.speech_recognition.get_result_code()).find(str(‘blue’)) > -1:
halo.led.show_all(4, 164, 255)
if str(halo.speech_recognition.get_result_code()).find(str(‘red’)) > -1:
halo.led.show_all(253, 0, 0)


In graph


Thank you Crackel for time to have a look at my problem and help me.

However, I gave it a try, and the returned error is now “response timeout”.

To be clear, I’m using python in “https://python.mblock.cc/”, not the typical block system, because my program uses other python funcionalities which have nothing to do with speech recognition.
The tokens {NAVIGATEURL} and {ACCESSTOKEN} are also managed by the python system ?




Hi domisol,

I tried https://python.mblock.cc/ but I only saw the Cyberpi device so I left out. I don’t know how you use the Halocode but you seem more advanced than me …

Note: I grant you the python is more powerful with the blocks.


Well, really, it doesn’t matter if you use a halocode, and not a cyberpi, for me it works perfectly. If you need to escape from the block system, and have more freedom with python, give it a try, it’s not complicated.
Thanks again for your help


up :slight_smile:
I hope anyone from tech_support can have a look at this matter.