Microphone Google Cloud transcription has error with expected words (Actually I didn't put any words for 'expected words')

Actually I set up Google Cloud speech-to-text API for both Pavlovia and local use. However, it doesn’t work.

Here’s the whole error list. (No matter I put words in the ‘Expected words’ or not, the error is the same if I run the program locally.

Alert 4330: Recording device ‘None’ not found, using default device instead.
For more info see https://docs.psychopy.org/alerts/4330.htmlAlert 4330: Recording device ‘None’ not found, using default device instead.
For more info see https://docs.psychopy.org/alerts/4330.html## Running: E:\Stroop\Color_stroop_speech\free_color_Stroop\free_vocalStroop_2024_lastrun.py ##
78291.6520 INFO Loaded monitor calibration from [‘2023_09_15 01:27’]
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. Contribute - pygame wiki
PTB-INFO: Using modified PortAudio V19.7.0-devel, revision unknown
PTB-INFO: New audio device 7 with handle 0 opened as PortAudio stream:
PTB-INFO: For 1 channels Capture: Audio subsystem is Windows WASAPI, Audio device name is Microphone (3- USB Microphone)
PTB-INFO: Real samplerate 16000.000000 Hz. Input latency 8.000000 msecs, Output latency 0.000000 msecs.
2.5136 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use [‘sounddevice’, ‘PTB’, ‘pyo’, ‘pygame’] (in that order).
Alert 4615: Chosen transcriber ‘google’ requires an API key, please supply one in Preferences.
1.3430 WARNING Monitor specification not found. Creating a temporary one…
ioHub Server Process Completed With Code: 0
For more info see https://docs.psychopy.org/alerts/4615.htmlTraceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\proto\message.py”, line 507, in init
pb_type = self._meta.fields[key].pb_type
KeyError: ‘expectedWords’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “E:\Stroop\Color_stroop_speech\free_color_Stroop\free_vocalStroop_2024_lastrun.py”, line 3162, in
run(
File “E:\Stroop\Color_stroop_speech\free_color_Stroop\free_vocalStroop_2024_lastrun.py”, line 1650, in run
micRespClip, micRespScript = micResp.bank(
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\microphone.py”, line 981, in bank
self.lastScript = self.lastClip.transcribe(
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\audioclip.py”, line 788, in transcribe
return transcribe(
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\transcribe.py”, line 824, in transcribe
return recognizeGoogle(
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\transcribe.py”, line 1060, in recognizeGoogle
return _googleCloudTranscriber.transcribe(audioClip, modelConfig=config)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\transcribe.py”, line 608, in transcribe
config=google.cloud.speech.RecognitionConfig(**params),
File “C:\Program Files\PsychoPy\lib\site-packages\proto\message.py”, line 512, in init
raise ValueError(
ValueError: Unknown field for RecognitionConfig: expectedWords
################ Experiment ended with exit code 1 [pid:12852] #################
78330.9891 INFO Loaded monitor calibration from [‘2023_09_15 01:27’]

image
However, if I run it online, it will show this error (I know this is a different error…)

For local voice recognition try Whisper.

For the Google recognition online, is the API key showing on your account?

Yes. I put the API key on Pavlovia. I think I did all the set-up operations following the YouTube tutorials. Do I need to do anything with the engine?

Thank you!

What I can see from the psychoJS file that psychoPy automatically generated:
“engine: soundAudioClip.Engine.GOOGLE” only appear one time, and no code appears in the JS file to connect with the API key from Google Cloud I put on Pavlovia.
I was wondering if there’s something else I missed because of the 2023 version of PsychoPy.

Thank you!

Did you ever figure this out? I am also getting the missing key for engine error.

No. Nobody ever answered that question.