installation of the offline speech recognition

I would like to ask for your help regarding the installation of the offline speech recognition. How can I install/use the PocketSphinx - I tried to install the PocketSphinx and its dependencies: pip install pocketsphinx webrtcvad requests monotonic - I run the python examples and there was any exception unfortunately.



for example:

respeaker_python_library/examples/offline_voice_assistant.py, especially card detection (microphone.py):
[attachment=2]20180521_101654.png[/attachment]

Here is my card:
[attachment=1]20180521_101509.png[/attachment]

and here is a pyaudio code which can shows the details about the devices:

python -c “import pyaudio;audio=pyaudio.PyAudio();print([audio.get_device_info_by_index(i) for i in range(audio.get_device_count())])”



On the response I can see same problem as before (offline_voice_assistant.py):
[attachment=0]20180521_103422.png[/attachment]

thank you in advanced!
20180521_103422.png
20180521_101509.png
20180521_101654.png

Hi there:

We have successfully run snowboy on respeaker V2. We will study it for you and reply you next week.

Hi there:

You can modify the file as follows(/usr/share/alsa/alsa.conf):[code]#

ALSA library configuration file

pre-load the configuration files

@hooks [
{
func load
files [
{
@func concat
strings [
{ @func datadir }
“/alsa.conf.d/”
]
}
“/etc/asound.conf”
“~/.asoundrc”
]
errors false
}
]

load card-specific configuration files (on request)

cards.@hooks [
{
func load
files [
{
@func concat
strings [
{ @func datadir }
“/cards/aliases.conf”
]
}
]
}
{
func load_for_all_cards
files [
{
@func concat
strings [
{ @func datadir }
“/cards/”
{ @func private_string }
“.conf”
]
}
]
errors false
}
]

defaults

show all name hints also for definitions without hint {} section

defaults.namehint.showall on

show just basic name hints

defaults.namehint.basic on

show extended name hints

defaults.namehint.extended on

defaults.ctl.card 0
defaults.pcm.card 0
defaults.pcm.device 0
defaults.pcm.subdevice -1
defaults.pcm.nonblock 1
defaults.pcm.compat 0
defaults.pcm.minperiodtime 5000 # in us
defaults.pcm.ipc_key 5678293
defaults.pcm.ipc_gid audio
defaults.pcm.ipc_perm 0660
defaults.pcm.dmix.max_periods 0
defaults.pcm.dmix.rate 48000
defaults.pcm.dmix.format “unchanged”
defaults.pcm.dmix.card defaults.pcm.card
defaults.pcm.dmix.device defaults.pcm.device
defaults.pcm.dsnoop.card defaults.pcm.card
defaults.pcm.dsnoop.device defaults.pcm.device
defaults.pcm.front.card defaults.pcm.card
defaults.pcm.front.device defaults.pcm.device
defaults.pcm.rear.card defaults.pcm.card
defaults.pcm.rear.device defaults.pcm.device
defaults.pcm.center_lfe.card defaults.pcm.card
defaults.pcm.center_lfe.device defaults.pcm.device
defaults.pcm.side.card defaults.pcm.card
defaults.pcm.side.device defaults.pcm.device
defaults.pcm.surround21.card defaults.pcm.card
defaults.pcm.surround21.device defaults.pcm.device
defaults.pcm.surround40.card defaults.pcm.card
defaults.pcm.surround40.device defaults.pcm.device
defaults.pcm.surround41.card defaults.pcm.card
defaults.pcm.surround41.device defaults.pcm.device
defaults.pcm.surround50.card defaults.pcm.card
defaults.pcm.surround50.device defaults.pcm.device
defaults.pcm.surround51.card defaults.pcm.card
defaults.pcm.surround51.device defaults.pcm.device
defaults.pcm.surround71.card defaults.pcm.card
defaults.pcm.surround71.device defaults.pcm.device
defaults.pcm.iec958.card defaults.pcm.card
defaults.pcm.iec958.device defaults.pcm.device
defaults.pcm.modem.card defaults.pcm.card
defaults.pcm.modem.device defaults.pcm.device

