I am attempting to convert a .wav file, containing audio of someone talking, to a transcription of what was said. It is a mobile app so I am using React Native and expo go for development. The audio is sent to an azure HTTP trigger function where the audio (encoded as Base64) is decoded attempted to be used for azure's speech recognition. I have made sure that the sample rate, channel and sample width are all correct for the sdk.
def speech_recognize_continuous_from_file(audio_data):
speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
# ERROR OCCURS HERE: stream=audio_data does not work
audio_config = speechsdk.audio.AudioConfig(stream=audio_data)
speech_recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config, audio_config=audio_config)
def transcriptionFunction(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
try:
req_body = req.get_json()
audioBase64 = req_body.get('audioBase64')
# Converts base64 to wav
decodedAudio = base64.b64decode(audioBase64)
audioIO = io.BytesIO(decodedAudio)
# Begins transcription
speech_recognize_continuous_from_file(audioIO)
return func.HttpResponse("Check Server Console for response", status_code=200)
I have tested my speech recognizing continuous function with a .wav file so I know that works. I have also checked the right format of the .wav file which is correct. Due to this being a serverless function, I cannot use filename= as there is no local storage.

