How to add two speech_recognition.AudioData objects - python speech recognition

Viewed 402

I would like to connect two recordings before using .recognize_google() I was googling for some time but I didn't find anything about adding these type of objects together.

How can I do that ?

import speech_recognition as sr


r = sr.Recognizer()
mic = sr.Microphone(device_index=0)
    
with mic as source:
    audio = r.record(source=source, duration=2)
    audio +=  # different r.record ( speech_recognition.AudioData )
try:
    result = r.recognize_google(audio, language=pkl[0][1])   
except Exception as ex:
        result = str(ex)

audio += audio

TypeError: unsupported operand type(s) for +=: 'AudioData' and 'AudioData'

0 Answers
Related