Ask coding questions

← Back to all posts
can't figure out how to make this work
OneOwen (1)

I'm using a Chromebook to code (not gonna code on IPhone, or a tablet, since i do not have a windows computer)

Comments
hotnewtop
IcynDevz (765)

Solution


Remember to put a colon : after the with srn.Microphone() as source.

So the final code is

import speech_recognition as srn

r = srn.Recognizer()

with srn.Microphone() as source:
  print('Hi I am your personel smart assistant')
  audio = r.listen(source)
  voice_data = r.recognize_google(audio)
  print(voice_data)
Chocolate16 (36)

on line 5 at the end of line ou forget ":"
withsrn.Microphone() as sourse:

OneOwen (1)

I did that now and it doesn't work still @Chocolate16