简体   繁体   English

使用SL4A在Python中获取声音幅度

[英]Get sound amplitude in Python with SL4A

I want to record sound for 1 second using a Python written app for SL4A and then find the max amplitude of the sound. 我想使用Python编写的SL4A应用程序录制声音1秒钟,然后找到声音的最大振幅。

Is there any part of the SL4A API I can use or part of the Python APIs that can be used? 我可以使用SL4A API的任何部分,还是可以使用的Python API的一部分?

You can record using the MediaRecorderFacade 您可以使用MediaRecorderFacade进行录制

http://www.mithril.com.au/android/doc/MediaRecorderFacade.html http://www.mithril.com.au/android/doc/MediaRecorderFacade.html

you can try this 你可以试试这个

droid.recorderStartMicrophone("/sdcard/myfile.wav")
sleep(1)
droid.recorderStop()

I hope there is a module to do some treatment on wave file in python. 我希望有一个模块可以对python中的wave文件进行一些处理。

If you find one you can compile and install. 如果找到一个,则可以编译并安装。

Here is a doc to do it: http://code.google.com/p/android-scripting/wiki/FAQ#Can_I_install_other_Python_modules ? 这是执行此操作的文档: http : //code.google.com/p/android-scripting/wiki/FAQ#Can_I_install_other_Python_modules吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM