TL; DR:我的应用正在占用用户的麦克风.当其他应用需要使用麦克风时,我可以自动将其关闭吗?
我有一个Android应用程序,有一些非常酷的麦克风功能,类似于亚马逊Alexa,一直在后台服务.问题是,我的应用程序占用了用户的麦克风,使其无法使用:
但是,这对我来说是一种糟糕的应用行为,我想尽力避免它.当另一个应用程序请求使用麦克风时,是否可以通知我,以便我可以自动停止我的服务?
PS:我正在使用Pocketsphinx库进行连续的背景语音识别.
这可能会被标记为重复,但我没有运气,所以我们走了.
我正在尝试用Python2.7开发一个像"Jarvis"这样的设置.我想要使用Pocketsphinx作为其中的一部分.我试图做到这一点我的Windows 10的机器上,但Pocketsphinx需要痛饮,那完全的失败在Windows 10机器(我还在上).所以,我搬到了我的树莓派零上,因为这是无论如何,我将寻求实际的计划.
我让Swig安装得很好.没有Windows 10的问题.然后我试着安装Pocketsphinx,事情就下来了.稍微安装失败.我读到我需要为2.7下载python开发人员.完成了,事情似乎进展顺利.我在屏幕上滚动了一堆东西,看起来它可能正常工作.不.那是我得到这个的时候:
deps/sphinxbase/src/libsphinxad/ad_pulse.c:44:30:致命错误:pulse/pulseaudio.h:没有这样的文件或目录
编译终止.
错误:命令'arm-linux-gnueabihf-gcc'因退出状态1而失败
清理...命令/ usr/bin/python -c"import setuptools,tokenize; file ='/ tmp/pip-build-Wt0cIJ/pocketsphinx/setup.py'; exec(compile(getattr(tokenize,'open') ,打开)(文件).read().replace('\ r \n','\n'),file,'exec'))"install --record/tmp/pip-UOA_Nf-record/install-record .txt --single-version-external-managed --compile失败,错误代码为1/tmp/pip-build-Wt0cIJ/pocketsphinx Traceback(最近一次调用最后一次):文件"/ usr/bin/pip",第9行,在load_entry_point('pip == 1.5.6','console_scripts','pip')()文件"/usr/lib/python2.7/dist-packages/pip/init.py",第248行,主要return command.main(cmd_args)文件"/usr/lib/python2.7/dist-packages/pip/basecommand.py",第161行,主文本='\n'.join(complete_log)UnicodeDecodeError:'ascii'编解码器无法解码位置51的字节0xe2:序数不在范围内(128)
我今天看错了,我有点厌烦.有谁知道我的线索?我承认我仍然刚刚开始编程世界,但这让我的大脑开始嘶嘶作响.
我有一个 Python 脚本,使用 Speech_recognition 包来识别语音并返回所说内容的文本。然而,转录有几秒钟的延迟。是否有另一种方法可以编写此脚本以在说出每个单词时返回它?我有另一个脚本来执行此操作,使用 pysphinx 包,但结果非常不准确。
安装依赖:
pip install SpeechRecognition
pip install pocketsphinx
Run Code Online (Sandbox Code Playgroud)
脚本 1 - 延迟语音到文本:
import speech_recognition as sr
# obtain audio from the microphone
r = sr.Recognizer()
with sr.Microphone() as source:
print("Please wait. Calibrating microphone...")
# listen for 5 seconds and create the ambient noise energy level
r.adjust_for_ambient_noise(source, duration=5)
print("Say something!")
audio = r.listen(source)
# recognize speech using Sphinx
try:
print("Sphinx thinks you said '" + r.recognize_sphinx(audio) + "'")
except sr.UnknownValueError:
print("Sphinx could not understand audio") …Run Code Online (Sandbox Code Playgroud) python speech-recognition speech-to-text cmusphinx pocketsphinx
我正在尝试制作一个可以录制音频并使用PyAudio,SpeechRecognition和PocketSphinx将其翻译成英文文本的Python应用程序.我正在运行Mac OS X El Capitan,版本10.11.2.
按照像这个和其他人的教程,我已经下载了PyAudio版本0.2.9,SpeechRecognition以及PocketSphinx.我已将它们安装到Conda环境中.我按照这个说明网站使用brew install swig git python我的OS X,希望它能帮助.
这是我的代码:
# Load packages
import speech_recognition as sr
import sphinxbase
import pocketsphinx
# obtain audio from the microphone
r = sr.Recognizer()
with sr.Microphone() as source:
print("Say something!")
audio = r.listen(source)
# write audio to a WAV file
with open("microphone-results.wav", "wb") as f:
f.write(audio.get_wav_data())
Run Code Online (Sandbox Code Playgroud)
到目前为止,事情进展顺利.我可以录制和播放我的WAV文件没问题.但这里出了问题......
r = sr.Recognizer()
with sr.AudioFile('microphone-results.wav') as source:
audio = r.record(source) # read the entire audio file
try:
print("You said …Run Code Online (Sandbox Code Playgroud) python speech-recognition speech-to-text pyaudio pocketsphinx
我正在构建一个语音识别Android应用程序,它将充当虚拟个人助理,其任务如下:
预约/提醒
天气信息
对Wolfram的一般查询| Alpha /维基百科 - (即谁指导了捉鬼敢死队,是什么 - £汇率)
我的问题是要使用Pocketsphinx还是谷歌API?
最初我用"android.speech.RecognitionListener"设置它,效果很好,但是我想实现关键字定位,这样用户除了说话之外不需要任何交互.
显然谷歌API不支持这一点,所以我考虑使用pocketsphinx为此,并仍然使用谷歌的应用程序的其余部分(因为我听说pocketphinx不是那么准确吗?)然而,两个不相处,因为他们可以两者都不会同时占用麦克风.
有没有一种很好的方式在识别器之间切换?(甚至不能同时导入同一个项目)
我应该使用pocketshinx并处理较低的准确度吗?
建议会有所帮助
干杯
我得到这样的东西.任何人都可以告诉我如何解决这个问题.
C:\Users\krush\Documents\ML using Python>pip install pocketsphinx
Collecting pocketsphinx
Using cached pocketsphinx-0.1.3.zip
Building wheels for collected packages: pocketsphinx
Running setup.py bdist_wheel for pocketsphinx: started
Running setup.py bdist_wheel for pocketsphinx: finished with status 'error'
Complete output from command C:\Users\krush\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\krush\\AppData\\Local\\Temp\\pip-build-cns2i_wb\\pocketsphinx\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\krush\AppData\Local\Temp\tmp3tyvnl9wpip-wheel- --python-tag cp36:
running bdist_wheel
running build_ext
building 'sphinxbase._ad' extension
swigging swig/sphinxbase/ad.i to swig/sphinxbase/ad_wrap.c
swig.exe -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/win32 -Ideps/sphinxbase/swig -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
error: command 'swig.exe' failed: No …Run Code Online (Sandbox Code Playgroud) 我想在 Node.JS 中测试Pocketsphinx。它说我需要安装 Swig 3.0.7 或更高版本。
我想我正确安装了所有其他依赖项。我现在甚至可以在终端中输入 Swig 命令,但是每次运行时我都会收到此错误npm install pocketsphinx:
CMake Error at /usr/local/Cellar/cmake/3.6.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find SWIG (missing: SWIG_DIR) (Required is at least version
"3.0.7")
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.6.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
/usr/local/Cellar/cmake/3.6.3/share/cmake/Modules/FindSWIG.cmake:75 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:4 (find_package)
Run Code Online (Sandbox Code Playgroud)
我试过brew install swig, npm install swig, 和npm install -g swig。我尝试转到swig 下载页面并按照安装说明进行操作,但我似乎没有采取任何措施阻止错误发生。顺便说一下,我正在 Macbook 上尝试这个。
我真的不知道我在这里做什么。我只是想测试 Pocketsphinx,现在我已经在 4 个不同的地方安装了 Swig,而 CMake 似乎无法识别其中任何一个。
任何帮助都会很棒!
我正在尝试从 clojure 运行pocketsphinx。我编写了以下 .sh 脚本
unbuffer pocketsphinx_continuous -innmic yes > pipe 我想使用(shell/sh)调用这个过程。
Unbuffer 允许 Pocketsphinx 正确地将其数据刷新到可以逐行读取的管道中。
我遇到的问题是我不知道如何正确终止进程。它将永远运行并且永远不会返回控制权。如果我杀死它正在运行的线程,则 sh 命令产生的进程仍然运行。我能想到的唯一的事情是运行kill在pid
我试图安装Phonetisaurus(使用碧玉安装说明这里).不幸的是,我遇到了一个我无法解决的依赖问题.
当我运行命令时,sudo apt-get -t experimental install phonetisaurus m2m-aligner mitlm libfst-tools我得到以下输出:
Reading package lists... done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
m2m-aligner …Run Code Online (Sandbox Code Playgroud) 我想为pocketsphinx创建一个包装器,但是我没有使用C的经验,所以我需要你的帮助,我知道PInvoke是一种方法,但是还有另一个问题,例如pocketsphinx的C运行时,我'我没有要求代码,我要求一个简单的指导方针来创建包装器,无论如何,谢谢.