truncate files via file or tee PCM

defaults.pcm.file_format “raw”
defaults.pcm.file_truncate true
defaults.rawmidi.card 0
defaults.rawmidi.device 0
defaults.rawmidi.subdevice -1
defaults.hwdep.card 0
defaults.hwdep.device 0
defaults.timer.class 2
defaults.timer.sclass 0
defaults.timer.card 0
defaults.timer.device 0
defaults.timer.subdevice 0

PCM interface

redirect to load-on-demand extended pcm definitions

pcm.cards cards.pcm

pcm.default cards.pcm.default
pcm.sysdefault cards.pcm.default
#pcm.front cards.pcm.front
#pcm.rear cards.pcm.rear
#pcm.center_lfe cards.pcm.center_lfe
#pcm.side cards.pcm.side
#pcm.surround21 cards.pcm.surround21
#pcm.surround40 cards.pcm.surround40
#pcm.surround41 cards.pcm.surround41
#pcm.surround50 cards.pcm.surround50
#pcm.surround51 cards.pcm.surround51
#pcm.surround71 cards.pcm.surround71
#pcm.iec958 cards.pcm.iec958
#pcm.spdif iec958
#pcm.hdmi cards.pcm.hdmi
#pcm.dmix cards.pcm.dmix
#pcm.dsnoop cards.pcm.dsnoop
#pcm.modem cards.pcm.modem
#pcm.phoneline cards.pcm.phoneline

pcm.hw {
@args [ CARD DEV SUBDEV ]
@args.CARD {
type string
default {
@func getenv
vars [
ALSA_PCM_CARD
ALSA_CARD
]
default {
@func refer
name defaults.pcm.card
}
}
}
@args.DEV {
type integer
default {
@func igetenv
vars [
ALSA_PCM_DEVICE
]
default {
@func refer
name defaults.pcm.device
}
}
}
@args.SUBDEV {
type integer
default {
@func refer
name defaults.pcm.subdevice
}
}
type hw
card $CARD
device $DEV
subdevice $SUBDEV
hint {
show {
@func refer
name defaults.namehint.extended
}
description “Direct hardware device without any conversions”
}
}

pcm.plughw {
@args [ CARD DEV SUBDEV ]
@args.CARD {
type string
default {
@func getenv
vars [
ALSA_PCM_CARD
ALSA_CARD
]
default {
@func refer
name defaults.pcm.card
}
}
}
@args.DEV {
type integer
default {
@func igetenv
vars [
ALSA_PCM_DEVICE
]
default {
@func refer
name defaults.pcm.device
}
}
}
@args.SUBDEV {
type integer
default {
@func refer
name defaults.pcm.subdevice
}
}
type plug
slave.pcm {
type hw
card $CARD
device $DEV
subdevice $SUBDEV
}
hint {
show {
@func refer
name defaults.namehint.extended
}
description “Hardware device with all software conversions”
}
}

pcm.plug {
@args [ SLAVE ]
@args.SLAVE {
type string
}
type plug
slave.pcm $SLAVE
}

pcm.shm {
@args [ SOCKET PCM ]
@args.SOCKET {
type string
}
@args.PCM {
type string
}
type shm
server $SOCKET
pcm $PCM
}

pcm.tee {
@args [ SLAVE FILE FORMAT ]
@args.SLAVE {
type string
}
@args.FILE {
type string
}
@args.FORMAT {
type string
default {
@func refer
name defaults.pcm.file_format
}
}
type file
slave.pcm $SLAVE
file $FILE
format $FORMAT
truncate {
@func refer
name defaults.pcm.file_truncate
}
}

