Search code examples
pythonaudiomicrophoneqpython

Record sound with Qpython


i am using QPython and i want to know if there is a way to record sound from my phone's microphone. I cant install speech_recognition or PyAudio in Qpython and i also cant find any tutorial out there. Any help is appreciated guys :D


Solution

  • This is an old question, but I might as well answer it for others searching the information.

    To access the functionalities of your phone with qpython, you must first import androidhelper() and create an object to represent your phone.

    Once this is done, you have access to multiple functions such as the ones you are looking for (recorderStartMicrophone and recorderStop).

    There is a simple script showing how to use it:

    import androidhelper
    droid = androidhelper.Android()
    
    droid.recorderStartMicrophone("Path/To/Where/You/Want/To/Save/The/Audio")
    #Do what you want. It might be a timer or another function.
    droid.recorderStop()
    

    There is a complete list of the functionalities included in androidhelper: http://kylelk.github.io/html-examples/androidhelper.html