cmusphinx / pocketsphinx-python Goto Github PK
View Code? Open in Web Editor NEWThis project forked from bambocher/pocketsphinx-python
Python module installed with setup.py
License: Other
This project forked from bambocher/pocketsphinx-python
Python module installed with setup.py
License: Other
how can i trained tidigits acoustic model with my own audiofiles?
missing mixture_weights file in the acoustic tidigits model.
i was tried to train my own accent audios for digits using cmu pocketsphinx.
i was struggled lot, in this part. no such file mixture_weights
./map_adapt
-moddeffn tidigits/hmm/mdef.txt
-ts2cbfn .cont.
-meanfn tidigits/hmm/means
-varfntidigits/hmm/variances
-mixwfn tidigits/hmm/mixture_weights
-tmatfn tidigits/hmm/transition_matrices
-accumdir .
-mapmeanfn en_in_own/means
-mapvarfn en_in_own/variances
-mapmixwfn en_in_own/mixture_weights
-maptmatfn en_in_own/transition_matrices
sphinx_fe -argfile tidigits/hmm/feat.params -samprate 16000 -c digits.fileids -di . -do . -ei wav -eo mfc -mswav yes
pocketsphinx_mdef_convert -text tidigits/hmm/mdef tidigits/hmm/mdef.txt
cp -a /usr/local/libexec/sphinxtrain/bw .
cp -a /usr/local/libexec/sphinxtrain/mk_s2sendump .
cp -a /usr/local/libexec/sphinxtrain/map_adapt .
cp -a /usr/local/libexec/sphinxtrain/mllr_solve .
./bw \
-hmmdir tidigits/hmm \
-moddeffn tidigits/hmm/mdef.txt \
-ts2cbfn .cont. \
-feat 1s_c_d_dd \
-cmn current \
-agc none \
-dictfn tidigits.dic \
-ctlfn digits.fileids \
-lsnfn digits.transcription \
-accumdir .
./mllr_solve \
-meanfn tidigits/hmm/means \
-varfn tidigits/hmm/variances \
-outmllrfn mllr_matrix -accumdir .
mkdir en_in_own
cp -a tidigits/hmm/ en_in_own
how to i resolve this issue. and then how to train with my own accent besed digits audios.
help me sir. i am begginer for this concept.
Thanks.
You have to use Indian English phonetic dictionary with this model and train Indian English g2p model with seq2seq
sir i didn't understand this meaning,
" train Indian English g2p model with seq2seq "
we have our en_in.dic (predefined Indian English phonetic dictionary) and then custom acoustic model (en_in_own).
And then we have a g2p model,
**```
wget -O g2p-seq2seq-cmudict.tar.gz https://sourceforge.net/projects/cmusphinx/files/G2P%20Models/g2p-seq2seq-model-6.2-cmudict-nostress.tar.gz/download
tar xf g2p-seq2seq-cmudict.tar.gz
```**
and,
G2P Models :
g2p-seq2seq-model-6.2-cmudict-nostress.tar.gz
g2p-seq2seq-model-6.2-pronasyl.tar.gz
g2p-seq2seq-model-5.2-cmudict.tar.gz
phonetisaurus-cmudict-split.tar.gz
fst:
it.tar.gz (Italian)
en_us_nostress.tar.gz (english)
zh.tar.gz(Mandarin)
ru.tar.gz (Russian)
nl.tar.gz (Dutch)
fr.tar.gz (French)
es.tar.gz (Spanish)
es_mx.tar.gz(Mexican Spanish)
de.tar.gz (German)
it is the seq2seq g2p model.not mension these particularly but what is meant by Indian English g2p model with seq2seq.
how can i train these indian English g2p model. i am really confused sir.
we take the wordlist is a text file with one word per line----> own_vocab.tmp.vocab
and run a below program,
**g2p-seq2seq --decode own_vocab.tmp.vocab --model_dir g2p-seq2seq-model-6.2-cmudict-nostress --output own.dic**
got own.dict i know these only sir.
how can i train Indian English g2p model with seq2seq. sir can you explain me sir?
@nshmyrev thank you so much sir.
I have installed pocketsphinx but not able to import the module.
I am using Ubuntu 16.04.
sudo -H pip install pocketsphinx
Requirement already satisfied (use --upgrade to upgrade): pocketsphinx in /usr/local/lib/python2.7/dist-packages/pocketsphinx-0.1.0-py2.7-linux-x86_64.egg
>>> from pocketsphinx.pocketsphinx import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pocketsphinx-0.1.0-py2.7-linux-x86_64.egg/pocketsphinx/__init__.py", line 32, in <module>
from .pocketsphinx import *
ImportError: No module named pocketsphinx
Is the module not compatible with Ubuntu 16.04?
Fails to install on Mac with the following error:
running install
Checking .pth file support in /Library/Python/2.7/site-packages/
/usr/bin/python -E -c pass
TEST PASSED: /Library/Python/2.7/site-packages/ appears to support .pth files
running bdist_egg
running egg_info
writing pocketsphinx.egg-info/PKG-INFO
writing top-level names to pocketsphinx.egg-info/top_level.txt
writing dependency_links to pocketsphinx.egg-info/dependency_links.txt
error: package directory 'sphinxbase/swig/python' does not exist
I checked if swig is installed and its installed in the Cellar directory as a homebrew tap
Any notes, pointers, or things to be wary about if using this in virtual environment on a Pi3? Any extra steps or particular place to run examples?
Currently the example can't import any modules. eg:
Traceback (most recent call last):
File "example.py", line 3, in <module>
from pocketsphinx.pocketsphinx import *
ImportError: No module named 'pocketsphinx.pocketsphinx'
Installed from github version. Pip refused to install. Thanks!
I was building this in the Linux 3.8 distro VM from OSBOXES (on VirtualBox), I noticed that I had to run python setup.py install twice. Installing it just once, I got the error message "cannot find module sphinxbase".
Specifically, here is the bash script I am using to build pocketsphinx-python (and all the dependencies) form source:
#!/bin/bash
apt update && apt install -y python python-dev python-pip build-essential swig git libpulse-dev bison
sudo -H pip install --upgrade pip && sudo -H pip install setuptools
git clone https://github.com/cmusphinx/sphinxbase.git
cd sphinxbase
./autogen.sh
./configure
make
make check
sudo make install
cd ..
git clone https://github.com/cmusphinx/pocketsphinx.git
cd pocketsphinx
./autogen.sh
./configure
make clean all
make check
sudo make install
cd ..
git clone --recursive https://github.com/cmusphinx/pocketsphinx-python/
cd pocketsphinx-python
sudo -H python setup.py install
sudo python setup.py install
Some more information:
OS: OSBoxes Linux Lite 3.8 (a Debian derivative)
Python Version: 2.7.12
Edit: The first time installation also fails to install pocketsphinx.pocketsphinx?
I looked in pip list
, and pocketsphinx does show up, but importing from pocketsphinx.pocketsphinx
did not work without the second sudo python setup.py install
command`
it gives error when i try python setup.py install
error: command 'swig.exe' failed: No such file or directory
from pocketsphinx.pocketsphinx import *
ImportError: No module named 'pocketsphinx.pocketsphinx'
I got the English model to work as I want it to. Next, I got the Spanish model from here. Basically, it contains a es.dict
, a cmusphinx-es-5.2
directory (equivalent to the en-us/en-us directory in the example from README.md
), and an es-20k.lm.gz
file (which I used the sphinxbase gunzip es-20k.lm.gz && sphinx_lm_convert -i es-20k.lm -o es.lm.bin
command to convert to the bin file).
Next, I recorded a Spanish phrase into a file called spanish.raw
Then, I formatted the python code as follows:
from os import environ, path
from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *
MODELDIR = "/home/osboxes/testsphinx/spanish"
DATADIR = "/home/osboxes/testsphinx/spanish"
# Create a decoder with certain model
config = Decoder.default_config()
config.set_string('-hmm', path.join(MODELDIR, 'es-es/model_parameters/voxforge_es_sphinx.cd_ptm_4000'))
config.set_string('-lm', path.join(MODELDIR, 'es.lm.bin'))
config.set_string('-dict', path.join(MODELDIR, 'es.dict'))
decoder = Decoder(config)
# Decode streaming data.
jsgf = Jsgf(path.join(DATADIR, 'grammar.gram'))
rule = jsgf.get_rule('test.sentence')
fsg = jsgf.build_fsg(rule, decoder.get_logmath(), 7.5)
fsg.writefile('fsg.fsg')
decoder = Decoder(config)
decoder.set_fsg('fsg', fsg)
decoder.set_search('test')
decoder.start_utt()
stream = open(path.join(DATADIR, 'spanish.raw'), 'rb')
while True:
buf = stream.read(1024)
if buf:
decoder.process_raw(buf, False, False)
else:
break
decoder.end_utt()
print ('Best hypothesis segments: ', [seg.word for seg in decoder.seg()])
The grammar.gram
file is as follows:
#JSGF V1.0;
grammar test;
public <sentence> = ( A palabras necias oídos sordos );
However, when I run the program, I get this error:
....
INFO: ngram_search_fwdflat.c(157): fwdflat: min_ef_width = 4, max_sf_win = 25
INFO: ngram_search_fwdtree.c(429): TOTAL fwdtree 0.00 CPU -nan xRT
INFO: ngram_search_fwdtree.c(432): TOTAL fwdtree 0.00 wall -nan xRT
INFO: ngram_search_fwdflat.c(176): TOTAL fwdflat 0.00 CPU -nan xRT
INFO: ngram_search_fwdflat.c(179): TOTAL fwdflat 0.00 wall -nan xRT
INFO: ngram_search.c(303): TOTAL bestpath 0.00 CPU -nan xRT
INFO: ngram_search.c(306): TOTAL bestpath 0.00 wall -nan xRT
INFO: fsg_search.c(227): FSG(beam: -1080, pbeam: -1080, wbeam: -634; wip: -26, pip: 0)
ERROR: "fsg_search.c", line 141: The word 'A' is missing in the dictionary
INFO: fsg_search.c(265): TOTAL fsg 0.00 CPU -nan xRT
INFO: fsg_search.c(268): TOTAL fsg 0.00 wall -nan xRT
Traceback (most recent call last):
File "test.py", line 22, in <module>
decoder.set_fsg('fsg', fsg)
File "/usr/local/lib/python2.7/dist-packages/pocketsphinx-0.0.9-py2.7-linux-x86_64.egg/pocketsphinx/pocketsphinx.py", line 384, in set_fsg
return _pocketsphinx.Decoder_set_fsg(self, name, fsg)
RuntimeError: Decoder_set_fsg returned -1
INFO: ngram_search_fwdtree.c(429): TOTAL fwdtree 0.00 CPU -nan xRT
INFO: ngram_search_fwdtree.c(432): TOTAL fwdtree 0.00 wall -nan xRT
INFO: ngram_search_fwdflat.c(176): TOTAL fwdflat 0.00 CPU -nan xRT
INFO: ngram_search_fwdflat.c(179): TOTAL fwdflat 0.00 wall -nan xRT
INFO: ngram_search.c(303): TOTAL bestpath 0.00 CPU -nan xRT
INFO: ngram_search.c(306): TOTAL bestpath 0.00 wall -nan xRT
....
Any idea what is causing this? I am assuming that since pocketsphinx-python is just a Swig wrapper interface (C -> Python), anything that is possible in standard pocketsphinx should also be possible in pocketsphinx-python.
Thanks for your help.
Hi, can you clarify if is it possible using pocketsphinx to decode explicit phoneme sequences (generated separately with my own acoustic model) into a sequence of words? It seems the Decoder must be mapping phonemes to words at some point, but it's not clear to me if there is a standalone function to do this. My acoustic model outputs 39 english phonemes, so I would like to use the provided language model and dictionary. Thanks.
returns me error:
Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/private/tmp/pip-build-flT_f6/pocketsphinx/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-jUdUPM-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-flT_f6/pocketsphinx/
Help please!
config.h and sphinx_config.h from the pocketsphinx-python/include directory are not included in the build path for the recursively-acquired sphinxbase causing it's build to fail. This is on OS X 10.10.4 with python 2.7.9 from homebrew.
Work around: Include the libraries manually. `pip install pocketsphinx --global-option=build_ext --global-option="-I./pocketsphinx-python/include" (Requires cloning the code)
is there any example where i can learn how to directly convert speech to text directly from microphone?
config = Decoder.default_config()
NameError: name 'Decoder' is not defined
Can someone just post me a code which takes input from microphone and converts to text? i have installed pocketsphinx and sphinxbase successfully.... I also have pyaudio installed
Hey
I am trying to install this on a system without root. I have the build tools necessary to build it although I am running into an issue similar to another python package I was installing. It is looking for the pulseaudio dev include files although it's looking system wide instead of my home/user folder where it is located.
deps/sphinxbase/src/libsphinxad/ad_pulse.c:44:10: fatal error: pulse/pulseaudio.h: No such file or directory
#include <pulse/pulseaudio.h>
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-pc-linux-gnu-gcc' failed with exit status 1
Duplicity is the other script I was using, they have in their setup.py a nice little variable called --librsync-dir
So you could run python setup.py install --user --librsync-dir=/home/user
and it would use your home path as the root for the include and lib folders, so like so /home/user/include /home/user/bin /home/user/lib64 /home/user/lib. I tried just copying it over from their setup.py into this setup.py but it didn't work for me. henrysher/duplicity/setup.py is where it is located. Would it be possible to get this to behave the same way in pocketsphinx so those who want to install locally can?
I didn't find the 'en-us-phone.lm.bin' model file in directory 'pocketsphix/model/', and i tried " config.set_string('-allphone', 'model/en-us/en-us-phone.lm.bin' " , and it didn't work. I got "RuntimeError: new_Decoder returned -1"
I'm trying to set the decoder into 8000 Hz sampling rate, but got output:
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
with below code:
import os
from pocketsphinx import DefaultConfig, Decoder, get_model_path, get_data_path
model_path = get_model_path()
data_path = get_data_path()
# Create a decoder with a certain model
config = DefaultConfig()
config.set_string('-hmm', 'stt.cd_ptm_200')
config.set_string('-lm', 'stt.lm.bin')
config.set_string('-dict', 'stt.dict')
config.set_string('-samprate', '8000')
decoder = Decoder(config)
# Decode streaming data
buf = bytearray(1024)
with open(os.path.join(data_path, 'goforward.raw'), 'rb') as f:
decoder.start_utt()
while f.readinto(buf):
decoder.process_raw(buf, False, False)
decoder.end_utt()
print('Best hypothesis segments:', [seg.word for seg in decoder.seg()])
Can you help me figure out how to live stream mic input into the python program? I'm trying to figure out if I can use gstreamer somehow with the example.py but I'm having a hard time.
Thanks
I got start and end frame using:
result = [{'word': seg.word, 'begin': seg.start_frame, 'end': seg.end_frame} for seg in decoder.seg()]
now i want begin and end in second, how do i do that?
-Sir I didn't integrete for custom en-in Acoustic Model(Adapting the default acoustic model-Indian English) and custom Language Model.
i was download a acoustic model from this link:
i follow the instruction this link: https://cmusphinx.github.io/wiki/tutorialam/
sphinx_fe -argfile en_in/feat.params -samprate 16000 -c audio.fileids -di . -do . -ei wav -eo mfc -mswav yes
pocketsphinx_mdef_convert -text en_in/mdef en_in/mdef.txt
cp -a /usr/local/libexec/sphinxtrain/bw .
cp -a /usr/local/libexec/sphinxtrain/mk_s2sendump .
cp -a /usr/local/libexec/sphinxtrain/map_adapt .
cp -a /usr/local/libexec/sphinxtrain/mllr_solve .
./bw
-hmmdir en_in
-moddeffn en_in/mdef.txt
-ts2cbfn .cont.
-feat 1s_c_d_dd
-cmn current
-agc none
-dictfn en_in.dic
-ctlfn audio.fileids
-lsnfn audio.transcription
-accumdir .
./mllr_solve
-meanfn en_in/means
-varfn en_in/variances
-outmllrfn mllr_matrix -accumdir .
cp -a en_in en_in_own
./map_adapt
-moddeffn en_in/mdef.txt
-ts2cbfn .cont.
-meanfn en_in/means
-varfn en_in/variances
-mixwfn en_in/mixture_weights
-tmatfn en_in/transition_matrices
-accumdir .
-mapmeanfn en_in_own/means
-mapvarfn en_in_own/variances
-mapmixwfn en_in_own/mixture_weights
-maptmatfn en_in_own/transition_matrices
./mk_s2sendump
-pocketsphinx yes
-moddeffn en_in_own/mdef.txt
-mixwfn en_in_own/mixture_weights
-sendumpfn en_in_own/sendump
pocketsphinx_continuous -hmm en_in_own -lm en-us.lm.bin -dict en_in.dic -infile 38.wav > 4.txt
it is working but not predicting a particular words. words is relevant to banking sectors.so i build again own language model using language model build tool (Building a simple language model using a web service)
own language model: lm.dict & lm.bin:
transcript file: own_vocab.txt
sphinx_lm_convert -i own.lm -o own.lm.bin
sphinx_lm_convert -i own.lm.bin -ifmt bin -o own.lm -ofmt arpa
pocketsphinx_continuous -inmic yes -lm own.lm.bin -dict own.dic
sir, it is working fine. detecting that particular words. but one confusion,
which default acoustic model it takes to run on that command " pocketsphinx_continuous -inmic yes -lm own.lm.bin -dict own.dic" ?
but i integrete these two AM and LM, and run on,
pocketsphinx_continuous -hmm en_in_own -lm own.lm.bin -dict own.dic -infile 1.wav > result_own.txt
it was not return any words. and it shows error. phone words dict in the LM not present in the AM.
INFO: dict.c(333): Reading main dictionary: lm_model_resources/other/own.dic
ERROR: "dict.c", line 195: Line 5: Phone 'EH' is mising in the acoustic model; word 's' ignored
ERROR: "dict.c", line 195: Line 6: Phone 'EH' is mising in the acoustic model; word 's' ignored
ERROR: "dict.c", line 195: Line 7: Phone 'EY' is mising in the acoustic model; word 'a' ignored
ERROR: "dict.c", line 195: Line 8: Phone 'EY' is mising in the acoustic model; word 'able' ignored
ERROR: "dict.c", line 195: Line 9: Phone 'AH' is mising in the acoustic model; word 'about' ignored
ERROR: "dict.c", line 195: Line 10: Phone 'AE' is mising in the acoustic model; word 'absolutely' ignored
but some how i identify the issue. what it is, phone words(own.dict) EH, EY, AH, AE always presents in the en_in acoustic model(INDIAN ENGLISH mdef phones) also but it is in SMALL CASE.(en_in/ mdef file).
BUT OTHER ENGLISH mdef phones like wsj_all_cd30.mllt_cd_cont_4000, hub4_cd_continuous_8gau_1s_c_d_dd,
Columns definitions
#base lft rt p attrib tmat ... state id's ...
SIL - - - filler 0 0 1 2 N
UNK - - - n/a 1 3 4 5 N
aa - - - n/a 2 6 7 8 N
ae - - - n/a 3 9 10 11 N
ah - - - n/a 4 12 13 14 N
i tried something own.dic phones into small case but it was not reflect both AM & LM.
Basically that LM tool gives these kind of structure words and phones. it is affecting acoustic model model. these two not sync.
i tried another way something to create a own.lm.bin & own.dic also
Build an other way LM:
text2wfreq < own_vocab.txt | wfreq2vocab > own_vocab.tmp.vocab
text2idngram -vocab own_vocab.tmp.vocab -idngram own_vocab.idngram < own_vocab.txt
idngram2lm -vocab_type 0 -idngram own_vocab.idngram -vocab own_vocab.tmp.vocab -arpa own.lm
sphinx_lm_convert -i own.lm -o own.lm.bin
Build a own.dic an other way:
i was followed these link: &
g2p-seq2seq --decode own_vocab.tmp.vocab --model_dir g2p-seq2seq/g2p-seq2seq-model-6.2-cmudict-nostress --output own.dic
pocketsphinx_continuous -lm own.lm.bin -dict own.dic -infile 10.wav > 10.txt
it is working fine to predicting a particular words but that confusion is,
which acoustic model is combined to run on that command "pocketsphinx_continuous -lm own.lm.bin -dict own.dic -infile 10.wav > 10.txt"
but i integrete these two AM and LM, and run on,
pocketsphinx_continuous -lm own.lm.bin -dict own.dic -infile 10.wav > 10.txt -hmm en_in_own
Again it was return the same error. it was not display any text. the error log is,
INFO: dict.c(333): Reading main dictionary: lm_model_resources/other/own.dic
ERROR: "dict.c", line 195: Line 5: Phone 'EH' is mising in the acoustic model; word 's' ignored
ERROR: "dict.c", line 195: Line 6: Phone 'EH' is mising in the acoustic model; word 's' ignored
ERROR: "dict.c", line 195: Line 7: Phone 'EY' is mising in the acoustic model; word 'a' ignored
ERROR: "dict.c", line 195: Line 8: Phone 'EY' is mising in the acoustic model; word 'able' ignored
ERROR: "dict.c", line 195: Line 9: Phone 'AH' is mising in the acoustic model; word 'about' ignored
ERROR: "dict.c", line 195: Line 10: Phone 'AE' is mising in the acoustic model; word 'absolutely' ignored
LM tool produced dict(word-phone) format:
A AH
A(2) EY
ABLE EY B AH L
ABOUT AH B AW T
ABSOLUTELY AE B S AH L UW T L IY
LM g2p-seq2seq produced dict(word-phone) format:
s EH S
s EH S
a EY
able EY B AH L
about AH B AW T
absolutely AE B S AH L UW T L IY
en_in_own mdef phones structure:
ia f aa s n/a 20 2023 2038 2063 N
ia f ae e n/a 20 2023 2038 2063 N
ia f ae s n/a 20 2023 2038 2063 N
ia f ah e n/a 20 2023 2038 2063 N
ia f ah s n/a 20 2023 2038 2063 N
ia f ao e n/a 20 2023 2038 2063 N
ia f ao s n/a 20 2023 2038 2063 N
ia f aw e n/a 20 2023 2038 2063 N
really is those small case was an issue or not? i was not able to predict this issue.
Sir How can i fix this issue?
i didn't integrete for custom en-in AM and custom LM, ERROR: "dict.c", Phone 'AE' is mising in the acoustic model; word 'absolutely' ignored
hi,
I am building an acoustic model using link https://cmusphinx.github.io/wiki/tutorialam/ . I am getting following error while training the model-
ERROR: "model_def_io.c", line 413: Unable to open /home/kajal/ac_mo/model_architecture/ac_mo.1000.mdef for reading: No such file or directory
INFO: senone.c(210): Reading senone mixture weights: /home/kajal/ac_mo/model_parameters/ac_mo.cd_semi_1000_delinterp/mixture_weights
FATAL: "senone.c", line 213: fopen(/home/kajal/ac_mo/model_parameters/ac_mo.cd_semi_1000_delinterp/mixture_weights,rb) failed
Mon Jul 10 09:35:30 2017
Please help
Running a fresh installation via pip install pocketsphinx
and copy pasting the basic usage example to make sure all is good. I noticed that the \site-packages\pocketsphinx
folder does not contain a test\data
as would be implied from the DATADIR = "pocketsphinx/test/data"
in the basic usage example. As a result the code will run error out at stream = open(path.join(DATADIR, 'goforward.raw'), 'rb')
.
Perhaps the example should be updated to properly reflect the current instillation? Not sure if this repository is still being actively developed/used.
i googled a code and integrate into example, but after speak "How are you?" in 3 seconds, the result return ('Best hypothesis segments: ', ['<s>', 'huh'])
is below code the correct way to record as raw file in python 2.7?
#!/usr/bin/env python
from os import environ, path
import pyaudio
import wave
from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *
MODELDIR = r"C:\Users\martlee2\Downloads\pocketsphinx\model"
DATADIR = r"C:\Users\martlee2\Downloads\pocketsphinx\test\data"
# Create a decoder with certain model
config = Decoder.default_config()
config.set_string('-hmm', path.join(MODELDIR, 'en-us/en-us'))
config.set_string('-lm', path.join(MODELDIR, 'en-us/en-us.lm.bin'))
config.set_string('-dict', path.join(MODELDIR, 'en-us/cmudict-en-us.dict'))
decoder = Decoder(config)
FORMAT = pyaudio.paInt16
#CHANNELS = 2
CHANNELS = 1
#RATE = 44100
RATE = 16000
#CHUNK = 1024
CHUNK = int(RATE / 10)
RECORD_SECONDS = 3
#WAVE_OUTPUT_FILENAME = path.join(DATADIR, 'voice.wav')
WAVE_OUTPUT_FILENAME = path.join(DATADIR, 'voice.raw')
p = pyaudio.PyAudio()
stream = p.open(format=FORMAT,
channels=CHANNELS,
rate=RATE,
input=True,
frames_per_buffer=CHUNK)
print("* recording")
frames = []
for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):
data = stream.read(CHUNK)
frames.append(data)
print("* done recording")
stream.stop_stream()
stream.close()
p.terminate()
#wf = wave.open(WAVE_OUTPUT_FILENAME, 'wb')
#wf.setnchannels(CHANNELS)
#wf.setsampwidth(p.get_sample_size(FORMAT))
#wf.setframerate(RATE)
#wf.writeframes(b''.join(frames))
#wf.close()
with open(WAVE_OUTPUT_FILENAME , 'w') as the_file:
the_file.write(b''.join(frames))
# Decode streaming data.
decoder = Decoder(config)
decoder.start_utt()
#stream = open(path.join(DATADIR, 'goforward.raw'), 'rb')
stream = open(path.join(DATADIR, 'voice.raw'), 'rb')
while True:
buf = stream.read(1024)
if buf:
decoder.process_raw(buf, False, False)
else:
break
decoder.end_utt()
print ('Best hypothesis segments: ', [seg.word for seg in decoder.seg()])
Hey
Someone an idea how to get this running on a Raspberry Pi 3?
Right now i am getting the error "SIZEOF_LONG" redefined...
Got this error:
error: command 'swig.exe' failed: No such file or directory
This is with Python 3.6.8.
Traceback (most recent call last):
File "/home/shamoon/.local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/home/shamoon/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/home/shamoon/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/shamoon/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/shamoon/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/shamoon/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/shamoon/.local/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/shamoon/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/shamoon/.local/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/shamoon/.local/lib/python3.6/site-packages/pipenv/cli/command.py", line 254, in install
editable_packages=state.installstate.editables,
File "/home/shamoon/.local/lib/python3.6/site-packages/pipenv/core.py", line 1992, in do_install
skip_lock=skip_lock,
File "/home/shamoon/.local/lib/python3.6/site-packages/pipenv/core.py", line 1253, in do_init
pypi_mirror=pypi_mirror,
File "/home/shamoon/.local/lib/python3.6/site-packages/pipenv/core.py", line 859, in do_install_dependencies
retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
File "/home/shamoon/.local/lib/python3.6/site-packages/pipenv/core.py", line 763, in batch_install
_cleanup_procs(procs, not blocking, failed_deps_queue, retry=retry)
File "/home/shamoon/.local/lib/python3.6/site-packages/pipenv/core.py", line 681, in _cleanup_procs
raise exceptions.InstallError(c.dep.name, extra=err_lines)
pipenv.exceptions.InstallError: ERROR: ERROR: Package installation failed...
When the project's path contains a Unicode character ("C:\Users\Camilo\Proyectos\Python\Transcripción de audio"), I get the following error:
File "C:\Users\Camilo\Proyectos\Python\Transcripción de audio\env\lib\site-packages\pocketsphinx\pocketsphinx.py", line 276, in __init__ this = _pocketsphinx.new_Decoder(*args) RuntimeError: new_Decoder returned -1
I think the issue could be in the _pocketsphinx.cp37-win_amd64.pyd file.
When trying to run the basic usage example shown in the readme, it throws an error already on importing:
from pocketsphinx.pocketsphinx import *
File "sphinxbase.pxd", line 150, in init pocketsphinx (pocketsphinx.c:7935)
ValueError: PyCapsule_GetPointer called with invalid PyCapsule object
-- has been installed from the repos (Ubuntu 14.04),
pip version info:
Name: PocketSphinx
Version: 0.8
Location: /usr/lib/python2.7/dist-packages
According to the help menu in pocketspinx_continous the time option describes " Print word times in file transcription."
I've tried to include the following in the decoder config. I am not sure if I am doing it right.
config.set_string('-time', 'time.txt')
decoder = Decoder(config)
After installing pocketsphinx via pip I tired to run the basic example
from pocketsphinx import LiveSpeech
for phrase in LiveSpeech(): print(phrase)
And I got this
$ python pocketsphinx.py
Traceback (most recent call last):
File "pocketsphinx.py", line 1, in <module>
from pocketsphinx import LiveSpeech
File "C:\Users\Vishnu\Desktop\pocketsphinx.py", line 1, in <module>
from pocketsphinx import LiveSpeech
ImportError: cannot import name 'LiveSpeech' from 'pocketsphinx' (C:\Users\Vishnu\Desktop\pocketsphinx.py)
I noticed that there isn't a SWIG usage to configure the beam width in ~/pocketsphinx-python/pocketsphinx/swig/python/pocketsphinx.pypocketsphinx.py. Is there another way to change the beam-width? I'm getting overpruning at 1.0-e48 with my JSGF application and it's causing me to lose commands. Those commands also break in the c implementation at 1.0e-48, but work just fine at 1.0e-64.
from os import environ, path
from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *
MODELDIR = "/usr/local/share/pocketsphinx/model"
DATADIR = "/tmp/"
# Create a decoder with certain model
config = Decoder.default_config()
config.set_string('-hmm', path.join(MODELDIR, 'en-us/en-us'))
config.set_string('-lm', path.join(MODELDIR, 'en-us/en-us.lm.dmp'))
config.set_string('-dict', path.join(MODELDIR, 'en-us/cmudict-en-us.dict'))
decoder = Decoder(config)
Yields error:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-2-2bb98e99123c> in <module>()
7 config.set_string('-lm', path.join(MODELDIR, 'en-us/en-us.lm.dmp'))
8 config.set_string('-dict', path.join(MODELDIR, 'en-us/cmudict-en-us.dict'))
----> 9 decoder = Decoder(config)
10
/usr/local/lib/python2.7/site-packages/pocketsphinx/pocketsphinx.pyc in __init__(self, *args)
268 __init__(Decoder self, Config config) -> Decoder
269 """
--> 270 this = _pocketsphinx.new_Decoder(*args)
271 try:
272 self.this.append(this)
RuntimeError: new_Decoder returned -1
Not sure how to collect more debug information on this.
This occurs whether installing from source (pip install pocketsphinx) or homebrew (https://github.com/watsonbox/homebrew-cmu-sphinx)
$ pocketsphinx_continuous -inmic yes
at the command line runs fine.
Please tell me how to correct this error....
Thanks in advance!
Traceback (most recent call last):
File "/home/user/PycharmProjects/untitled/zen.py", line 9, in
config = Decoder.default_config()
NameError: name 'Decoder' is not defined
Process finished with exit code 1
Unable to find Vcvarsall.bat - Pip (Windows 10) I have satisfied all dependancies
And i am unable to download setup.py n related files.... Doesnt download completely.. the file dowloaded is just 7kb zip file
Hi,
I have installed library from link: https://github.com/cmusphinx/pocketsphinx-python
I got below exception
[
Traceback (most recent call last):
File "example.py", line 3, in
from pocketsphinx.pocketsphinx import *
ImportError: No module named pocketsphinx
]
Also I tried the solution given in link: #14
but for me its not working
Hi,
i get this error when i try installing pocketsphinx-python.
root@raspberrypi:/home/pi/Documents/voicepi/pocketsphinx-python# python setup.py install
running install
running bdist_egg
running egg_info
writing pocketsphinx.egg-info/PKG-INFO
writing top-level names to pocketsphinx.egg-info/top_level.txt
writing dependency_links to pocketsphinx.egg-info/dependency_links.txt
error: package directory 'sphinxbase/swig/python' does not exist
root@raspberrypi:/home/pi/Documents/voicepi/pocketsphinx-python#
These are the installations in the same folder
root@raspberrypi:/home/pi/Documents/voicepi# ls -ltr
total 20
drwxr-xr-x 11 root root 4096 Sep 4 20:48 sphinxbase
drwxr-xr-x 12 root root 4096 Sep 4 21:02 pocketsphinx
-rw-r--r-- 1 root root 5777 Sep 4 21:39 stt.py
drwxr-xr-x 7 root root 4096 Sep 4 22:21 pocketsphinx-python
root@raspberrypi:/home/pi/Documents/voicepi#
ensured that all dependencies are installed in first place
Please let me know what is that i am missing.
Thanks
Hello,
Could you please tell if the window which is defined by buf = stream.read(args.chunk_size)
in my script below affect on recognition? 307200
is 300 Kbytes of approximately ~ 10 sec of .wav, PCM signed 16-bit little endian, 16 KHz sample rate. So how is window of utterance defined? I guess this is called Hamming window (Error-correction code). My audio file is this video which I convert using ffmpeg
to .wav format with settings above. Thanks in advance
P.S.: With 300 Kbytes of file size to read, I got
WRR: 45.000000 % ( 195 / 424)
WER: 58.000000 % ( 249 / 424)
with 1024 bytes, I got
WRR: 9.000000 % ( 41 / 424)
WER: 103.000000 % ( 440 / 424)
#!/usr/bin/env python
import datetime
import os
import glob
import argparse
from pocketsphinx.pocketsphinx import Decoder
DEFAULT_MODEL_PATH = '/usr/local/share/pocketsphinx/model/en-us'
DEFAULT_CHUNK_SIZE = 307200 # ~ 10 sec of .wav, PCM signed 16-bit little endian, 16 KHz sample rate, mono channel
buzz_words = ['<s>', '</s>', '[SPEECH]', '[NOISE]', '<sil>']
hypothesis = []
bag_of_words = []
decoder = None
def main(args):
# read audio files from directory
if args.indir:
audio_filepaths = [glob.glob(e) for e in ['*.wav', '*.raw']]
if not audio_filepaths:
print 'No audio file (.wav, .raw) in given directory was found.'
return
for f in audio_filepaths:
recognize_audio(f, args)
# read given single audio file
elif args.infile:
recognize_audio(args.infile, args)
# write hypothesis into the separate file, joining with empty space
f = open(os.path.join(os.getcwd(), 'leo', 'recognized_sphinx_%s.txt' % args.chunk_size), 'w+')
f.write(' '.join(hypothesis))
f.close()
# write segments into separate file
# TODO: further work with segments
f = open(os.path.join(os.getcwd(), 'leo', 'recognized_sphinx_%s_segments.txt' % args.chunk_size), 'w+')
[f.write('%s\n' % s) for s in bag_of_words]
f.close()
def recognize_audio(audio_file, args):
try:
decoder.start_utt()
stream = open(audio_file, 'rb')
while True:
buf = stream.read(args.chunk_size)
if buf:
decoder.process_raw(buf, False, False)
else:
break
if decoder.hyp() is not None:
hypothesis.append(decoder.hyp().hypstr)
[bag_of_words.append(seg.word) for seg in decoder.seg() if seg.word not in buzz_words]
decoder.end_utt()
decoder.start_utt()
except Exception, ex:
print 'Error occurred with %s \n%s' % (audio_file, ex)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('-infile', help='Audio .wav/.raw file')
parser.add_argument('-indir', help='Directory containing audio files', nargs='?')
parser.add_argument('-chunk_size', help='Size of audio file in bytes to read', default=DEFAULT_CHUNK_SIZE, type=int)
parser.add_argument('-hmm', help='Acoustic model directory', default=os.path.join(DEFAULT_MODEL_PATH, 'en-us'))
parser.add_argument('-lm', help='Language model input file', default=os.path.join(DEFAULT_MODEL_PATH, 'en-us.lm.bin'))
parser.add_argument('-dict', help='Pronunciation dictionary input file', default=os.path.join(DEFAULT_MODEL_PATH, 'cmudict-en-us.dict'))
args = parser.parse_args()
# Create a decoder with certain model
config = Decoder.default_config()
config.set_string('-hmm', args.hmm)
config.set_string('-lm', args.lm)
config.set_string('-dict', args.dict)
config.set_string('-logfn', os.path.join(os.getcwd(), 'results-%s.log' % datetime.datetime.now()))
decoder = Decoder(config)
main(args)
Maybe this is intentional, but there is no __init__.py
file in the "pocketsphinx" and "sphinxbase" directories after installing with pip. This causes an ImportError.
After adding an empty __init__.py
file in each directory, everything seems to work smoothly.
Am I missing something, or this should be corrected?
I see here the whole bunch of issues addressing problem of importing pocketsphinx and sphinxbase modules to readme example. And yet i didn't see any answer helping me to solve this problem.
I got properly installed modules of sphinxbase and pocketsphinx and I add path to them via sys.path.append('/usr/local/lib/python2.7/dist-packeges') but this doesn`t seem to help.
I hope smb gives an explanation over this problem finally
ERROR: "ngram_model_dmp.c", line 121: Wrong magic header size number 54726965: pocketsphinx/model/en-us/en-us.lm.bin is not a dump file
have no idea to get down to this, any help would be appreciated, and this is just with running the example.
I'm struggling to find an easy way to compile this extension on Windows 10 for Python 3.5
The only compiler I've gotten to work (VS 2015 Express) involves a lengthy download/install.
I would like my users to have an easier/quicker way to install this dependency.
Is there a better VS compiler than "VS 2015 Express" for Python 3.5 that I can use?
Also, are there plans to make this a pre-compiled package so users don't have to go through the trouble of SWIG and MS Visual Studio? I would like to help make that happen. Maybe you could point me in the right direction?
Thanks in advance,
Connor
Am I missing something ? I get the following message
Traceback (most recent call last):
File "example.py", line 10, in <module>
config = Decoder.default_config()
NameError: name 'Decoder' is not defined
Hi I've been trying for some time to figure out how to install this on OSX but when I run pip3 install pocketsphinx
I get the following error log:
Collecting pocketsphinx
Using cached pocketsphinx-0.1.3.zip
Building wheels for collected packages: pocketsphinx
Running setup.py bdist_wheel for pocketsphinx ... error
Complete output from command /usr/local/opt/python3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/76/jhslh_d12kq33vg4tqp5cktw0000gn/T/pip-build-ga1uramw/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 /var/folders/76/jhslh_d12kq33vg4tqp5cktw0000gn/T/tmpvj9p3_pepip-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 -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -I/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers -Ideps/sphinxbase/include/android -Ideps/sphinxbase/swig -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
creating build
creating build/temp.macosx-10.12-x86_64-3.6
creating build/temp.macosx-10.12-x86_64-3.6/swig
creating build/temp.macosx-10.12-x86_64-3.6/swig/sphinxbase
creating build/temp.macosx-10.12-x86_64-3.6/deps
creating build/temp.macosx-10.12-x86_64-3.6/deps/sphinxbase
creating build/temp.macosx-10.12-x86_64-3.6/deps/sphinxbase/src
creating build/temp.macosx-10.12-x86_64-3.6/deps/sphinxbase/src/libsphinxad
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -I/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers -Ideps/sphinxbase/include/android -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c swig/sphinxbase/ad_wrap.c -o build/temp.macosx-10.12-x86_64-3.6/swig/sphinxbase/ad_wrap.o -Wno-macro-redefined -Wno-sign-compare -Wno-logical-op-parentheses
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -I/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers -Ideps/sphinxbase/include/android -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c deps/sphinxbase/src/libsphinxad/ad_openal.c -o build/temp.macosx-10.12-x86_64-3.6/deps/sphinxbase/src/libsphinxad/ad_openal.o -Wno-macro-redefined -Wno-sign-compare -Wno-logical-op-parentheses
deps/sphinxbase/src/libsphinxad/ad_openal.c:43:10: fatal error: 'al.h' file not found
#include <al.h>
^
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Failed building wheel for pocketsphinx
Running setup.py clean for pocketsphinx
Failed to build pocketsphinx
Installing collected packages: pocketsphinx
Running setup.py install for pocketsphinx ... error
Complete output from command /usr/local/opt/python3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/76/jhslh_d12kq33vg4tqp5cktw0000gn/T/pip-build-ga1uramw/pocketsphinx/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/76/jhslh_d12kq33vg4tqp5cktw0000gn/T/pip-sowhnsqa-record/install-record.txt --single-version-externally-managed --compile:
running install
running build_ext
building 'sphinxbase._ad' extension
swigging swig/sphinxbase/ad.i to swig/sphinxbase/ad_wrap.c
swig -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -I/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers -Ideps/sphinxbase/include/android -Ideps/sphinxbase/swig -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
creating build
creating build/temp.macosx-10.12-x86_64-3.6
creating build/temp.macosx-10.12-x86_64-3.6/swig
creating build/temp.macosx-10.12-x86_64-3.6/swig/sphinxbase
creating build/temp.macosx-10.12-x86_64-3.6/deps
creating build/temp.macosx-10.12-x86_64-3.6/deps/sphinxbase
creating build/temp.macosx-10.12-x86_64-3.6/deps/sphinxbase/src
creating build/temp.macosx-10.12-x86_64-3.6/deps/sphinxbase/src/libsphinxad
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -I/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers -Ideps/sphinxbase/include/android -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c swig/sphinxbase/ad_wrap.c -o build/temp.macosx-10.12-x86_64-3.6/swig/sphinxbase/ad_wrap.o -Wno-macro-redefined -Wno-sign-compare -Wno-logical-op-parentheses
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -I/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers -Ideps/sphinxbase/include/android -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c deps/sphinxbase/src/libsphinxad/ad_openal.c -o build/temp.macosx-10.12-x86_64-3.6/deps/sphinxbase/src/libsphinxad/ad_openal.o -Wno-macro-redefined -Wno-sign-compare -Wno-logical-op-parentheses
deps/sphinxbase/src/libsphinxad/ad_openal.c:43:10: fatal error: 'al.h' file not found
#include <al.h>
^
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Command "/usr/local/opt/python3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/76/jhslh_d12kq33vg4tqp5cktw0000gn/T/pip-build-ga1uramw/pocketsphinx/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/76/jhslh_d12kq33vg4tqp5cktw0000gn/T/pip-sowhnsqa-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/76/jhslh_d12kq33vg4tqp5cktw0000gn/T/pip-build-ga1uramw/pocketsphinx/
Any help or advice would be greatly appreciated
I'm getting this error
INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='live', VARNORM='no', AGC='none'
ERROR: "acmod.c", line 79: Folder 'C:/Users/junew/Desktop/pocketsphinx-5prealpha/pocketsphinx/model/en-us/en-us\en-us/en-us' does not contain acoustic model definition 'mdef'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python36\lib\site-packages\pocketsphinx\pocketsphinx.py", line 272, in __init__
this = _pocketsphinx.new_Decoder(*args)
RuntimeError: new_Decoder returned -1
I installed as you directed and when i tried to run the sample file I got the below error how to fix this on ubuntu 15. Please reply as soon as possible.
python test.py
Traceback (most recent call last):
File "test.py", line 3, in
from pocketsphinx.pocketsphinx import *
File "/usr/local/lib/python2.7/dist-packages/pocketsphinx/init.py", line 37, in
from pocketsphinx import *
File "/usr/local/lib/python2.7/dist-packages/pocketsphinx/pocketsphinx.py", line 42, in
_pocketsphinx = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/pocketsphinx/pocketsphinx.py", line 38, in swig_import_helper
_mod = imp.load_module('_pocketsphinx', fp, pathname, description)
ImportError: libpocketsphinx.so.3: cannot open shared object file: No such file or directory
Hi :)
I can use now
config.set_string('-jsgf', 'grammar.gram')
grammar as Language model but it only returns a string with decoder.hyp().hypstr
how is it possible to make a simple application with grammar like adding two number ? I means semantic parsing with jsgf to return pair values like rule names and matching values ?
thank you very much in advance
Ehsan
thanks for your
Excuse me, I had followed your instruction to install the pocketshpinx with $sudo python setup.py install command, and no error message. And pip list has pocketsphinx in the list. But when I run $python example.py, there are some problem with
Traceback (most recent call last):
File "example.py", line 4, in
from pocketsphinx.pocketsphinx import *
ImportError: No module named pocketsphinx
I am very comfused about it, Can you give a hand?
Hi,
I am trying to read wav file and pass that byte array to process_raw() but I didn't get correct output.
If I am using pyaudio for recording and pass that byte array to process_raw() I got correct output.
Please help.
Thanks.
HI,
When I print out the first/end frame of each word, I found out that the time stamp is not matching, not even close. The audio file is 410s while the last word's end frame is nearly 3000s. I use the default configuration with decoder and divide the each frame with 100.
Could anybody inform me why this is happening?
While I was trying to pack a project for Debian that using import pocketsphinx
Python module, I realized that there is a namespace collision between:
https://pypi.python.org/pypi/pocketsphinx (source: https://github.com/bambocher/pocketsphinx-python)
and
https://packages.debian.org/jessie/python/python-pocketsphinx (source: https://github.com/cmusphinx/pocketsphinx/tree/master/swig/python)
Also it's uncertain that which one of these projects are the official Python bindings for pocketsphinx:
Please make it clarify and fix this namespace collision.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.