pcm.file {
@args [ FILE FORMAT ]
@args.FILE {
type string
}
@args.FORMAT {
type string
default {
@func refer
name defaults.pcm.file_format
}
}
type file
slave.pcm null
file $FILE
format $FORMAT
truncate {
@func refer
name defaults.pcm.file_truncate
}
}

pcm.null {
type null
hint {
show {
@func refer
name defaults.namehint.basic
}
description “Discard all samples (playback) or generate zero samples (capture)”
}
}

Control interface

ctl.sysdefault {
type hw
card {
@func getenv
vars [
ALSA_CTL_CARD
ALSA_CARD
]
default {
@func refer
name defaults.ctl.card
}
}
hint.description “Default control device”
}
ctl.default ctl.sysdefault

ctl.hw {
@args [ CARD ]
@args.CARD {
type string
default {
@func getenv
vars [
ALSA_CTL_CARD
ALSA_CARD
]
default {
@func refer
name defaults.ctl.card
}
}
}
type hw
card $CARD
hint.description “Direct control device”
}

ctl.shm {
@args [ SOCKET CTL ]
@args.SOCKET {
type string
}
@args.CTL {
type string
}
type shm
server $SOCKET
ctl $CTL
}

RawMidi interface

rawmidi.default {
type hw
card {
@func getenv
vars [
ALSA_RAWMIDI_CARD
ALSA_CARD
]
default {
@func refer
name defaults.rawmidi.card
}
}
device {
@func igetenv
vars [
ALSA_RAWMIDI_DEVICE
]
default {
@func refer
name defaults.rawmidi.device
}
}
hint.description “Default raw MIDI device”
}

rawmidi.hw {
@args [ CARD DEV SUBDEV ]
@args.CARD {
type string
default {
@func getenv
vars [
ALSA_RAWMIDI_CARD
ALSA_CARD
]
default {
@func refer
name defaults.rawmidi.card
}
}
}
@args.DEV {
type integer
default {
@func igetenv
vars [
ALSA_RAWMIDI_DEVICE
]
default {
@func refer
name defaults.rawmidi.device
}
}
}
@args.SUBDEV {
type integer
default -1
}
type hw
card $CARD
device $DEV
subdevice $SUBDEV
hint {
description “Direct rawmidi driver device”
device $DEV
}
}

rawmidi.virtual {
@args [ MERGE ]
@args.MERGE {
type string
default 1
}
type virtual
merge $MERGE
}

Sequencer interface

seq.default {
type hw
hint.description “Default sequencer device”
}

seq.hw {
type hw
}

HwDep interface

hwdep.default {
type hw
card {
@func getenv
vars [
ALSA_HWDEP_CARD
ALSA_CARD
]
default {
@func refer
name defaults.hwdep.card
}
}
device {
@func igetenv
vars [
ALSA_HWDEP_DEVICE
]
default {
@func refer
name defaults.hwdep.device
}
}
hint.description “Default hardware dependent device”
}

hwdep.hw {
@args [ CARD DEV ]
@args.CARD {
type string
default {
@func getenv
vars [
ALSA_HWDEP_CARD
ALSA_CARD
]
default {
@func refer
name defaults.hwdep.card
}
}
}
@args.DEV {
type integer
default {
@func igetenv
vars [
ALSA_HWDEP_DEVICE
]
default {
@func refer
name defaults.hwdep.device
}
}
}
type hw
card $CARD
device $DEV
hint {
description “Direct hardware dependent device”
device $DEV
}
}

Timer interface

timer_query.default {
type hw
}

timer_query.hw {
type hw
}

timer.default {
type hw
class {
@func refer
name defaults.timer.class
}
sclass {
@func refer
name defaults.timer.sclass
}
card {
@func refer
name defaults.timer.card
}
device {
@func refer
name defaults.timer.device
}
subdevice {
@func refer
name defaults.timer.subdevice
}
hint.description “Default timer device”
}

