how to write python code to capture voice in android device

69 Views Asked by At

I wrote some code to capture voice from mic using pyaudio and speech_recognition. When I tried to execute it in my smartphone, it said pyaudio not supported.

The code I wrote listens and records the mic until silence period of 0.5 seconds.

But I believe, in practice running python in android box is easier then running it in laptop. That's why I need to run my code in a small and cheap box such as an android box.

I tried:

import pyaudio
from multiprocessing import Queue
from threading import Thread
import subprocess
import time
from googletrans import Translator 
import speech_recognition as sr 

......

with sr.Microphone() as source:       
    r.pause_threshold = 0.5
    audio = r.listen(source)
    queue.put(audio)
0

There are 0 best solutions below