timer.hw {
@args [ CLASS SCLASS CARD DEV SUBDEV ]
@args.CLASS {
type integer
default {
@func refer
name defaults.timer.class
}
}
@args.SCLASS {
type integer
default {
@func refer
name defaults.timer.sclass
}
}
@args.CARD {
type string
default {
@func refer
name defaults.timer.card
}
}
@args.DEV {
type integer
default {
@func refer
name defaults.timer.device
}
}
@args.SUBDEV {
type integer
default {
@func refer
name defaults.timer.subdevice
}
}
type hw
class $CLASS
sclass $SCLASS
card $CARD
device $DEV
subdevice $SUBDEV
hint {
description “Direct timer device”
device $DEV
}
}
[/code]

Hi, I tried it and ok, there isn’t any error message, but the offline recognition does not work, there is no “input waiting”, just this:
[attachment=0]20180602_093124.png[/attachment]

If I say “Snowboy”, there won’t any reaction.



Thanks
20180602_093124.png

Hi there:

your log messages show: cannot connect to server scoket err …,It means there is something wrong with your network communication. Please check if your communication is normal.

you are right, but but there is not any instruction about offline sp. rec. settings on respeaker’s wiki.



Please describe how we can set it.

Hi there, We come out the wiki with bing and pocketspinx from <LINK_TEXT text=“http://wiki.seeedstudio.com/ReSpeaker_C … -with-bing”>http://wiki.seeedstudio.com/ReSpeaker_Core_v2.0/#play-with-bing</LINK_TEXT>. please refer to the <LINK_TEXT text=“https://github.com/respeaker/respeaker_ … sistant.py”>https://github.com/respeaker/respeaker_python_library/blob/master/examples/offline_voice_assistant.py</LINK_TEXT> for the offline voice test. thanks.



Seeed techsupport team

Bill

Hi Bill, I know the second url, it is cloned to Respeaker and I can run it, there is no any errors and there is not any interactivity.



I say that “respeaker” and the respeaker does nothing.

Dear Customer,



I tested offline_voice_assistant.py and it responses as wakeup. here is the screen. thanks.









Seeed techsupport team

Bill

Hello,



I just ran into a similar problem with the offline STT.

No errors when I installed everything. Other demos work, the Alexa demos all work.



Here is the output when I try and run it…

respeaker@v2:~$ python respeaker_python_library/examples/offline_voice_assistant.py

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline

ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave



Here is the output of the ALSA diagnostics from the above thread.



python -c “import pyaudio;audio=pyaudio.PyAudio();print([audio.get_device_info_by_index(i) for i in range(audio.get_device_count())])”

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline

ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave

[{‘defaultSampleRate’: 48000.0, ‘defaultLowOutputLatency’: 0.005333333333333333, ‘defaultLowInputLatency’: -1.0, ‘maxInputChannels’: 0L, ‘structVersion’: 2L, ‘hostApi’: 0L, ‘index’: 0, ‘defaultHighOutputLatency’: 0.032, ‘maxOutputChannels’: 2L, ‘name’: u’seeed-8mic-voicecard: - (hw:0,1)’, ‘defaultHighInputLatency’: -1.0}, {‘defaultSampleRate’: 44100.0, ‘defaultLowOutputLatency’: 0.00873015873015873, ‘defaultLowInputLatency’: 0.008707482993197279, ‘maxInputChannels’: 32L, ‘structVersion’: 2L, ‘hostApi’: 0L, ‘index’: 1, ‘defaultHighOutputLatency’: 0.034829931972789115, ‘maxOutputChannels’: 32L, ‘name’: u’default’, ‘defaultHighInputLatency’: 0.034829931972789115}]

Hi, please ignore the errors, Let’s say ReSpeaker to wakeup and then say alexa. You can see terminal as below. thanks.





ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline

ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave

Wake up

00000000000000000000000000000000000000000001111+00000000-1111+1111111111111111111111100000000-0000000000000001111+00000000-00000000000000000000000001111+11111111111111111100000000-Recognized alexa alexa



Seeed techsupport team

Bill