Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 130

home of bishoph

Smarthome, speech recognition, voice control, Raspberry Pi


and more
Skip to content

 Startseite
 twitter archiv
 About

Step by step: Raspberry Pi offline voice


recognition with SOPARE
After a round of optimization, refactoring, bug fixing and testing it is time for a new blog post.
Since fundamentals have changed and due to public requests, we do a step-by-step tutorial. First
of all, the good news: SOPARE 1.5 is out and was successful developed, installed and tested on
Raspbian Wheezy, Jessie and Stretch. In addition, people mentioned that SOPARE works on
Orange Pi and on some Ubuntu versions. Just in case you have no idea what SOPARE is let’s do
a quick introduction:

SOPARE stands for SOund PAttern REcognition and is a Python project developed on and for
the Raspberry Pi. The goal is to provide offline and real time audio processing for some words
that must be trained upfront.
As SOPARE is able to learn sounds from training sessions SOPARE is able to identify the same
sound later on even under different circumstances. This means that you can train words in any
languages. Or just sounds like doorbells, knocks and whatever you want. Of course, there are
limitations. However, SOPARE provides a simple plug-in architecture for further processing.
Here are some real life operational areas: SOPARE runs 24/7 and controls smart home things
like lights (on/off), a magic mirror (wake up, change views, …) and another installation controls
a robotic arm via voice commands. The source code and even more information is available on
GitHub.

You want to see SOPARE in action? Here is a 32 second video that shows the potential:

Now let us start with the hardware requirements. You need a computer. Yep, seriously. As
SOPARE was developed for and on a Raspberry Pi we go with this one – even if SOPARE runs
on other hardware as well. Make sure that the hardware comes with a multi core processor. This
means Raspberry Pi 2 or 3. Please note: The Pi zero was not tested and could be too weak even if
the „0“ comes with 2 cores. SOPARE does not run on older hardware like Raspberry Pi B or B+
due to the lack of multi-core processors. Of course, you need a power supply and a micro SD
card if you go with the Raspberry Pi.

Then you need a microphone. Maybe some USB-mic. The microphone is extremely important
and should fit your own requirements. For example: If you want speech recognition across a
large distance (more that 1 meter) you may find out that the cheap USB-mic for 5 Euros does not
do the trick. But if you plan to speak directly into the microphone the same mic could do the job
just perfect. I’m using different microphones for different environments and requirements.

That’s it for the hardware. Now let’s talk about software. SOPARE should run on every
Raspbian version that is out there. The latest version is Stretch. All of my Raspberry Pis are
running the „lite“ version without a desktop UI. But this is up to you and you can choose
whatever you prefer. There is some good information available how to download, install and
configure Raspbian. I don’t cover this topic as it would get out of hand.

Now you should have a computer, a mic and the operating system installed and configured. In
terms of Raspbian you already got most of the software for the further installation. Only some
required libraries must be installed manually with the following commands:

sudo apt-get update


sudo apt-get install build-essential python-pyaudio python-numpy python-scipy
python-matplotlib

I recommend to create a development directory in your home directory but this is really optional.
In case you follow my recommendation execute the following commands:

cd
mkdir dev
cd dev

You are now ready to install SOPARE from GitHub:

git clone https://github.com/bishoph/sopare.git

Voilá. To really be ready and to follow the complete instructions we need two more directories:

cd sopare
mkdir tokens
mkdir samples

You successful installed SOPARE. Congratulations. We can fire up some tests to find out if all
requirements are met and if the microphone is configured and used correctly. Start SOPARE and
the audio test with the following commands:

python sopare.py -u
python test/test_audio.py

Let us assume that everything went well and you got no errors. In that case you see something
like this:

sopare 1.5.1
starting unit tests...
...
unit_tests run successful!
done.

test_audio init...
... ALSA related information ...
testing different SAMPLE_RATEs ... this may take a while!

Your sopare/config.py recommendations:

SAMPLE_RATE = 48000
CHUNK = 512
THRESHOLD = 100

Great! You can now edit the configuration and change the file accordingly to the
recommendations:

nano config/default.ini

As soon as you saved the config you are ready to do a first training round. Let’s train the word
„test“. This is easy as eating cake:

./sopare.py -v -t test

Start saying the word „test“ shortly after the line

INFO:sopare.recorder:start endless recording

appears on the screen. You should see lots of lines rush over your monitor. This is good as
SOPARE logs some debug information. If the lines are rushing before you said something
SOPARE started the training because something triggered the THRESHOLD. In that case I
recommend to delete the trained file(s) and start the training again, maybe with a higher
THRESHOLD.
Here is the command to delete the files and the dictionary and start again:

rm dict/*.raw
./sopare.py -d "*"

You can repeat the training round a few times. Normally 3 times is enough to get first results.
After the training SOPARE must create an internal dictionary from the training:

./sopare.py -c

Finally we reached the end of the step-by-step tutorial. You may want to check if your trained
words are recognized, right? Here we go. Start SOPARE in endless loop mode and say „test“:

./sopare.py -l

Depending on your mic, your environment, the count of test rounds and lots of other things you
should see that SOPARE is able to recognize the word test as it appears on the screen in square
brackets.

['test']

Amazing. You can now fine tune, train more or different words or write your custom plugin. See
the other available content for more information. Leave me a comment and tell me about your
experience and your achievement. The video video tutorial for this post:

Happy voice control and have fun!


15. Februar 2018 by bishoph | Categories: Raspberry Pi, voice recognition | Tags: raspberry pi,
SoPaRe, speech recognition, voice control | Bookmark the permalink.

Post navigation
← SOPARE 1.5 is available; Feedback
SOPARE architecture and plugins →

187 thoughts on “Step by step: Raspberry Pi offline voice


recognition with SOPARE”

1. Alec says:

26. Februar 2018 at 11:45

Thank you for the great information! Unfortunately, I am not sure how to put it all
together.

I was able to install Sopare, train it, etc. I even saw the comment on how to apply it to
gpio, but I am trying to control multiple functions with commands. What I don’t
understand is, how do you use the readable output to trigger a section of code? I don’t
understand what rawbuf or the 3 arguments are.

When I look at the robot arm code, for example, I don’t see how i could apply this to gpio
/ motor controllers so that the computer takes the voice command it hears through a
microphone (ie., ‚test‘ or whatever the word is and uses) in the code? How / what line
does the code „take in“ the voice input information and use it to trigger something? I was
expecting something like #this is where the voice command comes from and #this is
where the voice command goes.

Antworten

o bishoph says:

26. Februar 2018 at 13:11

Hi. If you want to control something via GPIO then you have to write a plugin
with some GPIO code. Your plugin will be called whenever SOPARE recognized
a word. Inside the plugin you check for the conditions of the trained words and
executes the GPIO code. There is a very simple GPIO code example available in
the comments of the „Sopare basic usage. Voice controlling a magic mirror“ blog
post. Hope this helps 🙂
Antworten

 Alec says:

26. Februar 2018 at 20:22

Thank you for the response!

Yes, I was happy to see that post, but the problem is not knowing how to
control via GPIO, the problem is, I don’t know how to link the voice
command to that code. I see to add the ‚readable_results“ piece, but
nothing is being piped into that variable as far as I can tell. In other words,
when I say „test“ or „forward“ or whatever, this doesn’t seem to link to
any line of code to make it activate the GPIO as needed.

Here is my code: (first I define the GPIO functions, then I added the
sopare.py code with modifications to use those functions. I commented out
all the things that didn’t apply, at least as I saw it.)

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys
import time
import RPi.GPIO as gpio
#import usb.core, usb.util

#RoboArm = usb.core.find(idVendor=0x1267, idProduct=0x000)


#light = 0

def init():
gpio.setmode(gpio.BOARD)
gpio.setup(7,gpio.OUT)
gpio.setup(11,gpio.OUT)
gpio.setup(13,gpio.OUT)
gpio.setup(15,gpio.OUT)

def forward(tf):
init()
gpio.output(7,True)
gpio.output(11,True)
gpio.output(13,True)
gpio.output(15,False)
time.sleep(tf)
gpio.cleanup()

def reverse(tf):
init()
gpio.output(7,True)
gpio.output(11,False)
gpio.output(13,True)
gpio.output(15,True)
time.sleep(tf)
gpio.cleanup()

def turn_left(tf):
init()
gpio.output(7,True)
gpio.output(11,True)
gpio.output(13,False)
gpio.output(15,True)
time.sleep(tf)
gpio.cleanup()

def turn_right(tf):
init()
gpio.output(7,False)
gpio.output(11,True)
gpio.output(13,True)
gpio.output(15,False)
time.sleep(tf)
gpio.cleanup()

def pivot_left(tf):
init()
gpio.output(7,True)
gpio.output(11,True)
gpio.output(13,True)
gpio.output(15,True)
time.sleep(tf)
gpio.cleanup()

def pivot_right(tf):
init()
gpio.output(7,True)
gpio.output(11,False)
gpio.output(13,True)
gpio.output(15,False)
time.sleep(tf)
gpio.cleanup()

#!/usr/bin/env python
# -*- coding: utf-8 -*-

„““
Copyright (C) 2015 – 2018 Martin Kauss (yo@bishoph.org)

Licensed under the Apache License, Version 2.0 (the „License“); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software


distributed under the License is distributed on an „AS IS“ BASIS,
WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the
License for the specific language governing permissions and limitations
under the License.
„““

import sys
import getopt
import sopare.config as config
import sopare.util as util
import sopare.recorder as recorder
import sopare.log as log
import test.unit_tests as tests
from sopare.version import __version__

def main(argv):
endless_loop = False
debug = False
outfile = None
infile = None
dict = None
plot = False
wave = False
error = False
cfg_ini = None

recreate = False
unit = False
print („sopare „+__version__)

if (len(argv) > 0):


try:
opts, args = getopt.getopt(argv, „ahelpv~cous:w:r:t:d:i:“,
[„analysis“, „help“, „error“, „loop“, „plot“, „verbose“, „wave“, „create“,
„overview“, „unit“,
„show=“, „write=“, „read=“, „train=“, „delete=“, „ini=“
])
except getopt.GetoptError:
usage()
sys.exit(2)
for opt, arg in opts:
if (opt in („-h“, „–help“)):
usage()
sys.exit(0)
if (opt in („-e“, „–error“)):
error = True
if (opt in („-l“, „–loop“)):
endless_loop = True
if (opt in („-p“, „–plot“)):
if (endless_loop == False):
plot = True
else:
print („Plotting only works without loop option!“)
sys.exit(0)
if (opt in („-v“, „–verbose“)):
debug = True
if (opt in („-~“, „–wave“)):
wave = True
if opt in („-c“, „–create“):
recreate = True
if opt in („-o“, „–overview“):
show_dict_ids(debug)
sys.exit(0)
if opt in („-a“, „–analysis“):
show_dict_analysis(debug)
sys.exit(0)
if opt in („-s“, „–show“):
show_word_entries(arg, debug)
sys.exit(0)
if opt in („-w“, „–write“):
outfile = arg
if opt in („-r“, „–read“):
infile = arg
if opt in („-t“, „–train“):
dict = arg
if opt in („-d“, „–delete“):
delete_word(arg, debug)
sys.exit(0)
if opt in („-i“, „–ini“):
cfg_ini = arg
if opt in („-u“, „–unit“):
unit = True

cfg = create_config(cfg_ini, endless_loop, debug, plot, wave, outfile,


infile, dict, error)

if (recreate == True):
recreate_dict(debug, cfg)
sys.exit(0)

if (unit == True):
unit_tests(debug, cfg)
sys.exit(0)

recorder.recorder(cfg)

def create_config(cfg_ini, endless_loop, debug, plot, wave, outfile, infile,


dict, error):
if (cfg_ini == None):
cfg = config.config()
else:
cfg = config.config(cfg_ini)
logger = log.log(debug, error, cfg)
cfg.addsection(‚cmdlopt‘)
cfg.setoption(‚cmdlopt‘, ‚endless_loop‘, str(endless_loop))
cfg.setoption(‚cmdlopt‘, ‚debug‘, str(debug))
cfg.setoption(‚cmdlopt‘, ‚plot‘, str(plot))
cfg.setoption(‚cmdlopt‘, ‚wave‘, str(wave))
cfg.setoption(‚cmdlopt‘, ‚outfile‘, outfile)
cfg.setoption(‚cmdlopt‘, ‚infile‘, infile)
cfg.setoption(‚cmdlopt‘, ‚dict‘, dict)
cfg.addlogger(logger)
return cfg

def recreate_dict(debug, cfg):


print („recreating dictionary from raw input files…“)
utilities = util.util(debug, cfg.getfloatoption(‚characteristic‘,
‚PEAK_FACTOR‘))
utilities.recreate_dict_from_raw_files()
def delete_word(dict, debug):
if (dict != „*“):
print („deleting „+dict+“ from dictionary“)
else:
print („deleting all enttries from dictionary“)
utilities = util.util(debug, None)
utilities.deletefromdict(dict)

def show_word_entries(dict, debug):


print (dict+“ entries in dictionary:“)
print
utilities = util.util(debug, None)
utilities.showdictentry(dict)

def show_dict_ids(debug):
print („current entries in dictionary:“)
utilities = util.util(debug, None)
utilities.showdictentriesbyid()

def show_dict_analysis(debug):
print („dictionary analysis:“)
utilities = util.util(debug, None)
analysis = utilities.compile_analysis(utilities.getDICT())
for id in analysis:
print (id)
for k, v in analysis[id].iteritems():
print (‚ ‚ + str(k) + ‚ ‚ + str(v))

def unit_tests(debug, cfg):


print („starting unit tests…“)
tests.unit_tests(debug, cfg)
print („done.“)

def usage():
print („usage:\n“)
print (“ -h –help : this help\n“)
print (“ -l –loop : loop forever\n“)
print (“ -e –error : redirect sdterr to error.log\n“)
print (“ -p –plot : plot results (only without loop option)\n“)
print (“ -v –verbose : enable verbose mode\n“)
print (“ -~ –wave : create *.wav files (token/tokenN.wav) for“)
print (“ each detected word\n“)
print (“ -c –create : create dict from raw input files\n“)
print (“ -o –overview : list all dict entries\n“)
print (“ -s –show [word] : show detailed [word] entry information“)
print (“ ‚*‘ shows all entries!\n“)
print (“ -w –write [file] : write raw to [dir/filename]\n“)
print (“ -r –read [file] : read raw from [dir/filename]\n“)
print (“ -t –train [word] : add raw data to raw dictionary file\n“)
print (“ -d –delete [word] : delete [word] from dictionary and exits.“)
print (“ ‚*‘ deletes everything!\n“)
print (“ -i –ini [file] : use alternative configuration file\n“)
print (“ -a –analysis : show dictionary analysis and exits.\n“)
print (“ -u –unit : run unit tests\n“)

main(sys.argv[1:])

“‘
if (RoboArm != None):
print (‚Robotic arm connected!‘)
else:
print (‚Robotic arm not connected or offline!‘)

def Light():
global light
light = 1 – light
RoboArm.ctrl_transfer(0x40,6,0×100,0,[0,0,light],3)

def AllOff():
RoboArmOff = usb.core.find(idVendor=0x1267, idProduct=0x000)
attemtps = 0
while True:
try:
RoboArmOff.ctrl_transfer(0x40,6,0×100,0,[0,0,light],3)
break
except:
if (attemtps == 0):
print (‚USB con error … consider an emergency shutdown!‘)
try:
RoboArmOff = usb.core.find(idVendor=0x1267, idProduct=0x000)
except:
print (‚Shit. Manual emergency shutdown required!‘)
attemtps += 1
if (attemtps == 20):
break

def MoveArm(Duration, ArmCmd):


RoboArm.ctrl_transfer(0x40,6,0×100,0,ArmCmd,3)
time.sleep(Duration)
“‘
def run(readable_results, data, rawbuf):
# if (len(readable_results) > 2 or len(readable_results) == 0):
# return
# if RoboArm is None:
# print (‚Robotic arm not connected or offline!‘)
# return
try:
if (‚forward‘ in readable_results): # forward
forward(1)
elif (‚back‘ in readable_results): # reverse
reverse(1)
elif (‚right‘ in readable_results): # turn right
turn_right(1)
elif (‚pivot‘ in readable_results): # turn left
turn_left(1)
# elif (’stop‘ in readable_results): # pivot right
# pivot_right(2)
# elif (‚test‘ in readable_results): # pivot left
# pivot_left(2)
# elif (’stop‘ in readable_results and ’now‘ in readable_results): # stop
# break
elif (‚test‘ in readable_results): # test
forward(2)
except Exception as err:
print err
# finally:
# AllOff()

run(readable_results,1,1)

Antworten

 Alec says:

26. Februar 2018 at 20:28

PS. everything is properly indented, pasting here seemed to take


out formatting. also the „readable_results“ code is at the end for
the GPIO control, but again, it doesn’t seem to do anything. the
voice commands all work though, they just don’t do anything.

Antworten

 bishoph says:
26. Februar 2018 at 21:56

Just put a <pre> tag around your code…

 bishoph says:

26. Februar 2018 at 22:06

SOPARE calls your plugin in the plugin directory and another sub
directory with the name „__init__.py“

1) cd sopare/plugins
2) Create a custom directory in the plugin directory (e.g.: mkdir
my_gpio_custom_plugin)
3) Create a python file with the name „__init__.py“ (e.g. you copy
the print plugin)
4) Create your custom code and the conditions in the run function
for your trained identifiers
5) Start SOPARE
6) SOPARE now calls automatically the function „def
run(readable_results, data, rawbuf):“ whenever an identifier is
recognized and the recognized values are in the array
„readable_results“
7) Your custom code and your conditions are executed which
means you control your robot

Hope that helps. Seems my next tutorial will be about plugins 😉

Antworten

 Alec says:

27. Februar 2018 at 1:20

THANK YOU! I was nervously going through your


instructions. I have been trying to do voice control for 2
weeks (I’m new to robotics and coding) and every method I
tried has been failing. I knew when I came across your
tutorial it was well written and well thought out.

After your notes above, the robot did it! You probably can’t
image how happy I am about this. I literally just threw my
arms up and cheered when the robot moved! 🙂
 bishoph says:

27. Februar 2018 at 9:28

Great! You are welcome and I’m glad that you like the
project, the tutorials and it works for you.

Have fun and happy robot control. Spread the word 😉

2. Karl says:

3. März 2018 at 5:19

try to get it started.


have all software installed:
python sopare.py -u runs fine
can run mic (on usb) : arecord /home/pi/Desktop/a.wav -D sysdefault:CARD=1 works
fine
have changed
nano ~.asoundrc

pcm.!default {
type hw
card 1
}

ctl.!default {
type hw
card 1
}

and
sudo nano /usr/share/alsa/alsa.conf

defaults.ctl.card 0
defaults.pcm.card 0

and change them to

defaults.ctl.card 1
defaults.pcm.card 1

get error with python test/test_audio.py


test_audio init…
ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection
refused

same as with : python


import pyaudio
p = pyaudio.PyAudio()

any advice, change of arameters to get it work?

Thanks

Antworten

o bishoph says:

3. März 2018 at 12:18

As I don’t see any errors and just warnings from ALSA my only recommendation
is that you can clean your alsa.conf file and then have some serious fun 🙂

Cleaning means that you comment out the stuff that appears as warning, here is an
example that should help you:

#
# PCM interface
#
...
#pcm.rear cards.pcm.rear
...

Antworten

3. Karl says:

4. März 2018 at 2:30


tried again with a clean updated / upgraded stretch on rpi3 no joy ..
did :
sudo python sopare.py
sopare 1.5.0
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
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.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 confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock

then nothing happens


sudo python sopare -u
gives:
sudo python sopare.py -u
sopare 1.5.0
starting unit tests…
starting analyze tests…
analyze test preparation…
testing analyze get_match…
testing normal conditions (1)[u’test1′] == [u’test1′]
testing normal conditions (2)[u’test1′, u’test3′] == [u’test1′, u’test3′]
testing normal conditions (3)[u’test1′, u’test3′, u’test2′] == [u’test1′, u’test3′, u’test2′]
testing leading space [u’test1′, u’test3′, u’test2′] == [u’test1′, u’test3′, u’test2′]
testing ending space [u’test1′, u’test3′, u’test2′] == [u’test1′, u’test3′, u’test2′]
testing correct order [u’test1′, u’test3′, u’test2′, u’test1′, u’test3′, u’test2′] == [u’test1′,
u’test3′, u’test2′, u’test1′, u’test3′, u’test2′]
testing strict length [u’test1′, u’test3′, “, u’test2′] == [u’test1′, u’test3′, “, u’test2′]
testing false leading results [“, u’test1′, “, u’test2′] == [“, u’test1′, “, u’test2′]
analyze tests run successful.
filter test preparation…
testing filter n_shift…
testing n_shift [5, 6, 7, 8, 9, 10, 11, 12, 13, 14] == [5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
testing n_shift [15, 16, 17, 18, 19, 20, 21, 22, 23, 24] == [15, 16, 17, 18, 19, 20, 21, 22,
23, 24]
testing n_shift [25, 26, 27, 28, 29, 30, 31, 32, 33, 34] == [25, 26, 27, 28, 29, 30, 31, 32,
33, 34]
filter tests run successful.
unit_tests run successful!
done.

you stated: „clean your alsa.conf file “ == delete and re-install python-pyaudio?

Karl

Antworten

o bishoph says:

4. März 2018 at 10:18

No need to delete or uninstall pyaudio. Clean the file

sudo nano /usr/share/alsa/alsa.conf

as shown and comment out the lines that appear in the warnings.

For example, if you see a line like this

„ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM


cards.pcm.rear“

then search for the term „cards.pcm.rear“ and comment out the line like shown
above.

Antworten
4. Karl says:

4. März 2018 at 2:31

correction:
sudo python sopare.py >>> – t test <<<<
gives:
sopare 1.5.0
ALSA lib pcm_d …

Antworten

5. Karl says:

4. März 2018 at 2:51

ok seems to do something..

python test/test_audio.py
test_audio init…
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
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.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 confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
testing different SAMPLE_RATEs … this may take a while!

DEBUG:sopare.audio_factory:#### Default input device info #####


DEBUG:sopare.audio_factory:defaultSampleRate: 48000.0
DEBUG:sopare.audio_factory:defaultLowOutputLatency: -1.0
DEBUG:sopare.audio_factory:defaultLowInputLatency: 0.0213333333333
DEBUG:sopare.audio_factory:maxInputChannels: 128
DEBUG:sopare.audio_factory:structVersion: 2
DEBUG:sopare.audio_factory:hostApi: 0
DEBUG:sopare.audio_factory:index: 5
DEBUG:sopare.audio_factory:defaultHighOutputLatency: -1.0
DEBUG:sopare.audio_factory:maxOutputChannels: 0
DEBUG:sopare.audio_factory:name: default
DEBUG:sopare.audio_factory:defaultHighInputLatency: 0.0213333333333
testing different CHUNK sizes … this may take a while!

Excellent. Got all 5120 chunks.


Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Excellent. Got all 40960 chunks.
Excellent. Got all 81920 chunks.
Excellent. Got all 5120 chunks.
Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Excellent. Got all 40960 chunks.
Excellent. Got all 81920 chunks.
Excellent. Got all 5120 chunks.
Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Excellent. Got all 40960 chunks.
Excellent. Got all 81920 chunks.
Excellent. Got all 5120 chunks.
Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Excellent. Got all 40960 chunks.
Excellent. Got all 81920 chunks.
Excellent. Got all 5120 chunks.
Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Excellent. Got all 40960 chunks.
Excellent. Got all 81920 chunks.
Excellent. Got all 5120 chunks.
Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Excellent. Got all 40960 chunks.
Excellent. Got all 81920 chunks.
Excellent. Got all 5120 chunks.
Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Excellent. Got all 40960 chunks.
Excellent. Got all 81920 chunks.
Error: [Errno -9981] Input overflowed
ERROR:sopare.audio_factory:Error: Stream not open
Error: [Errno -9981] Input overflowed
ERROR:sopare.audio_factory:Error: Stream not open
Error: [Errno -9981] Input overflowed
ERROR:sopare.audio_factory:Error: Stream not open
Error: [Errno -9981] Input overflowed
ERROR:sopare.audio_factory:Error: Stream not open
Error: [Errno -9981] Input overflowed
ERROR:sopare.audio_factory:Error: Stream not open

Your sopare/config.py recommendations:

SAMPLE_RATE = 44100
CHUNK = 512
THRESHOLD = 400

./sopare.py -v -t test
sopare 1.5.0
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
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.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 confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
INFO:sopare.analyze:checking for plugins…
DEBUG:sopare.analyze:loading and initialzing plugins/print
DEBUG:sopare.audio_factory:#### Default input device info #####
DEBUG:sopare.audio_factory:defaultSampleRate: 48000.0
DEBUG:sopare.audio_factory:defaultLowOutputLatency: -1.0
DEBUG:sopare.audio_factory:defaultLowInputLatency: 0.0213333333333
DEBUG:sopare.audio_factory:maxInputChannels: 128
DEBUG:sopare.audio_factory:structVersion: 2
INFO:sopare.worker:worker queue runner started
DEBUG:sopare.audio_factory:hostApi: 0
DEBUG:sopare.audio_factory:index: 5
DEBUG:sopare.audio_factory:defaultHighOutputLatency: -1.0
DEBUG:sopare.audio_factory:maxOutputChannels: 0
DEBUG:sopare.audio_factory:name: default
DEBUG:sopare.audio_factory:defaultHighInputLatency: 0.0213333333333
INFO:sopare.buffering:buffering queue runner
DEBUG:sopare.recorder:SAMPLE_RATE: 48000
DEBUG:sopare.recorder:CHUNK: 512
INFO:sopare.recorder:start endless recording
WARNING:sopare.recorder:stream read error [Errno -9981] Input overflowed
WARNING:sopare.recorder:stream read error [Errno -9988] Stream closed
WARNING:sopare.recorder:stream read error [Errno -9988] Stream closed
WARNING:sopare.recorder:stream read error [Errno -9988] Stream closed
WARNING:sopare.recorder:stream read error [Errno -9988] Stream closed

on forever

Karl

Antworten
o bishoph says:

4. März 2018 at 10:37

The recommendation for your environment is a sample rate of „44100“ but you
are using a sample rate of „48000“. Please change the sample rate in the config
file according to the recommendation and the warning should vanish.

Antworten

6. Karl says:

4. März 2018 at 8:44

ok got it to work with catching the errors and sending sigkill , then restarting itself :

recorder.recorder(cfg)
os.system(„python sopare.py „+ argList[-1]+“ &“)
os.kill(os.getpid(), signal.SIGTERM)

in main:
killOldPgm(os.getpid(),“sopare.py“)

in recording:
self.stop()
return
remove sys.exit .. that hangs

def killOldPgm(myPID,pgmToKill):
try:
cmd= „ps -ef | grep ‚“+pgmToKill+“‚ | grep -v grep“
ret =
subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE).com
municate()[0]
lines=ret.split(„\n“)

for line in lines:


print („killing ? „+ line)
if len(line) < 10: continue
items=line.split()
pid=int(items[1])
if pid == int(myPID): continue
print "killing "+pgmToKill
os.system("sudo kill -9 "+str(pid))
except Exception, e:
print ( u"killOldPgm in Line '%s' has error='%s'" % (sys.exc_traceback.tb_lineno, e))

it seems the quality of the mic has a really strong impact ..

thanks for this great piece of software

Karl

Antworten

o bishoph says:

4. März 2018 at 10:25

Yes, indeed. I have tested a lot of microphones and the ones that work flawlessly
are the more expensive ones. But I also using a 5€ mic that works as well but the
distance is limited to around 0,5m.

Now to your problem: First of all, you only get warnings and not an error. This is
important. You should be able to run SOPARE and still get some results. Not
saying best results but maybe decent results. What you can do is test different
sample_rates. Test the following sample_rates one by one and see if the warnings
disappear:

SAMPLE_RATES to test : 8000, 11025, 12000, 16000, 22050, 32000, 44100,


48000

EDIT: Your test_audio recommendation shows a recommended


SAMPLE_RATES of „44100“ so start using this one 😉

Antworten

7. Karl says:

4. März 2018 at 14:38

the
WARNING:sopare.recorder:stream read error [Errno -9988] Stream closed

repeats endlessly once started. thats why I added the self restart.
dumb question, where are the results printed eg. [u’light‘]. I would like to replace that
with a method that performs some actions.

Thanks

Karl
und viele Gruesse aus Dallas

Antworten

o bishoph says:

4. März 2018 at 16:12

Simply copy the „print“ directory which can be found in the „plugins“ directory
to create your own custom plugin. The plugins are called automatically when a
sound is recognized and you get the „readable_results“ as array in the „run“
method. Here is the code for my robotic arm example:

https://raw.githubusercontent.com/bishoph/Misc/master/robotic_arm_control.py

Antworten

8. Karl says:

4. März 2018 at 15:01

found the place where I can add the commands.. .. I am really impressed by this package.
outstanding work ..

waiting for a better mic .. arriving on Tuesday

Antworten

o bishoph says:

4. März 2018 at 16:13

Thanks 🙂

Antworten
9. Karl says:

5. März 2018 at 6:39

getting an error:
in filter.py line 61:

def get_chunked_norm(self, nfft):


….
progessive += progessive * pf

pf not defined, which is correct pf is not defined ..

Antworten

o bishoph says:

5. März 2018 at 10:44

Hi, this issue was already fixed in the testing branch:


https://github.com/bishoph/sopare/issues/14

Antworten

10. Cankut says:

5. März 2018 at 19:01

Hi Martin;
I did every step you showed in the video.However when i try to test ./sopare.py -t
„example“ i got this error.

sopare 1.5.0
ALSA lib confmisc.c:767:(parse_card) cannot find card ‚0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned
error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error:
No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM sysdefault
ALSA lib confmisc.c:767:(parse_card) cannot find card ‚0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned
error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error:
No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM sysdefault
ALSA lib confmisc.c:767:(parse_card) cannot find card ‚0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned
error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error:
No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown 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 confmisc.c:767:(parse_card) cannot find card ‚0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned
error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error:
No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:767:(parse_card) cannot find card ‚0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned
error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error:
No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:767:(parse_card) cannot find card ‚0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned
error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error:
No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:767:(parse_card) cannot find card ‚0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned
error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error:
No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:767:(parse_card) cannot find card ‚0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned
error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error:
No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:767:(parse_card) cannot find card ‚0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned
error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error:
No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:767:(parse_card) cannot find card ‚0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned
error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error:
No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib confmisc.c:767:(parse_card) cannot find card ‚0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned
error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error:
No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM iec958
ALSA lib confmisc.c:767:(parse_card) cannot find card ‚0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned
error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error:
No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:767:(parse_card) cannot find card ‚0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned
error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error:
No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
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 confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:767:(parse_card) cannot find card ‚0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned
error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error:
No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM dmix
connect(2) call to /tmp/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
Traceback (most recent call last):
File „/usr/lib/python2.7/multiprocessing/queues.py“, line 268, in _feed
send(obj)
IOError: [Errno 32] Broken pipe

Antworten

o bishoph says:

5. März 2018 at 19:22

The issue is that there seems to be no sound device/mic: „ALSA lib


confmisc.c:767:(parse_card) cannot find card ‚0‘“
I can only guess but the steps are something like:
* connect a mic
* if connected and the same error occurs edit alsa.conf to make use of the mic
* could be another issue related to your environment. Search internet for „alsa
cannot find card 0“ and see if you find a solution
*…
* clean your alsa.conf file to avoid wild messages

Hope that help 🙂

Antworten

 Cankut says:

14. März 2018 at 13:20

Thanks for your answers Martin i did all of your steps.After i write
./sopare.py -t „go“ i got this error ;
sopare 1.5.0
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
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.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 confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer
returned error: No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such
file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM
bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer
returned error: No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such
file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM
bluealsa
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
connect(2) call to /tmp/jack-1000/default/jack_0 failed (err=No such file
or directory)
attempt to connect to server failed

Antworten

 bishoph says:

14. März 2018 at 15:41

Hi. There is no SOPARE error. The output comes from the ALSA
system respective from pyaudio. As I don’t know anything about
your environment so I can only recommend to clean your alsa.conf
file to get rid of those warnings. I found a thread with the same
message and the recommendation is also to clean your alsa config:

https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=20354
7

Check if you your system is capable of record audio by running the


audio test SOPARE provides:

python test/test_audio.py

Antworten

11. Carsten says:

9. März 2018 at 2:00

Hi,

after disabling the internal sound card and adding following code to /etc/asound.conf and
~/.asoundrc
[code]
pcm.!default {
type hw
card 0
}

ctl.!default {
type hw
card 0
}
[/code]

i start „python test/test_audi.py“ and got this „Segmentation fault“…


before doing the changes to the configs, i had errors on mass, jack-server and so on…
like shown in posts above

I have a Raspi3 and an Ugreen USB sound card 2.0 and an adafruit amplified mic.

Antworten

o bishoph says:

9. März 2018 at 9:29

A segmentation fault comes normally from code with low memory access:
https://en.wikipedia.org/wiki/Segmentation_fault

As SOPARE is written in Python and uses pyaudio as bride to the hardware I can
only guess that you compiled something manually or you have installed some
incompatible (lib-)versions. The error can be nearly anywhere in the system
which means this goes beyond anything we could solve here with normal efforts
😉

My recommendation is to set up a fresh and lean Raspbian system without X and


install only the most necessary dependencies and try again.

Antworten

 Carsten says:

9. März 2018 at 12:37

This is a fresh installation, standard raspian without X, age of max. 10


minutes, sopare from git, and only the changes as mentioned.
Antworten

 Carsten says:

9. März 2018 at 12:50

There are apparently only two states. Either miles of error


messages but the test is running, Threshold 33200 and no detection
of the test word or the segmentation fault.

Antworten

 bishoph says:

9. März 2018 at 13:18

Sorry, but a segfault is something where I can’t help as it is


too deep in the system ;(

Anyway. The threshold seems to be very high so likely


SOPARE never gets something useful to analyse. The
threshold defines a peak volume when the mic input is
passed to the analysis. In all of my working environments
this value is below 1000 … just to give you an indication.

12. Carsten says:

9. März 2018 at 13:40

Ok, then there is something wrong with the mic, or the pi usb power is to noisy. the
treshold was mentioned from the soprare init test. will try a i2s mic array next. Thx

Antworten

13. Ulrich says:

26. März 2018 at 15:03

Hallo,

kann man Sopare auch beim pi 3 im Autostart hinzufügen?


Wenn ja was müsste ich dann machen?
Vielen Dank

Mit freundlichen Grüßen

Antworten

14. bishoph says:

26. März 2018 at 20:14

Sollte gehen, besser ist aber SOPARE direkt als service zu starten. Ich kann beizeiten mal
schreiben wie man das macht…

Antworten

15. Nandan G S says:

28. März 2018 at 20:26

Hey bishop,

Iam getting threshold as 12600 which is too much. Do i have to configure alsa ??

pi@raspberrypi:~/sopa/sopare $ python test/test_audio.py


test_audio init…
ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection
refused

ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection


refused

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


Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
testing different SAMPLE_RATEs … this may take a while!

DEBUG:sopare.audio_factory:#### Default input device info #####


DEBUG:sopare.audio_factory:defaultSampleRate: 48000.0
DEBUG:sopare.audio_factory:defaultLowOutputLatency: -1.0
DEBUG:sopare.audio_factory:defaultLowInputLatency: 0.00797916666667
DEBUG:sopare.audio_factory:maxInputChannels: 1
DEBUG:sopare.audio_factory:structVersion: 2
DEBUG:sopare.audio_factory:hostApi: 0
DEBUG:sopare.audio_factory:index: 2
DEBUG:sopare.audio_factory:defaultHighOutputLatency: -1.0
DEBUG:sopare.audio_factory:maxOutputChannels: 0
DEBUG:sopare.audio_factory:name: USB Device 0x46d:0x825: Audio (hw:1,0)
DEBUG:sopare.audio_factory:defaultHighInputLatency: 0.032
Expression ‚paInvalidSampleRate‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2048
Expression ‚PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self-
>primeBuffers, hwParamsCapture, &realSr )‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘,
line: 2719
Expression ‚PaAlsaStream_Configure( stream, inputParameters, outputParameters,
sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )‘
failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2843
ERROR:sopare.audio_factory:Error: [Errno Invalid sample rate] -9997
Expression ‚paInvalidSampleRate‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2048
Expression ‚PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self-
>primeBuffers, hwParamsCapture, &realSr )‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘,
line: 2719
Expression ‚PaAlsaStream_Configure( stream, inputParameters, outputParameters,
sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )‘
failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2843
ERROR:sopare.audio_factory:Error: [Errno Invalid sample rate] -9997
Expression ‚paInvalidSampleRate‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2048
Expression ‚PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self-
>primeBuffers, hwParamsCapture, &realSr )‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘,
line: 2719
Expression ‚PaAlsaStream_Configure( stream, inputParameters, outputParameters,
sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )‘
failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2843
ERROR:sopare.audio_factory:Error: [Errno Invalid sample rate] -9997
Expression ‚paInvalidSampleRate‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2048
Expression ‚PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self-
>primeBuffers, hwParamsCapture, &realSr )‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘,
line: 2719
Expression ‚PaAlsaStream_Configure( stream, inputParameters, outputParameters,
sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )‘
failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2843
ERROR:sopare.audio_factory:Error: [Errno Invalid sample rate] -9997
Expression ‚paInvalidSampleRate‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2048
Expression ‚PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self-
>primeBuffers, hwParamsCapture, &realSr )‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘,
line: 2719
Expression ‚PaAlsaStream_Configure( stream, inputParameters, outputParameters,
sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )‘
failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2843
ERROR:sopare.audio_factory:Error: [Errno Invalid sample rate] -9997
testing different CHUNK sizes … this may take a while!

Excellent. Got all 5120 chunks.


Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Excellent. Got all 40960 chunks.
Excellent. Got all 81920 chunks.
Excellent. Got all 5120 chunks.
Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Excellent. Got all 40960 chunks.
Excellent. Got all 81920 chunks.
Excellent. Got all 5120 chunks.
Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Excellent. Got all 40960 chunks.
Excellent. Got all 81920 chunks.

Your sopare/config.py recommendations:

SAMPLE_RATE = 48000
CHUNK = 512
THRESHOLD = 12600

Please reply.

Antworten

16. Nandan G S says:

28. März 2018 at 20:31

Hey,

when i run ./sopare.py -v -t test


DEBUG:sopare.worker:meta = [{‚token‘: ’stop‘}]
INFO:sopare.recorder:Buffering not alive, stop recording
INFO:sopare.recorder:stop endless recording

how to debug this ?

pi@raspberrypi:~/sopa/sopare $ ./sopare.py -v -t test


sopare 1.5.0
ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection
refused

ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection


refused

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


Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
INFO:sopare.analyze:checking for plugins…
DEBUG:sopare.analyze:loading and initialzing plugins/print
DEBUG:sopare.audio_factory:#### Default input device info #####
INFO:sopare.worker:worker queue runner started
DEBUG:sopare.audio_factory:defaultSampleRate: 48000.0
DEBUG:sopare.audio_factory:defaultLowOutputLatency: -1.0
DEBUG:sopare.audio_factory:defaultLowInputLatency: 0.00797916666667
DEBUG:sopare.audio_factory:maxInputChannels: 1
DEBUG:sopare.audio_factory:structVersion: 2
DEBUG:sopare.audio_factory:hostApi: 0
DEBUG:sopare.audio_factory:index: 2
DEBUG:sopare.audio_factory:defaultHighOutputLatency: -1.0
DEBUG:sopare.audio_factory:maxOutputChannels: 0
DEBUG:sopare.audio_factory:name: USB Device 0x46d:0x825: Audio (hw:1,0)
DEBUG:sopare.audio_factory:defaultHighInputLatency: 0.032
INFO:sopare.buffering:buffering queue runner
DEBUG:sopare.recorder:SAMPLE_RATE: 48000
DEBUG:sopare.recorder:CHUNK: 512
INFO:sopare.recorder:start endless recording
INFO:sopare.processing:starting append mode
DEBUG:sopare.filter:New window!
DEBUG:sopare.worker:characteristic = 0 {‚dfm‘: 8392550, ‚peaks‘: [8, 15], ‚df‘: 63,
‚volume‘: 9612, ‚fc‘: 255.9, ’norm‘: [0.10594115523225008, 0.10158322877562957,
0.11681804231105489, 0.1068257056148099, 0.12176796351005956,
0.11209939201357319, 0.11759502901369843, 0.12503041757929728,
0.14295509295512973, 0.1070191763533646, 0.11333741569275226,
0.10356867771497102, 0.10517339535918468, 0.10650379064074418,
0.11714289851848253, 0.131390592120332, 0.09705024201595135,
0.09655979182149141, 0.11637940402477487, 0.1006688351272602,
0.09423555310449071, 0.12549780259002877, 0.09516164280750142,
0.11825248043989187, 0.10227699566410674, 0.09949168264985163,
0.08828491072525728, 0.11273756863678466, 0.09170913880801336,
0.10735042608047875, 0.09688408426832594, 0.08547141747078266,
0.09609075003796842, 0.0964611191282749, 0.11163953426146789,
0.08616867620694622, 0.08769690713626388, 0.08706560276741793,
0.08993791132326426, 0.0951527940811163, 0.12830248982376538,
0.09952743652502033, 0.08884856749517457, 0.09239102974294733,
0.09092245938869348, 0.08448179666122957, 0.10403397291110868,
0.09088023475480482, 0.08570597421010066, 0.08948350537745008,
0.07877256061356505, 0.08257108177758929, 0.0987806117268587,
0.08496997847138044, 0.08193184047908449, 0.08864385050594285,
0.08722686605697104, 0.08913779248114005, 0.08035649432361833,
0.0901549042144198, 0.07669151671168899, 0.08583583761035314,
0.08482462283809358, 0.08500600200346071, 0.09243170448728302,
0.0945426825120565, 0.08357031972273939, 0.084045815362883,
0.08320151327230363, 0.0903627583300921, 0.0798217437948932,
0.09269861204418268, 0.08453347895873428, 0.08503204282709025,
0.08791641270680751, 0.08378257655395593, 0.08282180116769983,
0.0811500322408955, 0.08231425668231578, 0.08547998546658354,
0.0900528102089543, 0.08483703966188035, 0.0896208185383541,
0.09079794642405874, 0.09198839739529613, 0.08884273409864274,
0.08575794916245694, 0.07478585767554269, 0.08196022964387799,
0.0920031300703268, 0.0870321485753616, 0.08420359558452448,
0.08641863836919976, 0.09494250941832272, 0.09177906586338158,
0.09318078639298588, 0.08920778364930738, 0.09759967892173155,
0.08155563760434316, 0.07860070876220698, 0.08507211331860365,
0.08100867092670498, 0.08168634896715157, 0.1012084548038084,
0.0877466158127226, 0.0810468934879292, 0.058217545366710866,
0.05650011352227838, 0.06197183816331754, 0.0825206316801464,
0.060560695024661756, 0.05679567169102145, 0.05189418886700866,
0.05947670577671059, 0.046404246417839044, 0.062401216853387786],
‚token_peaks‘: [3616417, 3477013, 3741406, 4055078, 4173553, 3966424]}
DEBUG:sopare.worker:meta = [{‚adapting‘: 3966424, ‚token_peaks‘: [3616417,
3477013, 3741406, 4055078, 4173553, 3966424], ‚pos‘: 6, ‚volume‘: 9612, ‚token‘:
‚token‘, ’silence‘: 1}]
DEBUG:sopare.worker:characteristic = 1 {‚dfm‘: 15758218, ‚peaks‘: [8], ‚df‘: 63,
‚volume‘: 7632, ‚fc‘: 233.1, ’norm‘: [0.11068015788057073, 0.10892327765714963,
0.10950146099201594, 0.10925153921323472, 0.12098632893293138,
0.11343284527743924, 0.10947997850911097, 0.12886674608597318,
0.133687773567616, 0.11611381070851311, 0.11608437016474935,
0.10013509754574351, 0.11117590834000986, 0.11162666355341658,
0.13018971403977217, 0.1302635679862645, 0.10925689315880026,
0.0995778723806147, 0.1026015890341256, 0.09202280740428172,
0.10115738153832864, 0.12324746950058255, 0.08654858904790462,
0.09735178394566106, 0.10178716052893438, 0.098503733874218,
0.1072688294023852, 0.12297510423628465, 0.1040194003283266,
0.09447341814929792, 0.10162939508038966, 0.08721999238611453,
0.0916522514419516, 0.10276547150245925, 0.10878723861004246,
0.09679073498519697, 0.09703292898298091, 0.09325450796711483,
0.1046750071868504, 0.11331594282794624, 0.12618647905901306,
0.10331600937534441, 0.09540656216626028, 0.09685536650892972,
0.08821441706792908, 0.08124323868468077, 0.09038522566667574,
0.08850035513957531, 0.08436435371731368, 0.08159372539295795,
0.08260771131845221, 0.08779927398085455, 0.0942104227051756,
0.09526309099419712, 0.08849547115284771, 0.08359781275174556,
0.08076220745016971, 0.08516363865549413, 0.08483879056234866,
0.09137040595048612, 0.07968627004756744, 0.07820159399363144,
0.07275768591521893, 0.07875933196677881, 0.0869581534193286,
0.09763125834334756, 0.08030221082547434, 0.08277792267460587,
0.0793090948163051, 0.07568855040890213, 0.08272938145738673,
0.08694044712151928, 0.08083467513304822, 0.08059023620852677,
0.08040059036989283, 0.073690547709575, 0.07681978903106366,
0.07879496368974068, 0.07994845396234244, 0.08033775123589551,
0.08863134178364507, 0.0820835433739588, 0.08316367907282605,
0.0805585059905549, 0.08797931692095796, 0.08581859855457068,
0.08279642610196618, 0.08331158460462718, 0.07763614630871592,
0.08811461316674872, 0.08993435603674965, 0.08528077045104286,
0.08125860242094271, 0.08576660630745814, 0.08930374150366625,
0.08979937030927897, 0.09616704846241522, 0.09186035430786045,
0.08243907823096931, 0.07588657178993195, 0.08315395022596402,
0.08002696512779799, 0.09061913174083243, 0.10050361589836874,
0.07704733125715547, 0.07392927081283802, 0.07887475480347615,
0.07102557264500815, 0.07054729100249378, 0.08035262535647872,
0.0614732278550356, 0.05731852513887314, 0.06545629676371222,
0.061591070473517424, 0.06292917473859498, 0.07021680053188344],
‚token_peaks‘: [4172321, 4176452, 3750138, 3355692, 3428014, 3324366]}
DEBUG:sopare.worker:meta = [{‚adapting‘: 3324366, ‚token_peaks‘: [4172321,
4176452, 3750138, 3355692, 3428014, 3324366], ‚pos‘: 12, ‚volume‘: 7632, ‚token‘:
‚token‘, ’silence‘: 7}]
DEBUG:sopare.worker:characteristic = 2 {‚dfm‘: 10822998, ‚peaks‘: [8], ‚df‘: 63,
‚volume‘: 6422, ‚fc‘: 280.8, ’norm‘: [0.10581791842163109, 0.10605482058542506,
0.11336416838586244, 0.1082301489384921, 0.11529507336051051,
0.11835125545888266, 0.10548498487091319, 0.11763119013613214,
0.1389229571700896, 0.12635480827032822, 0.11504361655816592,
0.10852292055271702, 0.1062011285565714, 0.11232780736671044,
0.11785586339698804, 0.11600115012229746, 0.1076731514664409,
0.1028056270567882, 0.11338731928176739, 0.10492660305576688,
0.10296603669335348, 0.11866853474122073, 0.09476520516555677,
0.0978819677514007, 0.10849857672389103, 0.0987947565992829,
0.09682620264785975, 0.10931609008181835, 0.09757848613296663,
0.1022928372203376, 0.113880657340897, 0.08419296941788891,
0.0948120632572979, 0.10803468599091018, 0.1036838910659119,
0.09470839177771934, 0.09307316444570997, 0.09535127879435283,
0.10155564080785906, 0.1065559848340397, 0.11716355087550123,
0.10098687499353115, 0.09142297665737181, 0.0875012726589464,
0.08971666458722653, 0.09906225545814656, 0.11574767312370496,
0.09547515966014006, 0.09030746892801653, 0.09038010314389687,
0.07301208716954645, 0.08791547831833514, 0.09955899383132472,
0.10414379437108194, 0.07958644266980203, 0.08030985043033224,
0.07368295977199055, 0.08798896613254013, 0.09263761024520419,
0.09969149629901411, 0.09112799565650126, 0.08246432596789308,
0.06889158903460423, 0.07406805783740222, 0.07710478130561359,
0.08016952119447719, 0.08092531519401204, 0.0740105063997355,
0.07693216244928147, 0.0783154304469863, 0.07560513951050767,
0.08295556054330248, 0.09370585465282834, 0.08473244375800686,
0.07458819447995442, 0.08020070134905757, 0.08004390236445444,
0.08174062695680326, 0.08881490812123694, 0.07132774535023173,
0.07965668391016846, 0.08098323283312012, 0.08067214629521095,
0.0860524466381488, 0.08385493737513072, 0.0715613535946179,
0.06992006565701778, 0.07266199973402815, 0.071352132562571,
0.08445594543957893, 0.08120997923203284, 0.08668128057859228,
0.08592829607099754, 0.09054553267616251, 0.08248040413978959,
0.09628135676093542, 0.09450406173677667, 0.09911789323995118,
0.08996589519846919, 0.07680365722610055, 0.07462735303446914,
0.07947764867115721, 0.0864735239900374, 0.094354337644113,
0.0960283751298775, 0.08405404033684563, 0.07927660001828633,
0.06970702071947649, 0.06776840229701961, 0.07337067755446128,
0.0736303253339122, 0.0703148091725682, 0.07007594283805099,
0.06585695016431346, 0.06950676611855888, 0.062443776663468814],
‚token_peaks‘: [3052382, 3120958, 3103405, 3201110, 3299518, 2769444]}
DEBUG:sopare.worker:meta = [{‚adapting‘: 2769444, ‚token_peaks‘: [3052382,
3120958, 3103405, 3201110, 3299518, 2769444], ‚pos‘: 18, ‚volume‘: 6422, ‚token‘:
‚token‘, ’silence‘: 13}]
DEBUG:sopare.worker:characteristic = 3 {‚dfm‘: 6322293, ‚peaks‘: [8], ‚df‘: 63,
‚volume‘: 4647, ‚fc‘: 240.0, ’norm‘: [0.10855326787986203, 0.11988165660857696,
0.11235734242660417, 0.11035581573963417, 0.12412173816951932,
0.12130134032912554, 0.11364914330330576, 0.12178471782755591,
0.13652894470632015, 0.12132512489225056, 0.1254914704635434,
0.1052871651577213, 0.11479411845367399, 0.11077874075265022,
0.12423477328896303, 0.12493586281651664, 0.11462207260240831,
0.10645926966846009, 0.1203233925383145, 0.1182653859953795,
0.10761701870169912, 0.11686519096838552, 0.10138090514079384,
0.10571815066377718, 0.1143855286387913, 0.09820152828806997,
0.10428981464317276, 0.1128420241784679, 0.107723375294073,
0.11497411819276986, 0.11102017896361516, 0.10610583412363199,
0.09712375106295294, 0.11034560167022699, 0.10067637864033792,
0.09020481088482822, 0.08816709446273101, 0.09740153071075497,
0.1017409972781802, 0.10147410885903645, 0.11561230198877746,
0.10921407410608151, 0.09875931430901104, 0.09297524123896193,
0.10155571302309918, 0.1094829030639, 0.10589134111170113,
0.09712319517506693, 0.08350426129269158, 0.08315650009880268,
0.08397899371784093, 0.09176417678477558, 0.08933383071820669,
0.09275299327663482, 0.08067319167641629, 0.07375609048685976,
0.07662351527635547, 0.08138680117295412, 0.08618070309118626,
0.08612559170762032, 0.08697770117134307, 0.07845180988594268,
0.06898235116167468, 0.06812982740372339, 0.08023109321915362,
0.0681792477421301, 0.07718032910405818, 0.07315392144333717,
0.0790934387176276, 0.06672576621212886, 0.07307943111992152,
0.08584127744770721, 0.08838881515808449, 0.080537601638494,
0.07714430632569692, 0.08456363729669164, 0.07575087809978932,
0.080253036999646, 0.08617611540176119, 0.0793173757958112,
0.08418381384934229, 0.08143522299066627, 0.08103397116443894,
0.08188260905956006, 0.07478280649039631, 0.07428188995863379,
0.08320651749901757, 0.08037532820818691, 0.08075526803504482,
0.08268544964650343, 0.07521969975141837, 0.0835969240926626,
0.07962677022887442, 0.08921966035383974, 0.09987073932786306,
0.0928774310506771, 0.08461286040129709, 0.08040759997552764,
0.0778986425026996, 0.08461164645205498, 0.08054683974946338,
0.07508114567263648, 0.0735886607108803, 0.07304375718897545,
0.07541087978508859, 0.06981161178216576, 0.05836018253707988,
0.06502215006220208, 0.06496215823550108, 0.058435850352795735,
0.06451628439181437, 0.05978289168851602, 0.06458018497634643,
0.06174771867339091, 0.0552114496314654, 0.059246006361588166], ‚token_peaks‘:
[1672951, 2367040, 2746036, 2450277, 1913249, 1898158]}
DEBUG:sopare.worker:meta = [{‚adapting‘: 1898158, ‚token_peaks‘: [1672951,
2367040, 2746036, 2450277, 1913249, 1898158], ‚pos‘: 24, ‚volume‘: 4647, ‚token‘:
‚token‘, ’silence‘: 19}]
DEBUG:sopare.worker:characteristic = 4 {‚dfm‘: 321099, ‚peaks‘: [0, 1, 2, 3, 4, 5, 6],
‚df‘: 21, ‚volume‘: 5037, ‚fc‘: 40.6, ’norm‘: [0.2619028560998012,
0.2584401248907598, 0.24870154248193332, 0.23974913839581466,
0.21234790979988272, 0.20285966187865048, 0.2059984784201099,
0.18943971048077432, 0.1859114789412215, 0.19205817995384908,
0.18830059743924318, 0.17533988861415378, 0.1615914206493285,
0.17448164297611463, 0.14583016392954318, 0.1340603258526513,
0.13620468457844825, 0.1154727395142478, 0.10854530692114216,
0.1107366900141, 0.10671186398656797, 0.11332331641505256,
0.10807088087701641, 0.11257097719170273, 0.11225130925977467,
0.10917548179855306, 0.1063013349463308, 0.10400749558241827,
0.10493233364455351, 0.10663445446430081, 0.10325094268804799,
0.10687537258448, 0.10486940247261027, 0.10360901909337589,
0.10301063421275973, 0.10420222620633035, 0.0994977497463492,
0.10075792114946375, 0.10272011692404485, 0.09688944456231859,
0.09905152324416647, 0.09640581454982615, 0.09467861413291011,
0.09711167764555939, 0.09627125274411126, 0.10097253787125138,
0.10037061593819081, 0.037791070039412795], ‚token_peaks‘: [1982642]}
DEBUG:sopare.worker:meta = [{‚adapting‘: 1982642, ‚token_peaks‘: [1982642], ‚pos‘:
25, ‚volume‘: 5037, ‚token‘: ’start analysis‘, ’silence‘: 20, ‚peaks‘: [3616417, 3477013,
3741406, 4055078, 4173553, 3966424, 4172321, 4176452, 3750138, 3355692, 3428014,
3324366, 3052382, 3120958, 3103405, 3201110, 3299518, 2769444, 1672951, 2367040,
2746036, 2450277, 1913249, 1898158, 1982642]}]
INFO:sopare.processing:stop append mode because of silence
INFO:sopare.buffering:stop buffering
INFO:sopare.buffering:terminating queue runner
DEBUG:sopare.worker:characteristic = 0 {‚dfm‘: 3892313, ‚peaks‘: [1, 4, 8, 21, 25],
‚df‘: 42, ‚volume‘: 0, ‚fc‘: 305.0, ’norm‘: [0.12186802790214678,
0.13080891551103055, 0.1212424618273694, 0.10749034919516054,
0.13049949325253338, 0.12018022923531185, 0.11823400887258916,
0.12203054304889921, 0.13181772199821112, 0.11497576846972322,
0.10956602536368738, 0.10558752026979325, 0.1203345690802792,
0.1192430273653921, 0.10656627421973533, 0.10472071060986202,
0.0997721982387202, 0.116321647767816, 0.11010606129188875,
0.1081948446098083, 0.11441782252900576, 0.1366377857742258,
0.11715404933680348, 0.10904624522273769, 0.1259446607970954,
0.13170974029569618, 0.11462481217629458, 0.10383911108465739,
0.09108323127204541, 0.11234058339799607, 0.10558943137797346,
0.10037767120544433, 0.10295287947313962, 0.10999822415190932,
0.1149227032454728, 0.1023801725143503, 0.09255665153362261,
0.10362962346967078, 0.11170807953850065, 0.09152739302212169,
0.08307715895878871, 0.08431811001418829, 0.08929606563548068,
0.07963977222758192, 0.08744962905833661, 0.09588509638237112,
0.10794972811652653, 0.09284432528414935, 0.09099748426067306,
0.09168117735481741, 0.10339800628948617, 0.09818720216759623,
0.10242589526235996, 0.0982647217804685, 0.09503730976984404,
0.09630465853008012, 0.09377146354281256, 0.0993111135685496,
0.10452497171478106, 0.11628211457065342, 0.09128618246161972,
0.09910844911636962, 0.08783132370324502, 0.10155368522577357,
0.08984106469709383, 0.08958473387061905, 0.07667102222619779,
0.09605945933060424, 0.08148940813469495, 0.08140504737463186,
0.0759031878820749, 0.08240714564233438, 0.08567061103042466,
0.07246599616038686, 0.07099681173423435, 0.07320920917524879,
0.07542749405784382, 0.06916280773541826, 0.06512493038479668,
0.07255639584756063, 0.07985529543398963, 0.07743519860806157,
0.0730592493323577, 0.07252063016994456, 0.08297621567593276,
0.07111807077836756, 0.06570071384315053, 0.06422459973841342,
0.07070934383279139, 0.07187110797359993, 0.06904881924657293,
0.06827812902698556, 0.06810478312933466, 0.0653798309750733,
0.06585177413961527, 0.06746700305329596, 0.06646068456090505,
0.06805150897625659, 0.0673691711322931, 0.0656158642196494,
0.06507348317151576, 0.06576881722881762, 0.06513970327478455,
0.06536203651051563, 0.06510918337921134, 0.06552765463015604,
0.0657021060962171, 0.06474735206414985, 0.06506403668516,
0.06413699386872466, 0.06373374906865399, 0.06519021105065669,
0.06414968883589146, 0.0646257294378876, 0.06415311390701,
0.0643207783485798], ‚token_peaks‘: []}
DEBUG:sopare.worker:meta = [{‚token‘: ’stop‘}]
INFO:sopare.recorder:Buffering not alive, stop recording
INFO:sopare.recorder:stop endless recording

Antworten

o bishoph says:

29. März 2018 at 0:35

During the test SOPARE detects the environmental sound level. This means you
should be silent during the test. If this is the normal sound level you should move
😉

Antworten

17. karthik says:

29. März 2018 at 9:53

I am using a webcam with mic. Do i have to cognfigure alsa to use sopare ?

If yes , how to do it ?

Antworten

o bishoph says:
29. März 2018 at 17:47

Think so. ALSA config is for sound so there should be no difference if you
configure your mic…

Antworten

18. Carsten says:

1. April 2018 at 17:50

Hallo,

ich habe das ReSpeaker 4-Mic Array


(http://wiki.seeedstudio.com/ReSpeaker_4_Mic_Array_for_Raspberry_Pi/#install-driver)
von seeedstudio. Aufnahme über die Kommandozeile funktionieren. Die test_audio_py
bringt mir aber folgenden Fehler:
[code]
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2495: …

test_audio init…
DEBUG:sopare.audio_factory:#### Default input device info #####
DEBUG:sopare.audio_factory:defaultSampleRate: 44100.0
DEBUG:sopare.audio_factory:defaultLowOutputLatency: -1.0
DEBUG:sopare.audio_factory:defaultLowInputLatency: 0.00580498866213
DEBUG:sopare.audio_factory:maxInputChannels: 4
DEBUG:sopare.audio_factory:structVersion: 2
DEBUG:sopare.audio_factory:hostApi: 0
DEBUG:sopare.audio_factory:index: 0
DEBUG:sopare.audio_factory:defaultHighOutputLatency: -1.0
DEBUG:sopare.audio_factory:maxOutputChannels: 0
DEBUG:sopare.audio_factory:name: seeed-4mic-voicecard: – (hw:0,0)
DEBUG:sopare.audio_factory:defaultHighInputLatency: 0.0348299319728
Expression ‚paInvalidSampleRate‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2048
Expression ‚PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self-
>primeBuffers, hwParamsCapture, &realSr )‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘,
line: 2719
Expression ‚PaAlsaStream_Configure( stream, inputParameters, outputParameters,
sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )‘
failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2843
ERROR:sopare.audio_factory:Error: [Errno -9997] Invalid sample rate
Expression ‚paInvalidSampleRate‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2048
Expression ‚PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self-
>primeBuffers, hwParamsCapture, &realSr )‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘,
line: 2719
Expression ‚PaAlsaStream_Configure( stream, inputParameters, outputParameters,
sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )‘
failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2843
ERROR:sopare.audio_factory:Error: [Errno -9997] Invalid sample rate
[/code]

Ich vermute die Samplerate ist zu hoch beim Test, danach ist das Array nicht mehr
ansprechbar bis zum Reboot. Wo kann ich diese einstellen? Bei der Befehlszeile „arecord
-Dac108 -f S32_LE -r 16000 -c 4 hello.wav“ wird z.B. 16k angegeben, weiß nur nicht, ob
daß das Maximum darstellt.

Vielen Dank

Antworten

19. Carsten says:

1. April 2018 at 18:49

Ergänzung:

„arecord -f S32_LE -r 48000 -c 4 hello.wav“ funktioniert, also hohe Samplerate auch


kein Problem. Warum dann nicht im Sopare-Test?
Ich habe in der test_audio.py nur 16000 eingetragen, dann lief der Test erstmal bis zum
Chunktest (‚testing different CHUNK sizes … this may take a while!), ab da erfolgt keine
Ausgabe mehr. Strg+C bricht den Test auch nicht ab.

Antworten

o bishoph says:

1. April 2018 at 20:01

Hi. Das ist recht speziell und ich weiß nicht warum das nicht geht. Ohne die
Hardware wird das schwierig. Mach bitte einen Bug auf GitHub auf und wir
hoffen das das jemand lösen kann.

Antworten

20. Dominic says:


5. April 2018 at 21:08

Hey,

ansich ein super Programm, tut was es soll.


Nur habe ich ein Problem, wenn ich per ./sopare.py -l starte, funktioniert die ersten 20-
30sek alles super, die Wörter werden erkannt und auch die für die Wörter hinterlegten
Befehle werden ausgeführt. Aber nach 20-30sek hängt sich sopare anscheinend auf,
zumindest nimmt es keine neuen Befehle mehr wahr, egal ob es gelernte Wörter sind
oder nicht(die nichterkannten werden ja mit [] angezeigt, soweit ich das richtig verstehe).
Mit „ctrl+x“ kann ich das ganze dann beenden un wieder neu starten, dann geht das Spiel
wieder von vorne los.

Auch werden mir bei erkannten Wörtern ein „u“ davor gesetzt, was in deinen Videos ja
nicht der Fall ist(bei mir sieht das dann so aus [u’an‘]). Hat das irgendeine bedeutung, die
villeicht dazu führen tut, dass sich sopare aufhängt?

viele Grüße

Antworten

o bishoph says:

6. April 2018 at 7:54

Hi. Das „u“ steht für Unicode und ist ganz normal und soll so sein.
Für alles andere bräuchte man mehr Info…

Antworten

21. Dominic says:

5. April 2018 at 21:48

Hab grad festgestellt, dass sobald sich sopare aufhängt die cpu für das Pythonscript auf
25% „hängen“ bleibt und dessen Memory kontinuirlich ansteigt. Villeicht bleibt das
Script in irgend einer Dauerschleife hängen?

Antworten

o bishoph says:

6. April 2018 at 7:56


Schwer zu sagen was passiert und warum. Was macht denn dein Plugin und
welchen Pi nutzt du?

Antworten

 Dominic says:

6. April 2018 at 23:05

Werde mal ne log erstellen lassen, vllt kann man daraus dann irgend was
brauchbares herausfiltern. Bin momentan aber unterwegs, wird noch 2-3
Tage dauern bis ich das machen kann.

Was ich auch festgestellt habe, wenn ich das Script starte, und viel
hintereinander sage, hängt er sich schnell auf(eben diese 20-30sek). Aber
wenn ich zwischen den Ansagen immer eine Pause lasse (60-90sek), dann
läuft das Script 5-6min und hängt sich dann erst auf. Eventuell kommt er
mit viel „gerede“ nicht klar. Was auch sein kann, dass mein Mic eventuell
Probleme macht und den so falsche Signale rein schickt und das zu den
Fehler führt(ist nähmlich schon etwas älter und funktioniert auch nicht
mehr so ganz 100%tig, aber neues ist schon unterwegs, vllt ist das ja des
Rätsels Lösung).

Habe eine Pi2, mit der altuellen Raspian drauf laufen.

viele Grüße

Antworten

22. Carsten says:

6. April 2018 at 11:02

Hallo (schon wieder ;))

das 4MicArray hab ich erstmal bei Seite gelegt (meine Nerven 😉 ) – wenn Du möchtest,
schicke ich dir das zu Testzwecken, jetzt ist das 2-MicHat dran. Aber auch hier gibt es
Probleme…
ich habe mir mal die von pyaudio erkannten Geräte anzeigen lassen:
[code]
import pyaudio
p = pyaudio.PyAudio()
for i in range(p.get_device_count()):#list all available audio devices
dev = p.get_device_info_by_index(i)
print((i,dev[’name‘],dev[‚maxInputChannels‘]))

Ausgabe:
(0, u’seeed-2mic-voicecard: – (hw:0,0)‘, 2L)
(1, u’sysdefault‘, 128L)
(2, u’playback‘, 0L)
(3, u’capture‘, 128L)
(4, u’dmixed‘, 0L)
(5, u’array‘, 2L)
(6, u’dmix‘, 0L)
(7, u’default‘, 128L)
[/code]
Scheinbar nutzt sopare immer das default Gerät, wird auch immer bei der Ausgabe der
test_audio.py angezeigt „DEBUG:sopare.audio_factory:maxInputChannels: 128
DEBUG:sopare.audio_factory:name: default“,
war auch beim 4MicArray so…. und ging deshalb vielleicht nicht.
Die Soundconfig wird bei der Treiberinstallation der Arrays vorgenommen, die
Erkennung funktioniert auch und ist über arecord ohne Angabe der Hardware möglich.
asound.conf
[code]
# The IPC key of dmix or dsnoop plugin must be unique
# If 555555 or 666666 is used by other processes, use another one

pcm.!default {
type asym
playback.pcm „playback“
capture.pcm „capture“
}

pcm.playback {
type plug
slave.pcm „dmixed“
}

pcm.capture {
type plug
slave.pcm „array“
}

pcm.dmixed {
type dmix
slave.pcm „hw:0,0“
ipc_key 555555
}
pcm.array {
type dsnoop
slave {
pcm „hw:0,0“
channels 2
}
ipc_key 666666
}
[/code]

Ausgabe von arecord:


[code]
**** List of CAPTURE Hardware Devices ****
card 0: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi
wm8960-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
[/code]

Warum nutzt sopare aber ein anderes Gerät? Wie kann ich das verhindern?
[code]
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.phoneline
ALSA lib pcm_dmix.c:990:(snd_pcm_dmix_open) The dmix plugin supports only
playback stream
ALSA lib pcm_dsnoop.c:556:(snd_pcm_dsnoop_open) The dsnoop plugin supports only
capture stream
ALSA lib pcm_dmix.c:990:(snd_pcm_dmix_open) The dmix plugin supports only
playback stream
ALSA lib pcm_dsnoop.c:556:(snd_pcm_dsnoop_open) The dsnoop plugin supports only
capture stream
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
test_audio init…
DEBUG:sopare.audio_factory:#### Default input device info #####
DEBUG:sopare.audio_factory:defaultSampleRate: 48000.0
DEBUG:sopare.audio_factory:defaultLowOutputLatency: 0.125
DEBUG:sopare.audio_factory:defaultLowInputLatency: 0.125
DEBUG:sopare.audio_factory:maxInputChannels: 128
DEBUG:sopare.audio_factory:structVersion: 2
DEBUG:sopare.audio_factory:hostApi: 0
DEBUG:sopare.audio_factory:index: 7
DEBUG:sopare.audio_factory:defaultHighOutputLatency: 0.125
DEBUG:sopare.audio_factory:maxOutputChannels: 128
DEBUG:sopare.audio_factory:name: default
DEBUG:sopare.audio_factory:defaultHighInputLatency: 0.125
Expression ‚alsa_snd_pcm_hw_params_set_rate_near( pcm, hwParams, &setRate, NULL
)‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 3201
Expression ‚paUnanticipatedHostError‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line:
2053
Expression ‚PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self-
>primeBuffers, hwParamsCapture, &realSr )‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘,
line: 2719
Expression ‚PaAlsaStream_Configure( stream, inputParameters, outputParameters,
sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )‘
failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2843
ERROR:sopare.audio_factory:Error: [Errno -9999] Unanticipated host error
Expression ‚alsa_snd_pcm_hw_params_set_rate_near( pcm, hwParams, &setRate, NULL
)‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 3201
Expression ‚paUnanticipatedHostError‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line:
2053
Expression ‚PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self-
>primeBuffers, hwParamsCapture, &realSr )‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘,
line: 2719
Expression ‚PaAlsaStream_Configure( stream, inputParameters, outputParameters,
sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )‘
failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2843
ERROR:sopare.audio_factory:Error: [Errno -9999] Unanticipated host error
ERROR:sopare.audio_factory:Error: Stream not open
testing different SAMPLE_RATEs … this may take a while!

testing different CHUNK sizes … this may take a while!

Excellent. Got all 5120 chunks.


Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Excellent. Got all 40960 chunks.
Excellent. Got all 81920 chunks.
Excellent. Got all 5120 chunks.
Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Excellent. Got all 40960 chunks.
Excellent. Got all 81920 chunks.
Excellent. Got all 5120 chunks.
Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Excellent. Got all 40960 chunks.
Excellent. Got all 81920 chunks.
Excellent. Got all 5120 chunks.
Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Excellent. Got all 40960 chunks.
Excellent. Got all 81920 chunks.
Excellent. Got all 5120 chunks.
Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Excellent. Got all 40960 chunks.
Excellent. Got all 81920 chunks.
Excellent. Got all 5120 chunks.
Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Error: [Errno -9981] Input overflowed
Excellent. Got all 81920 chunks.

Your sopare/config.py recommendations:

SAMPLE_RATE = 48000
CHUNK = 512
THRESHOLD = 3400
[/code]

Anmerkung: Das System ist gerade neu aufgesetzt, nur die notwendigen Pakete
installiert. Keine manuellen Änderungen vorgenommen!

MfG & Danke

Antworten

o bishoph says:

6. April 2018 at 17:58

Es ist korrekt das SOPARE immer das default nutzt und eine Änderung geht nur
über die ALSA config da dies die Python Schnittstelle von pyAudio ist…

Antworten

 Carsten says:

7. April 2018 at 1:24


Ja aber was ist Default Device, wenn es nur dieses eine Device gibt? Die
interner Soundkarte ist deaktiviert. Es gibt nur dieses 2Mic Hat… Und wo
kommen die 128 Kanäle her. Ich glaube ich gebe echt hier auf…

Trozdem Danke für dir Hilfe und das Angebot steht immer noch bzgl. des
4Mic Arrays zu testen 😉

Antworten

23. Carsten says:

7. April 2018 at 19:18

…einen Schritt weiter 2Mic-Hat ist jetzt Default, aber wieder ein Problem beim
Ausführen von „./sopare.py -v -t test“
NameError: global name ‚pf‘ is not defined
INFO:sopare.recorder:Buffering not alive, stop recording
INFO:sopare.recorder:stop endless recording

[code]
DEBUG:sopare.audio_factory:#### Default input device info #####
DEBUG:sopare.audio_factory:defaultSampleRate: 44100.0
DEBUG:sopare.audio_factory:defaultLowOutputLatency: 0.0087074829932
DEBUG:sopare.audio_factory:defaultLowInputLatency: 0.00580498866213
DEBUG:sopare.audio_factory:maxInputChannels: 2
DEBUG:sopare.audio_factory:structVersion: 2
DEBUG:sopare.audio_factory:hostApi: 0
INFO:sopare.worker:worker queue runner started
DEBUG:sopare.audio_factory:index: 0
DEBUG:sopare.audio_factory:defaultHighOutputLatency: 0.0348299319728
DEBUG:sopare.audio_factory:maxOutputChannels: 2
DEBUG:sopare.audio_factory:name: seeed-2mic-voicecard: – (hw:0,0)
DEBUG:sopare.audio_factory:defaultHighInputLatency: 0.0348299319728
INFO:sopare.buffering:buffering queue runner
DEBUG:sopare.recorder:SAMPLE_RATE: 48000
DEBUG:sopare.recorder:CHUNK: 512
INFO:sopare.recorder:start endless recording
INFO:sopare.processing:starting append mode
DEBUG:sopare.filter:New window!
Process buffering queue:
Traceback (most recent call last):
File „/usr/lib/python2.7/multiprocessing/process.py“, line 258, in _bootstrap
self.run()
File „/home/sopare/sopare/buffering.py“, line 43, in run
self.proc.check_silence(buf)
File „/home/sopare/sopare/processing.py“, line 74, in check_silence
self.prepare.prepare(buf, volume)
File „/home/sopare/sopare/prepare.py“, line 125, in prepare
self.tokenize(meta)
File „/home/sopare/sopare/prepare.py“, line 50, in tokenize
self.filter.filter(self.buffer, meta)
File „/home/sopare/sopare/filter.py“, line 126, in filter
chunked_norm = self.get_chunked_norm(nfft)
File „/home/sopare/sopare/filter.py“, line 61, in get_chunked_norm
progessive += progessive * pf
NameError: global name ‚pf‘ is not defined
INFO:sopare.recorder:Buffering not alive, stop recording
INFO:sopare.recorder:stop endless recording
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File „/usr/lib/python2.7/atexit.py“, line 24, in _run_exitfuncs
Process worker for filtered data:
Traceback (most recent call last):
File „/usr/lib/python2.7/multiprocessing/process.py“, line 258, in _bootstrap
func(*targs, **kargs)
File „/usr/lib/python2.7/multiprocessing/util.py“, line 325, in _exit_function
self.run()
p.join()
File „/home/sopare/sopare/worker.py“, line 88, in run
File „/usr/lib/python2.7/multiprocessing/process.py“, line 145, in join
obj = self.queue.get()
File „/usr/lib/python2.7/multiprocessing/queues.py“, line 117, in get
res = self._popen.wait(timeout)
File „/usr/lib/python2.7/multiprocessing/forking.py“, line 154, in wait
res = self._recv()
KeyboardInterrupt
return self.poll(0)
File „/usr/lib/python2.7/multiprocessing/forking.py“, line 135, in poll
pid, sts = os.waitpid(self.pid, flag)
KeyboardInterrupt
Error in sys.exitfunc:
Traceback (most recent call last):
File „/usr/lib/python2.7/atexit.py“, line 24, in _run_exitfuncs
func(*targs, **kargs)
File „/usr/lib/python2.7/multiprocessing/util.py“, line 325, in _exit_function
p.join()
File „/usr/lib/python2.7/multiprocessing/process.py“, line 145, in join
res = self._popen.wait(timeout)
File „/usr/lib/python2.7/multiprocessing/forking.py“, line 154, in wait
return self.poll(0)
File „/usr/lib/python2.7/multiprocessing/forking.py“, line 135, in poll
pid, sts = os.waitpid(self.pid, flag)
KeyboardInterrupt
[/code]

Antworten

o bishoph says:

8. April 2018 at 10:11

Hi. Dieser o.g. Bug wurde vor geraumer Zeit im testing Branch behoben:

https://github.com/bishoph/sopare/issues/14

Zum Thema Mic Array: Kommt der Input Stream von dem Mic Array gebündelt
rein? Denn das würde erklären warum die Prozessor Last und der Speicher hoch
gehen. Hier müsste man (wo kann ich nicht genau sagen) die einzelnen Input
Streams mixen bzw. den „besten“ extrahieren und nur diesen verwenden….

Antworten

24. Dominic says:

9. April 2018 at 15:40

hey,

habe das neue Mic jetzt getestet, und das selbe problem besteht weiterhin, nach kurzer
zeit hängt sich das script anscheinend auf, die cpu geht auf 25% und der memory steigt
immer weiter… wenn ich das ganze jetzt mit ctrl+c beende erhalte ich folgendes:

sopare 1.5.0
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
[u’licht‘]
[]
[u’an‘]
[]
[u’licht‘]
[]
[u’an‘, “]
[]
[u’licht‘]
[]
[]
[]
[“, u’an‘]
[]
[u’licht‘]
[]
[u’an‘]
[]
[u’licht‘]
[u’licht‘, “]
[]
[u’an‘]
[]
[u’an‘]
[u’an‘, u’an‘]
[]
[u’licht‘]
[u’licht‘, u’licht‘]
[]
[u’licht‘]
[]
^CProcess worker for filtered data:
Traceback (most recent call last):
File „/usr/lib/python2.7/multiprocessing/process.py“, line 258, in _bootstrap
Traceback (most recent call last):
File „./sopare.py“, line 187, in
self.run()
File „/home/pi/dev/sopare/sopare/worker.py“, line 88, in run
Process buffering queue:
main(sys.argv[1:])
obj = self.queue.get()
File „./sopare.py“, line 108, in main
File „/usr/lib/python2.7/multiprocessing/queues.py“, line 117, in get
recorder.recorder(cfg)
File „/home/pi/dev/sopare/sopare/recorder.py“, line 44, in __init__
self.recording()
res = self._recv()
File „/home/pi/dev/sopare/sopare/recorder.py“, line 95, in recording
KeyboardInterrupt
self.logger.warning(„stream read error „+str(e))
KeyboardInterrupt
Traceback (most recent call last):
File „/usr/lib/python2.7/multiprocessing/process.py“, line 258, in _bootstrap
self.run()
File „/home/pi/dev/sopare/sopare/buffering.py“, line 40, in run
buf = self.queue.get()
File „/usr/lib/python2.7/multiprocessing/queues.py“, line 117, in get
res = self._recv()
KeyboardInterrupt

villeicht hilft das ja weiter?

viele Grüße

Antworten

o bishoph says:

9. April 2018 at 16:17

Nee, hilft nicht. Das sieht bei mir genau so aus und ist der normale Ablauf. Die
Frage ist immer noch offen ob das Mic einen Stream mixt oder ob mehrere
Stream parallel ankommen. 25% CPU ist übrigens vollkommen normal. Ruf mal
„top -d 1“ auf und schalte per „1“ in den Core View. Wenn da ein Core dauerhaft
auf 100% läuft kommt der Thread nicht mit der Bearbeitung hinterher.

Antworten

 Dominic says:

9. April 2018 at 16:32


ok, läuft dauerhaft auf rund 100%(schwnakt um 5% hin und her).
Sprich, mein raspberry kommt damit nicht klar, bzw hat zu wenig power,
richtig?

Was ich eben nur nicht verstehe, dass es beim starten immer kurz
funktioniert und dann auf einmal zammbricht…

Antworten

 Dominic says:

9. April 2018 at 17:04

hab es jetzt mit einem Pi3 getestet, genau das selbe problem…

Antworten

 bishoph says:

9. April 2018 at 17:36

Nee, am Pi liegt es nicht, bei mir läuft es auch allen


Modellen. Details zum möglichen Vorgehen und Debuggen
siehe Kommentar unten.

 bishoph says:

9. April 2018 at 17:34

Also, das Architekturbild (https://www.bishoph.org/wp-


content/uploads/2018/03/sopare_architecture_20180310.png) zeigt
ja was da vor sich geht. Es gibt zwei Möglichkeiten:

1) SOPARE bekommt einen Stream der aus multiplen Inputs


besteht und die Menge ist zu groß (davon geht ich aktuell aus)
2) Es gibt zu viele Trainingsmodelle und der Vergleich dauert
schlicht zu lange

Punkt 2 kann man einfach testen indem man alle Daten löscht und
einen einzigen Test trainiert und gegen diesen testet. Also im
Detail:
rm dict/*.raw
./sopare.py -d „*“
./sopare -t test
./sopare -l

Und dann die CPU beobachten. Geht die Last jetzt wieder auf
100% liegt es am Input Stream. Ich weiß, das der Amazon Echo
aus dem Array den „besten“ extrahiert bzw. aus dem multiplen
Input einen einzigen mixt. Das sollte ALSA auch können…

Antworten

 Carsten says:

9. April 2018 at 18:49

gerade gefunden, versuche das nämlich auch…

First, start with a device that allows multiple recording


clients:

pcm.snooped {
type dsnoop
slave.pcm „hw:0“ # or whatever
}
Then extract single channels:

pcm.channel1 {
type route
slave {
pcm snooped
channels 2
}
ttable [ [ 1 0 ] ]
}

pcm.channel2 {
type route
slave {
pcm snooped
channels 2
}
ttable [ [ 0 1 ] ]
}
Then put a softvol on each of them:
pcm.channel1_softvol {
type softvol
slave.pcm channel1
control.name „Channel 1 Capture Volume“
}
pcm.channel2_softvol {
type softvol
slave.pcm channel2
control.name „Channel 2 Capture Volume“
}
Then merge them into a single device:

pcm.mixed_with_volumes {
type multi
slaves {
a { pcm channel1_softvol channels 1 }
b { pcm channel2_softvol channels 1 }
}
bindings [
{ slave a channel 0 }
{ slave b channel 0 }
]
}
… and use a plug plugin to mix the channels together:

pcm.my_device {
type plug
slave.pcm mixed_with_volumes
ttable [ [ 0.5 0.5 ] ]
}

 Dominic says:

9. April 2018 at 19:17

Ich würde dann auch zu 1. tendieren, habe lediglich 3


Trainingsmodelle, „Licht, An, Aus“. Alle 3 habe ich 3mal
„trainiert/gesprochen“, habe das ganze jetzt eben auch mal
nur mit dem „test“ versucht, kommt zum selben ergebnis.

Kann das eventuell an der externen Soundkarte liegen?


Habe ne ältere USB-Soundkarte von nem Logitech
Headset, mit nen 3,5mm Input und Output.
(https://www.ebay.de/itm/LOGITECH-USB-3-5mm-
AUDIO-INTERFACE-ADAPTER-FOR-MICROPHONE-
HEADPHONE-A-
5572A/162952908403?epid=1021986816&hash=item25f0c
00e73:g:jxUAAOSwWCBarrtJ)

 bishoph says:

10. April 2018 at 9:35

Zur Soundkarte Kann ich nicht viel sagen, ich bin da eher
Entwickler und Software lastig 😉

Ein weiterer Bereich für die Datenmenge ist der von


SOPARE genutzte Frequenzbereich. Welcher Bereich wird
denn da abgedeckt, also speziell die Werte LOW_FREQ
und HIGH_FREQ sind relevant?

25. JR says:

9. April 2018 at 15:48

Good day! How can I make it run upon boot up? I want to make the raspberry pi run the
endless loop upon start up. Thank you!

Antworten

o bishoph says:

9. April 2018 at 16:23

You can start SOPARE as a service. There are plenty of examples how to add a
Python script as a service. I can add my own start/stop script to GitHub and cover
this topic in combination with the plugins in the next video. Stay tuned – I should
have time in the next few weeks to do the next video tutorial.

Antworten

26. Carsten says:

9. April 2018 at 19:55

über „sudo arecord -D capture_mono -c 1 -r 48000 test.wav“ kann ich jetzt mono
aufnehmen
meine asound.conf

# The IPC key of dmix or dsnoop plugin must be unique


# If 555555 or 666666 is used by other processes, use another one

pcm.!default {
type asym
playback.pcm „playback“
capture.pcm „capture_mono“
}

pcm.playback {
type plug
slave.pcm „dmixed“
}

pcm.capture {
type plug
slave.pcm „array“
}

pcm.dmixed {
type dmix
slave.pcm „hw:1,0“
ipc_key 555555
}

pcm.array {
type dsnoop
slave {
pcm „hw:1“

}
ipc_key 666666
}

#extract single channel

pcm.channel1 {
type route
slave {
pcm array
channels 2
}
ttable [ [ 1 0 ] ]
}
pcm.channel2 {
type route
slave {
pcm array
channels 2
}
ttable [ [ 0 1 ] ]
}

#Then put a softvol on each of them:

pcm.channel1_softvol {
type softvol
slave.pcm channel1
control.name „Channel 1 Capture Volume“
}
pcm.channel2_softvol {
type softvol
slave.pcm channel2
control.name „Channel 2 Capture Volume“
}

#Then merge them into a single device:

pcm.mixed_with_volumes {
type multi
slaves {
a { pcm channel1_softvol channels 1 }
b { pcm channel2_softvol channels 1 }
}
bindings [
{ slave a channel 0 }
{ slave b channel 0 }
]
}

#… and use a plug plugin to mix the channels together:

pcm.capture_mono {
type plug
slave.pcm mixed_with_volumes
ttable [ [ 1 1 ] ]
}

Antworten
o bishoph says:

10. April 2018 at 9:29

Das sieht sehr hilfreich aus für alle Multi-Channel oder Multi-Array-Mics. Danke
für die Config!

Antworten

27. Carsten says:

9. April 2018 at 20:03

mit -c 2 nimmt er zwar Stereo auf, aber ein Kanal hat Stille, also Mono 😉

Antworten

o bishoph says:

10. April 2018 at 9:24

Hi, Mono ist der default für SOPARE. Also alles super.

Antworten

28. Carsten says:

16. April 2018 at 14:33

Hallo mal wieder…

Ich komme einfach nicht voran. Jetzt macht die Queue Probleme, test/test_audio.py bleibt
beim chunk-test „stehen“? Ich habe auch schon die SAMPLE_RATES und die CHUNKS
Auswahl minimiert.
SAMPLE_RATES = [ 16000, 44100, 48000 ]
CHUNKS = [ 512, 2048, 4096 ]

Wenn ich dann mit STRG+C abbrechen möchte weil es nicht mehr weiter geht, wird mir
angezeigt:

Processing multiprocessing buffering queue:


Traceback (most recent call last):
File „usr/lib/python2.7/multiprocessing/process.py“, line 258, in _bootstrap
self.run()
File „/home/sopare/test/test_multi.py“, line 30, in run
buf = self.queue.get()
File „usr/lib/python2.7/multiprocessing/queues.py“ line 117, in get
res = self._recv()
KeyboardInterrupt

Das Programm wird aber nicht beendet, muss die Putty-Sitzung dann beenden.

Es bleibt auch alles willkürlich hängen, mal bei Chunks 512, mal bei 2048 … auch
volume hab ich mir mal anzeigen lassen, mal geht es in die tausender hoch, mal bleibt es
bei 713 hängen, mal läuft die Schleife mehrere Male durch, dann nur einmal… Es spielt
auch keine Rolle, ob das Mic in Mono oder Stereo läuft, bleibt beides mal hängen.

irgend eine Idee?

Pi 3 B,
Linux raspberrypi 4.14.30-v7+ #1102 SMP Mon Mar 26 16:45:49 BST 2018 armv7l
GNU/Linux

Antworten

o bishoph says:

16. April 2018 at 14:48

Nope, leider keine Idee außer dem was ich zuvor schon gesagt habe: Ich denke
das ein Mic-Array eine spezielle Ansteuerung bzw. Handling benötigt…

Antworten

29. Carsten says:

16. April 2018 at 15:11

bzgl. Mic Array hab ich mal ne Anfrage unter Issues gestellt bzgl der Verwendung von
arecord anstelle von pyaudio. Sind auch die Links zu einem Projekt dabei. Da wird auch
die Queue anders erzeugt, CPU Last ist auch geringer. Vllt. ist es ja ne Option und für
uns alle hilfreich… 🙂

Antworten
30. Carsten says:

17. April 2018 at 13:30

…🙂
Aufnahme klappt, ist auch Mono… aber s. Fehler am Ende…

sopare 1.5.2
DEBUG:sopare.audio_factory:#### Default input device info #####
DEBUG:sopare.audio_factory:defaultSampleRate: 44100.0
DEBUG:sopare.audio_factory:defaultLowOutputLatency: 0.0087074829932
DEBUG:sopare.audio_factory:defaultLowInputLatency: 0.00580498866213
DEBUG:sopare.audio_factory:maxInputChannels: 2
DEBUG:sopare.audio_factory:structVersion: 2
DEBUG:sopare.audio_factory:hostApi: 0
DEBUG:sopare.audio_factory:index: 2
DEBUG:sopare.audio_factory:defaultHighOutputLatency: 0.0348299319728
INFO:sopare.worker:worker queue runner started
DEBUG:sopare.audio_factory:maxOutputChannels: 2
DEBUG:sopare.audio_factory:name: seeed-2mic-voicecard: – (hw:1,0)
DEBUG:sopare.audio_factory:defaultHighInputLatency: 0.0348299319728
INFO:sopare.buffering:buffering queue runner
DEBUG:sopare.recorder:SAMPLE_RATE: 16000
DEBUG:sopare.recorder:CHUNK: 512
INFO:sopare.recorder:start endless recording
INFO:sopare.processing:starting append mode
DEBUG:sopare.filter:New window!
Process buffering queue:
Traceback (most recent call last):
File „/usr/lib/python2.7/multiprocessing/process.py“, line 258, in _bootstrap
self.run()
File „/home/sopare/sopare/buffering.py“, line 43, in run
self.proc.check_silence(buf)
File „/home/sopare/sopare/processing.py“, line 74, in check_silence
self.prepare.prepare(buf, volume)
File „/home/sopare/sopare/prepare.py“, line 126, in prepare
self.tokenize(meta)
File „/home/sopare/sopare/prepare.py“, line 50, in tokenize
self.filter.filter(self.buffer, meta)
File „/home/sopare/sopare/filter.py“, line 126, in filter
chunked_norm = self.get_chunked_norm(nfft)
File „/home/sopare/sopare/filter.py“, line 62, in get_chunked_norm
i += int(progessive)
OverflowError: cannot convert float infinity to integer
INFO:sopare.recorder:Buffering not alive, stop recording
INFO:sopare.recorder:stop endless recording

und bitte nicht alles aufs Array schieben, ich habe es jetzt schon zu einem Mono-Mic
kastriert 😉

Antworten

o Carsten says:

17. April 2018 at 13:39

der Fehler kommt übrigens auch, wenn ich eine wav oder raw Datei einlese.

Antworten

o bishoph says:

17. April 2018 at 13:48

Kannst du dazu bitte ein neues Issue auf GitHub anlegen


(https://github.com/bishoph/sopare/issues), das ist einfacher und sauberer als hier
über das Forum. Dann schaue ich mir das mal an. Danke!

Antworten

31. Dominic says:

17. April 2018 at 23:13

Ich bins wieder,

habe mich jetzt bisschen mit den Einstellungen rum gespielt und den Chunk-Size auf
1024 erhöht und das ganze mal länger getestet und jetzt scheint es zu laufen 🙂

viele Grüße

Antworten

o bishoph says:

18. April 2018 at 8:06


Na, das hört sich doch vielversprechend an
Dann wünsche ich auch weiterhin viel Spaß und Erfolg!

Antworten

32. vijay parmar says:

11. Mai 2018 at 20:16

sir,

first time i have installed SOPARE successfully and get Result [test] but now i am facing
this error can you please help me…

sopare 1.5.0
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.front.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown 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 confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround40.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround71.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM iec958
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
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 confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
INFO:sopare.analyze:checking for plugins…
DEBUG:sopare.analyze:loading and initialzing plugins/print
DEBUG:sopare.audio_factory:#### Default input device info #####
Traceback (most recent call last):
File „./sopare.py“, line 187, in
main(sys.argv[1:])
File „./sopare.py“, line 108, in main
recorder.recorder(cfg)
File „/home/pi/dev/sopare/sopare/recorder.py“, line 44, in __init__
self.recording()
File „/home/pi/dev/sopare/sopare/recorder.py“, line 82, in recording
self.stream = self.audio_factory.open(self.cfg.getintoption(’stream‘, ‚SAMPLE_RATE‘))
File „/home/pi/dev/sopare/sopare/audio_factory.py“, line 36, in open
for k, v in self.pa.get_default_input_device_info().iteritems():
File „/usr/lib/python2.7/dist-packages/pyaudio.py“, line 949, in
get_default_input_device_info
device_index = pa.get_default_input_device()
IOError: No Default Input Device Available
INFO:sopare.worker:worker queue runner started
INFO:sopare.buffering:buffering queue runner

Antworten

o bishoph says:

11. Mai 2018 at 21:32


The issue „No Default Input Device Available“ means that the device is busy, not
connected or unavailable. It could be that an instance of SOPARE is (still)
running in the background. You can find out by executing the command:

ps aux | grep sopare

If you get results you have to kill the processes with the command

kill -3 PROCESS_ID

The PROCESS_ID is the first number in the line …

Hope that helps 🙂

Antworten

33. Carl says:

16. Mai 2018 at 5:21

Installed perfectly on Raspi 3B running Raspbian Strech. However, the


„WARNING:sopare.recorder:stream read error [Errno -9988] Stream closed“ is
excessive. I simply do not use the verbose parameter. The trick to using this is in the
learning. But I give it 5-stars.

Antworten

o bishoph says:

16. Mai 2018 at 7:56

Thanks for the 5-stars 🙂

I want to mention that I get the error „-9988“ with one microphone (don’t appear
with other microphones) so this issue is definitely hardware depended. Even it is
annoying, the message is necessary because the issue effects the precision
slightly. But as you said correctly it can be suppressed.

Antworten

34. vijay parmar says:

16. Mai 2018 at 16:46


Good evening sir,
can you help for this error ?

DEBUG:sopare.worker:meta = [{‚token‘: ’stop‘}]


INFO:sopare.buffering:terminating queue runner
INFO:sopare.recorder:Buffering not alive, stop recording
INFO:sopare.recorder:stop endless recording
pi@raspberrypi:~/dev/sopare $ ./sopare.py -c
sopare 1.5.0
recreating dictionary from raw input files…
pi@raspberrypi:~/dev/sopare $ ./sopare.py -l
sopare 1.5.0
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.front.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown 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 confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround40.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround71.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM iec958
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
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 confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
ERROR:sopare.analyze:ImportError: No module named __init__
[]
[]
[]
[]
[]
[]
[]
[]

Antworten

o bishoph says:

16. Mai 2018 at 17:08

Hi, seems you messed up the plugin directory. The error highlights that a (sub)
directory does not contain the necessary __init__.py file as the module „__init__
(you should avoid this as directory name!) is not available. Learn more:
https://docs.python.org/3/tutorial/modules.html#packages

And you should clean up your alsa.conf as most of the output comes from ALSA!

Antworten

35. vijay parmar says:

26. Mai 2018 at 12:55


Dear Sir Good afternoon,
Thanks for all kind of your support.
(1) I get ‚ERROR:sopare.analyze:ImportError: No module named __init__‘ when given
command ./sopare.py -l.

pi@raspberrypi:~/dev/sopare $ ./sopare.py -l
sopare 1.5.0
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 confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround40.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround71.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM iec958
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
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 confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
ERROR:sopare.analyze:ImportError: No module named __init__
ERROR:sopare.analyze:ImportError: No module named __init__
[]
[]
[]
[u’LIGHTON‘]
[u’LIGHTON‘]
[u’LIGHTON‘]
[u’LIGHTON‘, u’LIGHT‘]
[u’LIGHTON‘, u’LIGHT‘]
[u’LIGHTON‘, u’LIGHT‘]
[u’LIGHTON‘, u’LIGHT‘, u’LIGHTON‘]
[u’LIGHTON‘, u’LIGHT‘, u’LIGHTON‘]
[u’LIGHTON‘, u’LIGHT‘, u’LIGHTON‘]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[“, u’LIGHT‘]
[“, u’LIGHT‘]
[“, u’LIGHT‘]
[“, u’LIGHT‘, “, u’LIGHTON‘]
[“, u’LIGHT‘, “, u’LIGHTON‘]
[“, u’LIGHT‘, “, u’LIGHTON‘]
[“, u’LIGHT‘, “, u’LIGHTON‘, u’LIGHTON‘]
[“, u’LIGHT‘, “, u’LIGHTON‘, u’LIGHTON‘]
[“, u’LIGHT‘, “, u’LIGHTON‘, u’LIGHTON‘]
[u’LIGHTON‘, u’LIGHT‘, u’LIGHTON‘]
[u’LIGHTON‘, u’LIGHT‘, u’LIGHTON‘]
[u’LIGHTON‘, u’LIGHT‘, u’LIGHTON‘]
[u’LIGHTON‘, u’LIGHT‘, u’LIGHTON‘, u’LIGHTON‘]
[u’LIGHTON‘, u’LIGHT‘, u’LIGHTON‘, u’LIGHTON‘]
[u’LIGHTON‘, u’LIGHT‘, u’LIGHTON‘, u’LIGHTON‘]
[u’LIGHTON‘, u’LIGHT‘, u’LIGHTON‘, u’LIGHTON‘, u’LIGHTON‘]
[u’LIGHTON‘, u’LIGHT‘, u’LIGHTON‘, u’LIGHTON‘, u’LIGHTON‘]
[u’LIGHTON‘, u’LIGHT‘, u’LIGHTON‘, u’LIGHTON‘, u’LIGHTON‘]
[]
[]
[]
[]
[]
[]
[u’LIGHTOFF‘, u’LIGHT‘, u’LIGHTON‘, u’LIGHT‘, “]
[u’LIGHTOFF‘, u’LIGHT‘, u’LIGHTON‘, u’LIGHT‘, “]
[u’LIGHTOFF‘, u’LIGHT‘, u’LIGHTON‘, u’LIGHT‘, “]
[u’LIGHTOFF‘, u’LIGHT‘, u’LIGHTON‘, u’LIGHT‘, “, u’LIGHT‘, “]
[u’LIGHTOFF‘, u’LIGHT‘, u’LIGHTON‘, u’LIGHT‘, “, u’LIGHT‘, “]
[u’LIGHTOFF‘, u’LIGHT‘, u’LIGHTON‘, u’LIGHT‘, “, u’LIGHT‘, “]
[]
[]
[]

(2) please verify my code for light on/light off

#!/usr/bin/env python
# -*- coding: utf-8 -*-

„““
Copyright (C) 2015 – 2017 Martin Kauss (yo@bishoph.org)

Licensed under the Apache License, Version 2.0 (the „License“); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software


distributed under the License is distributed on an „AS IS“ BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
„““

# Default plugin for output of analysis

import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)

LIGHT = 17
GPIO.setup(LIGHT, GPIO.OUT)
def run(readable_results, data, rawbuf):
if(len(readable_results) == 1 and readable_results[0] == ‚LIGHTON‘):
GPIO.output(LIGHT, GPIO.HIGH)
elif(len(readable_results) == 1 and readable_results[0] == ‚LIGHTOFF‘):
GPIO.output(LIGHT, GPIO.LOW)

Antworten

o bishoph says:

26. Mai 2018 at 19:01

Something in your plugin directory is not set up properly as a path seems to be


wrong – can’t tell more as I have no more information.

Antworten

36. Achra says:

19. Juni 2018 at 16:38

Hey,
when i run python test/test_audio.py

test_audio init…
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 confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
testing different SAMPLE_RATEs … this may take a while!

DEBUG:sopare.audio_factory:#### Default input device info #####


Traceback (most recent call last):
File „test/test_audio.py“, line 129, in
ta.test_sample_rates()
File „test/test_audio.py“, line 78, in test_sample_rates
self.stream = self.audio_factory.open(test_sample_rate)
File „../sopare/sopare/audio_factory.py“, line 36, in open
for k, v in self.pa.get_default_input_device_info().iteritems():
File „/usr/lib/python2.7/dist-packages/pyaudio.py“, line 949, in
get_default_input_device_info
device_index = pa.get_default_input_device()
IOError: No Default Input Device Available
mein USB-Mikrofon ist in pi3 angeschlossen aber wurde nicht erkannt, woran kann das
Problem liegen?
Danke im voraus

Antworten

o bishoph says:

22. Juni 2018 at 17:02


Ich habe keine Idee warum das USB Mic nicht erkannt wird…Hilfe gibt es
eventuell beim ALSA Projekt:

https://www.alsa-project.org/main/index.php/Matrix:Main

Antworten

37. Carsten says:

6. Juli 2018 at 14:44

Moin,

endlich mal gute Nachrichten … mit diesem MIC Array


(http://wiki.seeedstudio.com/ReSpeaker_Mic_Array_v2.0/) und der 1-Channel Firmware
geht es nun wie erwartet, da jegliche Filterung auf dem Mic durchgeführt wird und die
reine Sprache in Sopare ankommt.
Ein Problem bleibt… die (für mich) „hohe“ Fehlerkennung – wobei ich weniger Fehler
als Jarvis mit Snowboy habe, um ehrlich zu sein, ist Jarvis extrem langsam und extrem
fehleranfällig, nur der Einrichtungsassistent ist toll ;).
Ich habe 3 Kommandos, Licht, Lampe und Steckdose. Es kommt oft vor, dass Licht die
Steckdose schaltet. Oder ein Husten von mir schaltet die Lampe.
Nach tagelangem Testen und Videos wiederholt angucken sieht meine Config nun so aus:
[code]
#########################################################
# Stream prep and silence configuration options #########
#########################################################

[stream]

# Read chunk size


CHUNK = 512

# Sample rate
SAMPLE_RATE = 16000
#mehr kann das Mic nicht

# Volume threshold when audio processing starts / silence


THRESHOLD = 500

# Silence time in seconds when analysis is called


MAX_SILENCE_AFTER_START = 1
#kleiner geht nicht, dann wird nichts mehr aufgezeichnet?!
# Time in seconds after the analysis is forced
MAX_TIME = 2.4

# Start the analysis after reaching LONG_SILENCE


LONG_SILENCE = 20

# Characteristic length
CHUNKS = 2048

#########################################################
# Characteristic configuration options ##################
#########################################################

[characteristic]

# Steps boil down the data into smaller chunks of data.


# Smaller steps mean more precision but require
# normally more learned entries in the dictionary.
# Progressive value is used if you want to pack not
# so relevant frequencies
PROGRESSIVE_FACTOR = 0
START_PROGRESSIVE_FACTOR = 600
MIN_PROGRESSIVE_STEP = 25
MAX_PROGRESSIVE_STEP = 25

# Specifies freq ranges that are kept for further


# analysis. Freq outside of the ranges are set to zero.
# Human language can be found between 20 and 5000.
LOW_FREQ = 40
HIGH_FREQ = 1000

# Make use of Hann window function


HANNING = true

# Range factor for peaks


PEAK_FACTOR = 0.7

#########################################################
# Compare configuration options #########################
#########################################################

[compare]

# Min. number of tokens to identify the beginning of a word


MIN_START_TOKENS = 2
# Min. value for potential beginning of a word
MARGINAL_VALUE = 0.8

# Minimal similarity across all comparison to


# identify a complete word across all tokens
MIN_CROSS_SIMILARITY = 0.97

# Calculation basis or token/word comparison

SIMILARITY_NORM = 0.7
SIMILARITY_HEIGHT = 0
SIMILARITY_DOMINANT_FREQUENCY = 0
SIMILARITY_ZERO_CROSSING_RATE = 0.3
#bisher die besten Ergebnisse damit, hab fast alles probiert!

# Number of best matches to consider.


# Value must be > 0
# If not specified or value 95% beim ersten mal, 100% beim zweiten… nur nicht immer
richtig.

Wo kann ich noch dran schrauben?


Gibt es eine Möglichkeit den Wortanfang noch genauer zu vergleichen? Wegen dem
Problem Gicht, Sicht, Nicht -> schaltet auch das Licht.

Danke

Antworten

o Carsten says:

6. Juli 2018 at 15:29

irgendwie fehlt der Rest oben… also nochmal


#########################################################
# Stream prep and silence configuration options #########
#########################################################

[stream]

# Read chunk size


CHUNK = 512

# Sample rate
SAMPLE_RATE = 16000
# Volume threshold when audio processing starts / silence
THRESHOLD = 500

# Silence time in seconds when analysis is called


MAX_SILENCE_AFTER_START = 1

# Time in seconds after the analysis is forced


MAX_TIME = 2.4

# Start the analysis after reaching LONG_SILENCE


LONG_SILENCE = 20

# Characteristic length
CHUNKS = 2048

#########################################################
# Characteristic configuration options ##################
#########################################################

[characteristic]

# Steps boil down the data into smaller chunks of data.


# Smaller steps mean more precision but require
# normally more learned entries in the dictionary.
# Progressive value is used if you want to pack not
# so relevant frequencies
PROGRESSIVE_FACTOR = 0
START_PROGRESSIVE_FACTOR = 600
MIN_PROGRESSIVE_STEP = 25
MAX_PROGRESSIVE_STEP = 25

# Specifies freq ranges that are kept for further


# analysis. Freq outside of the ranges are set to zero.
# Human language can be found between 20 and 5000.
LOW_FREQ = 40
HIGH_FREQ = 1000

# Make use of Hann window function


HANNING = true

# Range factor for peaks


PEAK_FACTOR = 0.7

#########################################################
# Compare configuration options #########################
#########################################################
[compare]

# Min. number of tokens to identify the beginning of a word


MIN_START_TOKENS = 2

# Min. value for potential beginning of a word


MARGINAL_VALUE = 0.8

# Minimal similarity across all comparison to


# identify a complete word across all tokens
MIN_CROSS_SIMILARITY = 0.97

# Calculation basis or token/word comparison


SIMILARITY_NORM = 0.7
SIMILARITY_HEIGHT = 0
SIMILARITY_DOMINANT_FREQUENCY = 0
SIMILARITY_ZERO_CROSSING_RATE = 0.3

# Number of best matches to consider.


# Value must be > 0
# If not specified or value < 1 value is set to 1
NUMBER_OF_BEST_MATCHES = 15

# Min. distance to keep a word


MIN_LEFT_DISTANCE = 0.3
MIN_RIGHT_DISTANCE = 0.3

# Use given number as results to assembly result


# 0 for all predictions
MAX_WORD_START_RESULTS = 2
MAX_TOP_RESULTS = 5

# Enable or disable strict length check for words


STRICT_LENGTH_CHECK = true
# Value to soften the strict length check a bit to still
# get quite precise results but to be less strict
STRICT_LENGTH_UNDERMINING = 2

# Short term memory retention time in seconds. Zero to disable STM


# 1.2
STM_RETENTION = 1.2

# Fill result percentage


# 0.5 means that half of the values can by empty to still get valid results
# A lower value should theoretically avoid false positives
FILL_RESULT_PERCENTAGE = 0.1
#########################################################
# Misc configuration options ############################
#########################################################

[misc]

# Loglevel (CRITICAL, ERROR, WARNING, INFO, DEBUG)


LOGLEVEL = ERROR

#########################################################
# Experimental configuration options ####################
#########################################################

[experimental]

# Additional FFT analysis and comparison for CHUNKS/2 length


FFT_SHIFT = true

Antworten

o bishoph says:

6. Juli 2018 at 15:34

Die Werte MIN_PROGRESSIVE_STEP und MAX_PROGRESSIVE_STEP


können weiter runter geschraubt werden, dazu ist nach einer Anpassung ein neues
Training notwendig. Die Werte sind quasi eine Komprimierung der Daten.
Probiert doch mal 10, 5 oder sogar 2 aus. Je kleiner der Wert, desto genauer.
Irgendwo findet man dann eine Balance zwischen True und False Positives…
Hier die Werte die ich für Sprache und Lichtsteuerung verwende:

PROGRESSIVE_FACTOR = 0
START_PROGRESSIVE_FACTOR = 600
MIN_PROGRESSIVE_STEP = 5
MAX_PROGRESSIVE_STEP = 5

MIN_START_TOKENS = 3
MARGINAL_VALUE = 0.8
MIN_CROSS_SIMILARITY = 0.85

Ebenfalls sehr wichtig diese beiden Werte, die als Filter fungieren (am besten
hoch anfangen und dann runter gehen):
MIN_LEFT_DISTANCE = 0.9
MIN_RIGHT_DISTANCE = 0.7
Da das alles stark abhängig ist von der Umgebung, Training und Hardware ist
eigenes austesten unumgänglich…

Eventuell bekommt man aber auch mit der niedrigen Sample Rate keine besseren
Resultate … meine Sample Rate liegt bei 48000, JFYI.

Antworten

 Carsten says:

6. Juli 2018 at 15:41

Danke für die Antwort, aber kannst die nochmal auf git schreiben bitte?
Hier fehlt die Hälfte von meinem Text, k.a. warum. Lösche am besten die
Frage ganz. 🙂

Danke

Antworten

38. Bayu Afrian Gojali says:

11. Juli 2018 at 19:02

sir,

first time i have installed SOPARE successfully and get Result [test] but now i am facing
this error can you please help me…

pi@raspberrypi:~/dev/sopare $ ./sopare.py -l
sopare 1.5.0
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.front.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown 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 confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround40.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround71.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM iec958
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
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 confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
connect(2) call to /tmp/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
[]
[]
[]

i use usb audio for mic and 3.5 mm jack for speaker
I hope help from you..
thank sir

Antworten

o bishoph says:

11. Juli 2018 at 19:53


I have no idea about your environment but I recommend to clean up your
also.conf and maybe the following link helps a bit:
https://github.com/Arkq/bluez-alsa/issues/26

Antworten

39. alvin says:

21. Juli 2018 at 9:18

Hi,

I cannot train it after successfully training it at first day i got my raspberry pi, it says:

pi@raspberrypi:~/sopare $ ./sopare.py -t -v test


sopare 1.5.0
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.interface‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.interface‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
pi@raspberrypi:~/sopare $

after this last line:


JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock

it does nothing and finally it closes itself

please help

Thanks
Antworten

o bishoph says:

21. Juli 2018 at 11:29

Not sure but a quick Internet search shows me that you have issues with your
ALSA setup. Maybe you installed something manually or your ALSA config is
muddled.

As far as I can tell the above error messages are not related to SOPARE which
means I can’t really help.

Antworten

40. Diego says:

26. Juli 2018 at 19:06

Hello, im am using SOPARE for voice control and came across some questions

can it be speech independent recognition?

is there a limit for commands?

thanks

Antworten

o bishoph says:

28. Juli 2018 at 11:47

Hi. Speech independent in terms of sound recognition: yes. There is no real limit
but too many commands will lead to lag/delay as the current word identification
mechanism needs an optimization/overhaul.

Antworten

41. georg says:

31. Juli 2018 at 17:07


Hallo, ich versuche sopare zu installieren. HW: Raspberry P3+, stretch9.
Alles installiert nach Anweisung auch wohl fehlerlos bis:dahin
Fehler:
python test/test_audio.py

************************************************************************
**
testing different SAMPLE_RATEs … this may take a while!

DEBUG:sopare.audio_factory:#### Default input device info #####


DEBUG:sopare.audio_factory:defaultSampleRate: 44100.0
DEBUG:sopare.audio_factory:defaultLowOutputLatency: -1.0
DEBUG:sopare.audio_factory:defaultLowInputLatency: 0.00868480725624
DEBUG:sopare.audio_factory:maxInputChannels: 1
DEBUG:sopare.audio_factory:structVersion: 2
DEBUG:sopare.audio_factory:hostApi: 0
DEBUG:sopare.audio_factory:index: 2
DEBUG:sopare.audio_factory:defaultHighOutputLatency: -1.0
DEBUG:sopare.audio_factory:maxOutputChannels: 0
Traceback (most recent call last):
File „test/test_audio.py“, line 129, in
ta.test_sample_rates()
File „test/test_audio.py“, line 78, in test_sample_rates
self.stream = self.audio_factory.open(test_sample_rate)
File „../sopare/sopare/audio_factory.py“, line 37, in open
self.logger.debug(str(k) + ‚: ‚ + str(v))
UnicodeEncodeError: ‚ascii‘ codec can’t encode character u’\xae‘ in position 9: ordinal
not in range(128)
************************************************************************
*************************************************************

warum?? this may take a while! wie lange Stunden???


Ich habe nach ca. einer halben Stunde abgebrochen
.Hat das ueberhaupt schon jemand nach der Anweisung fehlerlos installiert???

Gruss georg

Antworten

o bishoph says:

1. August 2018 at 13:16


Not sure if this error is thrown because your console does not support UTF-8 or
the input from pyaudio is not encoded correctly or the passing to the logging
module must be different.

Please add a new issue: https://github.com/bishoph/sopare/issues

Will take a look whenever I have some more time 😉 Thx for the report!

Antworten

42. David says:

8. August 2018 at 16:51

Hi,

Can we use Sopare to make short sound recognition?


I am looking for a system that allows to differentiate the sounds produced by a drumstick
strike on different surfaces. About a dozen of different sounds.
The typical duration of theses sound is about a tenth of a second.
Any advice will be welcome.

Thanks

Antworten

o bishoph says:

9. August 2018 at 11:44

Hi. Not sure and never tried it but to differentiate extremely short sounds is
difficult. Try to use the visualization feature from SOPARE and check if the
sound waves and the frequencies differ. Also this gives you an indication about
length and frequency ranges. Furthermore I can imagine that you need a good
microphone and some nearly noise free environment and you need to make sure
that the training and sounds are made under the same conditions. Finally: with the
right config it could work but you have to test it out – I can’t provide any
guaranty 😉

Have fun 🙂

Antworten
43. alvin says:

30. August 2018 at 17:49

hello, i am nearly completing my project, i only need to detect my hand clap, dont care
about the others, but i notice that there are some sound pattern that sopare recognize as „a
hand clap“ but surely it is not a clap, for example a sound of a creaking door, keys hitting
my desk, etc.. I also tried to see the minimum left and right distance using the verbose
parameter in sopare, but the thing is they are practically similar (the difference is only 0.1
or less) and i found no way to differentiate these sound patterns with the actual handclap.
I have also tried modifying the SIMILARITY value combination but still no luck

is there any other way to overcome this? btw, i can only use CHUNK=1000 and
CHUNKS=4000 otherwise after some time the mic will stop working (input overflow
error will appear)

thanks

Antworten

o bishoph says:

31. August 2018 at 13:29

Hand clap is a short sound without lots of special frequencies involved so my


guess is that the hand clap is indeed very similar to other short sounds that only
move air. My advice is to review the differences by using the plot function of
SOPARE and try to adjust as far as possible. My personal guess is that the
CHUNK size of 1024 should play well with a high sample rate. If you are using a
lower sample rate than a higher CHUNK size should be better due to the included
information for the analysis.

Antworten

44. Phil says:

13. September 2018 at 0:39

Thank you for this wonderful project! I am having issues with recognizing two words. I
can train each word individually, but when attempting to use your example to only
execute a plugin when two words are spoken I am not getting the correct response. How
can I adjust the configuration to accept more than one word at a time?
Thank you again, this is an awesome project to work on!

Antworten

o bishoph says:

13. September 2018 at 13:46

Thanks and you are welcome 🙂

You can and should write your own plugin. Inside the plugin you can decide
when and what triggers your custom actions. Here is an example which controls a
robotic arm with one and two commands:

https://github.com/bishoph/Misc/blob/master/robotic_arm_control.py

Antworten

45. Gonzalo says:

13. September 2018 at 15:05

Hi Martin,

First at all congratulations for your work with Sopare I have been doing some research I
have found your work the most convenient around.

I’m planning to import Pygame to play the sound and also I’m using ReSpeaker Pi Hat (
http://wiki.seeedstudio.com/ReSpeaker_2_Mics_Pi_HAT) for sound and microphone
managing, I have setup ReSpeaker and ALSA recognizes it well microphone and sound
on my Raspberry Pi 3. Do you think my ecosystem is compatible with Sopare?

Best,
Gonzalo

Antworten

o bishoph says:

13. September 2018 at 18:13

Hola Gonzalo,
thanks for your kind words.

I have no experience with the ReSpeaker Pi Hat but as it depends on ALSA it


should work. Using Pygame with SOPARE could be tricky depending on the
modules and functions you want to use. But you can get it to work for sure 😉

Have fun y un saludo!

Antworten

46. Inaam says:

15. September 2018 at 23:28

thank you very much for your valuable wok


i just want to know the what type of functions for feature extraction and classification
you were used?

Antworten

o bishoph says:

16. September 2018 at 16:05

Thanks and you are welcome.

I talked about the overall process roughly here and here. As you can configure
certain types the answer depends a lot on the individual configuration. But from a
high level perspective the features derive from the frequency spectrum and from
the domain data itself. But you can also mix in stuff like zero crossing. The
classification (I would not call it so) is a more or less a distance calculation for all
used and configured features.

Antworten

47. Hein says:

17. September 2018 at 16:29

Hi,
Got it working but after ending the endless loop by crtl-z I get the + Stopped message and
can not start Sopare again. Instead get the message IOerror: No default input device
available. Probably the mic is not released or something

Any idea what I’m doing wrong here? DO I need to stop Sopare some other way?

Also, If you would want to have Sopare running continously, how to make sure it starts at
boot?

Thanks.

regards,
Hein

Antworten

o bishoph says:

17. September 2018 at 18:32

Hi. Seems that there is still a SOPARE python process running. Find the process
and kill k

ps aux | grep python

You find the basic instructions here

Antworten

 enaam says:

1. Oktober 2018 at 2:26

can you please explain the method of feature extraction and classification
that used in this recognition?

Antworten

 bishoph says:

1. Oktober 2018 at 10:58


I already answered this question for you. If you don’t like the
answer you can try a different, more specific answer. BTW: You
asked 3 times the same question so far…!?

Antworten

 Inaam says:

23. Oktober 2018 at 0:48

Iam so sorry for this problem, i asked the same question


three times because there was a problem with my web
page.
your answer was excellent and it was very helpful
thank you again
and sorry again

 bishoph says:

23. Oktober 2018 at 10:46

If you got the answer and it was helpful I’m delighted. And
hopefully you was able to fix your other problem. Have fun
🙂

48. Hein says:

17. September 2018 at 16:44

Compliments on the nice project!

Question: how do you take Sopare out of its infinite loop if you want to learn it some
more commands?

Kind regards,

Hein

Antworten

o bishoph says:
17. September 2018 at 18:08

Thanks 🙂

Start SOPARE without the „-l“ option. When SOPARE is running you can stop it
by using CTRL-C or just kill the process with the „kill“ command. Hope that
helps.

Antworten

49. Hein says:

20. September 2018 at 9:09

Hi,

One other question: does Sopare do a lot of writes to SD cards ? Reason I ask is because I
have domoticz running on my Pi and the Pi in turn is using an SD card. Known issues
with SD is that lots of writes have a negative effect on the lifespan of the card.

regards,
Ronald

Antworten

o bishoph says:

20. September 2018 at 9:26

Hi.

SOPARE writes when you train and compile the dict or have the -w option
enabled. And of course if you redirect the logging to a file. Other than that
SOPARE does not write at all. I have several (nolt only SOPARE) instances
running 24/7 since years while using tempfs for some heavy write directories (like
/var/log or /tmp and whathaveyou) and never had any sd card corruptions.

My tip: Just don’t by the cheapest sd cards on the market and make sure to have
enough space on the card for the OS to mark bad blocks and potentially for wear
leveling.

Antworten
50. mallu says:

24. September 2018 at 9:05

pi@raspberrypi:~ $ cd
pi@raspberrypi:~ $ mkdir dev
pi@raspberrypi:~ $ cd dev
pi@raspberrypi:~/dev $ git clone https://github.com/bishoph/sopare.git
bash: git: command not found
pi@raspberrypi:~/dev $ cd sopare
bash: cd: sopare: No such file or directory
pi@raspberrypi:~/dev $ ^C
pi@raspberrypi:~/dev $ cd
pi@raspberrypi:~ $ sudo apt-get install git
Reading package lists… Done
Building dependency tree
Reading state information… Done
git is already the newest version.
The following packages were automatically installed and are no longer required:
coinor-libipopt1 libboost-atomic1.55.0 libboost-filesystem1.55.0
libboost-program-options1.55.0 libboost-regex1.55.0 libboost-thread1.55.0
libc-ares2 libffi5 libgmime-2.6-0 libmng1 libmumps-seq-4.10.0 liboauth0
libqt4-dbus libqt4-xml libqt5concurrent5 libqt5core5a libqt5dbus5 libqt5gui5
libqt5network5 libqt5opengl5 libqt5printsupport5 libqt5svg5 libqt5widgets5
libqtdbus4 libqtgui4 libraw10 libruby2.1 libscsynth1 libv8-3.14.5
libxcb-icccm4 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xkb1
libxkbcommon-x11-0 libyaml-0-2 qdbus qtchooser qttranslations5-l10n ruby
ruby2.1 rubygems-integration wolframscript
Use ‚apt-get autoremove‘ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
pi@raspberrypi:~ $ ^C
pi@raspberrypi:~ $ sudo apt-get install gicd dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package gicd
E: Unable to locate package dev
pi@raspberrypi:~ $ cd
pi@raspberrypi:~ $ mkdir dev
mkdir: cannot create directory ‘dev’: File exists
pi@raspberrypi:~ $ cd dev
pi@raspberrypi:~/dev $ git clone https://github.com/bishoph/sopare.git
bash: git: command not found
pi@raspberrypi:~/dev $ git clone https://github.com/bishoph/sopare.git
bash: git: command not found
pi@raspberrypi:~/dev $ cds
bash: cds: command not found
pi@raspberrypi:~/dev $ cd
pi@raspberrypi:~ $ cd wiringPi
bash: cd: wiringPi: No such file or directory
pi@raspberrypi:~ $ sudo apt-get install git-core
Reading package lists… Done

Antworten

o bishoph says:

25. September 2018 at 19:16

What the heck? This is a weird mix of mistakes you made…not sure what to say
😉

Antworten

51. Renu Kshirsagar says:

17. Oktober 2018 at 12:43

Hi,
After unavailing with few voice engines,Sopare was the one i got successfully working.
Thank you for a user-friendly voice recognition software. I was able to successfully
control GPIO’s with it. Now wanted to know if it can be combined with Google Assistant
on raspberry pi to control GPIO pins.

Antworten

o bishoph says:

17. Oktober 2018 at 14:43

Great that you got it working 🙂

In terms of Google Assistant and SOPARE. As SOPARE and the Google


Assistant try to read from the mic you can try to generate a wav file to the Google
Assistant. Not sure if this is possible but I read the requirement/feature request
somewhere. Other than that there are possibilities but not without rewriting large
chunks of code. Hope that helps.

Have fun!
Antworten

52. Ven says:

21. Oktober 2018 at 18:30

Hi,
I want to input sound to SoPaRe via bluetooth instead of a usb microphone. How do you
suggest I go about with that?
So far I have installed and trained SoPaRe for a few words and am achieving decent
accuracy.
I will require to do the bluetooth section for my next prototype.Could you please give me
a few guidelines on that?

Antworten

o bishoph says:

22. Oktober 2018 at 16:21

If you mean a Bluetooth mic than this could work if you get it to work with the
ALSA stack (PulseAudio or Bluetooth Audio ALSA Backend). If you mean your
own Bluetooth stack with all the device stuff, pairing and the communication than
I can’t give you suggestions or advice as this is beyond the scope and way to
complicated.

Antworten

53. inaam says:

29. November 2018 at 1:32

hi
when i execute sopare i have got this error:
Error:sopare.analyze:ImportError: No module named _init_
can you please explain the reason for this error

Antworten

o bishoph says:

29. November 2018 at 15:35


Without further information help is a bit tricky. I can only guess that your plugin
folder structure does not include the necessary __init__.py file or that an import
does not point to the correct file…

Antworten

54. Mark says:

30. November 2018 at 4:02

HI!!
Could you help tell me what file/function the output that appears in the terminal is
coming from when the program is run in -l? I would like to continuously check the
output….

Thank YOU!

Antworten

o bishoph says:

30. November 2018 at 10:47

Output is generated all over the places but I hope you mean the example plugin:
https://github.com/bishoph/sopare/blob/master/plugins/print/__init__.py

Antworten

55. J says:

8. Dezember 2018 at 1:24

Hi,

I am trying to get Sopare running but I am stuck at getting my threshold.


If I run test_audio.py, it always says THRESHOLD = 0. If I set this in the config file, it
instantly starts listening because it’s 0. If I put it to 1, it doesn’t hear something.

I have a usb webcam attached to the Raspberry Pi arecord -l returns this:

fabapi@fabapi:~/Desktop/sopare$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Webcam [C922 Pro Stream Webcam], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

Audio recording with this microphones also works. So I don’t know why it doesn’t work
in Sopare. Do I have to specify something somewhere? Thanks!

Antworten

o bishoph says:

8. Dezember 2018 at 12:25

Seems that your mic is not configured correctly…make your mic the default in
ASLA and it should work.

Antworten

56. Ravichandran C says:

24. Dezember 2018 at 14:58

We plan to create a voice operated wheelchair.So if I use Sopare based voice recognition
will I be able to react to only the voices of trained users.Or will be reactive to every user
who speaks the command.(Speaker based or just command based)

Antworten

o bishoph says:

27. Dezember 2018 at 0:45

Depends on your training and your settings. If you train a specific voice command
from one speaker and have strict settings only a specific voice will be recognized.

Antworten

57. JH Foo says:

1. Januar 2019 at 20:35

Why did you stop updating the code? This looks like a fun project!
Antworten

o bishoph says:

1. Januar 2019 at 21:56

I currently have other projects and higher priorities. That said, I’ll continue to
make optimizations and changes as my TODO list contains still items I want to
solve and to try 😉

Antworten

58. Carey says:

9. Januar 2019 at 3:01

I love SOPARE on my Pi 3. Is there a ghost of a chance that SOPARE, looking for one
command, might work on a Pi Zero?

Antworten

o bishoph says:

9. Januar 2019 at 16:35

Great and thx for letting me know!

As the zero is a multi core device it could work already. I can’t say for sure how
good as this depends on dict size, threshold and some other things. Give it a try. If
the load is too high and the recognition is delayed than I’m sorry but I can’t do
much right now. In the future we might see performance optimizations and a
better Pi zero support…;)

Antworten

59. BlakeG says:

10. Januar 2019 at 11:55

Hello! I recently used sopare to control an Arduino powered robot however some of the
time the program will stop and not start again, I believe that this is due to one of the cores
having too much to do and stopping, is it possible to transfer the work across to two
cores? Is there anything else you recommend?

Also doubt it was my plugin as I have the same issue without it, and I know it is one core
out of the 4 because it always says it is under 25% stress when it stops.

Thanks! Your work is so helpful and much appreciated in Australia!

Antworten

o bishoph says:

10. Januar 2019 at 16:40

Hey, great to hear and I do this with Pleasure!

Without further information I can only guess. Let us try to shed some light into
this. The following issues are responsible for a potential high load:

– amount of trained words


– sample rate
– used threshold
– similarities and other values in regard of comparing

If you encounter high load you can try to remove some trained words from the
dict, lower the sample rate or use a higher threshold.
Other than that, increase the precision and filter out false positives before such
words are compared expensively.

Hope that gives you some ideas what you can optimize by yourself 🙂

Have fun!

Antworten

 BlakeG says:

12. Januar 2019 at 9:47

Hi, I have since tried to lower the dict word amount to 16 for 4 words;
forwards, stop, left, right. This does not help the issue, I have also lowered
the sample rate to 5 and have the issue. Finally I adjusted the threshold so
no words other than the trained ones are herd, and the issue is the same.
More information is that after the crash were nothing happens and I have
to restart sopare, the % of used power from the CPU is 3 when resting and
18 at maximum, then when it crashes it reaches 25 to 26 and stays there
until I restart.

I re-downloaded sopare and I have the issue regardless of settings and


plugins

Antworten

 bishoph says:

13. Januar 2019 at 12:14

Hi. My robotic arm is controlled by 13 words without any issue.


Also a sample rate of 5 makes no sense at all. You need to figure
out a sample rate that fits best to your hardware environment. The
threshold adjustment seems to be fine.

However, if you say crash than you get an error message we can
work on. File a bug report, tell us how to reproduce and attach
stuff that matters like OS environment, used versions, settings,
config, output, error messages, stack traces and what have you to
make sure we can fix the issue.

Antworten

 BlakeG says:

14. Januar 2019 at 10:48

What sample rate do you think I should have it around?

Thanks for following up

 bishoph says:

14. Januar 2019 at 19:12

Depends on your sound card. These are common ones


which are tested in the SOPARE audio test suite:

8000, 11025, 12000, 16000, 22050, 32000, 44100, 48000


60. Rino says:

11. Januar 2019 at 12:35

Dear Bishop,
first of all, thankyou for Sopare. Great work and very nice technical explanation of your
system.

I would liketo to use Sopare into my simple project (activate some outputs via voice) on
Rpi 3. I modified the simple rate and the sound threshold as suggested by the test
program and I prepared the dictionary (6 words each repeated 3 times). When ./sopare -l
starts, I am in the same situation described by BlackeG. The software stops to recognize
the voice randomly; it seems to be freezed after some words.

Here we are some technical information:

–> Rpi 3, raspbian 4.14,79-v7

–> config:
CHUNK = 512;
SAMPLE_RATE = 48000;
THRESHOLD = 250;

–> no plugin script modified

–> top -d 1 (when Sopare is freezed):


top – 17:42:08 up 3:32, 1 user, load average: 1.57, 1.29, 1.13
Tasks: 135 total, 2 running, 88 sleeping, 0 stopped, 1 zombie
%Cpu0 : 7.1 us, 2.0 sy, 0.0 ni, 90.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu1 : 98.0 us, 2.0 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu2 : 2.0 us, 0.0 sy, 0.0 ni, 98.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu3 : 5.0 us, 0.0 sy, 0.0 ni, 95.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 896664 total, 94520 free, 489596 used, 312548 buff/cache
KiB Swap: 1023996 total, 954364 free, 69632 used. 351764 avail Mem

Thanks in advance for you help/suggestions,

Best Regards,
Rino

Antworten

o bishoph says:
11. Januar 2019 at 16:32

Top indicated that there are plenty of resources left. A 4 core CPU can work
through a load of 4 and still run smoothly. I would check if the THRESHOLD is
too low. There is a good change that your environment encounters some
background noise, even in frequencies you don’t hear. This means SOPARE
checks constantly against a noisy environment. In fact, the only time when the
analysis starts is when the timeouts hit. And this can be seen as kind of hiccup.

Antworten

 Rino says:

11. Januar 2019 at 17:37

tanks for replay.


Ok I modified the theshold value to 2000. The system has become more
‚dull‘, but the behavior does not change.
I added into the config file LOGLEVEL = WARNING and this is the
result when the freezing happens:
WARNING:sopare.recorder:stream read error [Errno -9981] Input
overflowed
WARNING:sopare.recorder:stream read error [Errno -9988] Stream
closed
WARNING:sopare.recorder:stream read error [Errno -9988] Stream
closed
WARNING:sopare.recorder:stream read error [Errno -9988] Stream
closed

and so on until I press ctrl^C

Antworten

 bishoph says:

11. Januar 2019 at 19:36

If the stream is closed SOPARE don’t get further audio data from
pyAudio and stops/hangs/waits until more data is available.

There is plenty of advice available for the -9981 error, mostly to


use a different sample rate or a different chunk size. Just do some
searching. As this issue is pyAudio related (and depends on your
hardware/environment/config) I can’t do much ;(
Antworten

61. Claudio Guendelman says:

16. Januar 2019 at 22:43

Can you post how do a plugin for the on off light and the code i will appreciate soo much
hugs from Chile soouth America Claudio

Antworten

o bishoph says:

17. Januar 2019 at 19:03

As I’m using my own home control system the code would not help as you don’t
have the interface. What system or service do you want to use?

Antworten

62. Neeraj Kashyap says:

17. Januar 2019 at 11:18

Does SOPARE works in Windows?. Currently I am using python 3.4.1 and windows 7. I
tried to run SOPARE in python 2.7.12 version in windows it is unable to handle multi-
threading.

can you please suggest how to handle it in windows?

Antworten

o bishoph says:

17. Januar 2019 at 19:09

Never tried and I really don’t know as the development platform and the target
platform is Raspberry Pi in combination with a Linux OS like Raspbian. If you
are able to solve the dependencies it could work…

Antworten
63. ravikumar says:

9. Februar 2019 at 9:13

Cloning into ’sopare’…


fatal: unable to access ‚https://github.com/bishoph/sopare.git/‘: gnutls_handshake()
failed: Error in the pull function.

Antworten

o bishoph says:

9. Februar 2019 at 22:45

Yes. This is an error regarding git, SSH and maybe lots of other stuff. Just fix
your system and have fun 🙂

Antworten

64. kyrie33 says:

9. Februar 2019 at 22:33

Can this sopare can work using broadlink for home automation

Antworten

o bishoph says:

9. Februar 2019 at 22:48

SOPARE has no builtin function for „Broadlink Home Automation“. But you can
implement whatever you want using a custom plugin. Hope that answers your
question.

Antworten

65. hyc38 says:

10. März 2019 at 5:37


Is there a way to start Sopare at boot? I tried adding to rc.local but I was not able to with
the argument.

Antworten

o bishoph says:

10. März 2019 at 10:38

Yes, sure. I provide a start/stop script including helpful information about the
usage and setup:

https://github.com/bishoph/Misc/blob/master/sopare_service

Antworten

66. Zhao says:

11. März 2019 at 23:11

Hi, is there a way to select the audio device that SOPARE records from please? I have a
USB microphone but editing the alsa conf files does not seem to allow me to set a default
device. I know, however, that calling it directly e.g. arecord -d 3 -D plughw:2 test.wav
allows me to access the microphone. Is this possible with python?

Cheers,
Z

Antworten

o bishoph says:

12. März 2019 at 10:28

Between SOPARE and the hardware are many layers of abstraction. Therefore the
right way is to define the default card in ALSA:

https://www.alsa-project.org/main/index.php/Asoundrc

In your case the file

~/.asoundrc

should look like this:


pcm.!default {
type hw
card 2
}
ctl.!default {
type hw
card 2
}

Hope that helps. Have fun 🙂

Antworten

67. abubaker says:

17. März 2019 at 14:39

hi martin i m a big fan of your work currently working on your project can you please
provide me the code of light on and light on gpio basically i m new to pi

Antworten

o bishoph says:

17. März 2019 at 16:24

Thx, but I don’t have any GPIO code I could provide. SOPARE code and also
examples are available on GitHub: https://github.com/bishoph/

Have fun!

Antworten

68. AP says:

27. März 2019 at 3:03

I got the program installed and then got my alsa file cleaned up, but I’m still seeing errors
when I run the two tests. I think they are mostly on the test_audio.py one, but I included
both sets of results here.

pi@Voice-01:~/dev/sopare $ python sopare.py -u


sopare 1.5.0
starting unit tests…
starting analyze tests…
analyze test preparation…
testing analyze get_match…
testing normal conditions (1)[u’test1′] == [u’test1′]
testing normal conditions (2)[u’test1′, u’test3′] == [u’test1′, u’test3′]
testing normal conditions (3)[u’test1′, u’test3′, u’test2′] == [u’test1′, u’test3′, u’test2′]
testing leading space [u’test1′, u’test3′, u’test2′] == [u’test1′, u’test3′, u’test2′]
testing ending space [u’test1′, u’test3′, u’test2′] == [u’test1′, u’test3′, u’test2′]
testing correct order [u’test1′, u’test3′, u’test2′, u’test1′, u’test3′, u’test2′] == [u’test1′,
u’test3′, u’test2′, u’test1′, u’test3′, u’test2′]
testing strict length [u’test1′, u’test3′, “, u’test2′] == [u’test1′, u’test3′, “, u’test2′]
testing false leading results [“, u’test1′, “, u’test2′] == [“, u’test1′, “, u’test2′]
analyze tests run successful.
filter test preparation…
testing filter n_shift…
testing n_shift [5, 6, 7, 8, 9, 10, 11, 12, 13, 14] == [5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
testing n_shift [15, 16, 17, 18, 19, 20, 21, 22, 23, 24] == [15, 16, 17, 18, 19, 20, 21, 22,
23, 24]
testing n_shift [25, 26, 27, 28, 29, 30, 31, 32, 33, 34] == [25, 26, 27, 28, 29, 30, 31, 32,
33, 34]
filter tests run successful.
unit_tests run successful!
done.

pi@Voice-01:~/dev/sopare $ python test/test_audio.py


test_audio init…
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
testing different SAMPLE_RATEs … this may take a while!

DEBUG:sopare.audio_factory:#### Default input device info #####


DEBUG:sopare.audio_factory:defaultSampleRate: 44100.0
DEBUG:sopare.audio_factory:defaultLowOutputLatency: -1.0
DEBUG:sopare.audio_factory:defaultLowInputLatency: 0.00868480725624
DEBUG:sopare.audio_factory:maxInputChannels: 1
DEBUG:sopare.audio_factory:structVersion: 2
DEBUG:sopare.audio_factory:hostApi: 0
DEBUG:sopare.audio_factory:index: 2
DEBUG:sopare.audio_factory:defaultHighOutputLatency: -1.0
DEBUG:sopare.audio_factory:maxOutputChannels: 0
DEBUG:sopare.audio_factory:name: USB PnP Sound Device: Audio (hw:1,0)
DEBUG:sopare.audio_factory:defaultHighInputLatency: 0.0348299319728
Expression ‚paInvalidSampleRate‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2048
Expression ‚PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self-
>primeBuffers, hwParamsCapture, &realSr )‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘,
line: 2719
Expression ‚PaAlsaStream_Configure( stream, inputParameters, outputParameters,
sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )‘
failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2843
ERROR:sopare.audio_factory:Error: [Errno -9997] Invalid sample rate
Expression ‚paInvalidSampleRate‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2048
Expression ‚PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self-
>primeBuffers, hwParamsCapture, &realSr )‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘,
line: 2719
Expression ‚PaAlsaStream_Configure( stream, inputParameters, outputParameters,
sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )‘
failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2843
ERROR:sopare.audio_factory:Error: [Errno -9997] Invalid sample rate
Expression ‚paInvalidSampleRate‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2048
Expression ‚PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self-
>primeBuffers, hwParamsCapture, &realSr )‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘,
line: 2719
Expression ‚PaAlsaStream_Configure( stream, inputParameters, outputParameters,
sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )‘
failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2843
ERROR:sopare.audio_factory:Error: [Errno -9997] Invalid sample rate
Expression ‚paInvalidSampleRate‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2048
Expression ‚PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self-
>primeBuffers, hwParamsCapture, &realSr )‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘,
line: 2719
Expression ‚PaAlsaStream_Configure( stream, inputParameters, outputParameters,
sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )‘
failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2843
ERROR:sopare.audio_factory:Error: [Errno -9997] Invalid sample rate
Expression ‚paInvalidSampleRate‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2048
Expression ‚PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self-
>primeBuffers, hwParamsCapture, &realSr )‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘,
line: 2719
Expression ‚PaAlsaStream_Configure( stream, inputParameters, outputParameters,
sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )‘
failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2843
ERROR:sopare.audio_factory:Error: [Errno -9997] Invalid sample rate
Expression ‚paInvalidSampleRate‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2048
Expression ‚PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self-
>primeBuffers, hwParamsCapture, &realSr )‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘,
line: 2719
Expression ‚PaAlsaStream_Configure( stream, inputParameters, outputParameters,
sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )‘
failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 2843
ERROR:sopare.audio_factory:Error: [Errno -9997] Invalid sample rate
testing different CHUNK sizes … this may take a while!

Excellent. Got all 5120 chunks.


Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Excellent. Got all 40960 chunks.
Excellent. Got all 81920 chunks.
Excellent. Got all 5120 chunks.
Excellent. Got all 10240 chunks.
Excellent. Got all 20480 chunks.
Excellent. Got all 40960 chunks.
Excellent. Got all 81920 chunks.

Your sopare/config.py recommendations:

SAMPLE_RATE = 48000
CHUNK = 512
THRESHOLD = 100

Any suggestions?

Antworten

o bishoph says:

27. März 2019 at 17:40

Nope. Everything is fine. The SOPARE test was successful and you got
everything you need to proceed.

Antworten

 AP says:

29. März 2019 at 16:06

Ok, I did the training (for „test“), when I run the listener I get the output
below.

===============
sopare 1.5.0
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1,
skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1,
skipping unlock
[]
[]
[u’test‘]
[]
[u’test‘]
[]
[]
[]
[]
[u’test‘]
[]
^CTraceback (most recent call last):
=========

What are the errors about „Cannot connect to server“ and „jack server“
about?

Antworten

 bishoph says:

29. März 2019 at 17:00

This are ALSA warnings and are not related to SOPARE. You can
a) ignore them
or
b) try to get rid of them.

As I have no further input about ASLA/Jack and your environment


I can’t help much.

Antworten

69. Sean says:

27. März 2019 at 15:29


When I run „python2.7 sopare.py -l“ I get the following error message. I am using this
inside a virtual environment, but i don’t think that’s the problem as it works outside the
environment.

sopare 1.5.0
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.front.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown 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 confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround40.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround51.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.surround71.0:CARD=0‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM iec958
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
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 confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚defaults.bluealsa.device‘
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error:
No such file or directory
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa

Antworten

o bishoph says:

27. März 2019 at 17:43

This is not an error message related to SOPARE. 99% of the output comes from
ALSA and you get rid of it by cleaning up your ALSA config,

Antworten

 Sean says:

27. März 2019 at 18:08

I cant see any error messages in the ALSA config. What am i looking for?

Antworten

 bishoph says:

27. März 2019 at 20:37

Let’s try to figure this out. As neither SOPARE nor ALSA shows
error messages you can just leave it as it is and it should work. But:
as the ALSA output is cluttered with warnings I recommend to
clean up your ALSA configuration.
This can be cone by simply commenting out unused devices in
your alsa.conf (like in your case the PCM stuff):

Place a „#“ in front of the lines that appear in the warnings, save
the file and test if everything works. Before you start make a copy
of the file just to be safe:

Like search for this line


defaults.pcm.front.card defaults.pcm.card

and comment it out.


#defaults.pcm.front.card defaults.pcm.card
Save, test and repeat.

Antworten

70. onacvooe says:

31. März 2019 at 22:27

Hi, thank you for your great work on this. But I’m running into trouble. I have installed
SOPARE succesfully and both test runs successfully.

But when trying to learn the „test“ word (or any word) I get the following error:

0.09402073267550819, 0.07503437200250257, 0.0837933995321481,


0.09745028536740484, 0.06661686489456727, 0.08580949954209392,
0.06002299178606901, 0.10813029430710187, 0.06798151458981183,
0.07285299152412461, 0.10555516512743991, 0.067834334251818], ‚token_peaks‘: []}
DEBUG:sopare.worker:meta = [{‚token‘: ’stop‘}]
INFO:sopare.buffering:terminating queue runner
INFO:sopare.recorder:Buffering not alive, stop recording
INFO:sopare.recorder:stop endless recording

Just in case, I have also waited a while before speaking my test word. To see if it would
still record noise. But then the number won’t run on the screen. But as soon as I say the
word test, the number run and before I can say test for the second time it stops recording.

Can you help me?

I have ubuntu 18.04 (I know, not a RPi) and followed your tutorial for installing
SOPARE.

I installed it today (31 march 2019)

Thank you for all your help

Antworten

o bishoph says:

1. April 2019 at 10:10

With pleasure. There is no error in your output and I really don’t know what the
problem is…please try to be specific, provide step by step „how to reproduce“
instructions including desired outcome and full output. If you encounter an issue
please file an issue on GitHub for easy tracking/reporting. Thx.

Have fun!

Antworten

 onacvooe says:

1. April 2019 at 11:00

Thank you, for your answer. I just sorted it out and can confirm it is
working now!
Just one question, I’m trying to send a curl command on recognizing a
word. But I cannot get it tot work. Can you point me in the right direction?
This is what I got in custom my __init__.py

########################### BEGIN
#!/usr/bin/env python
# -*- coding: utf-8 -*-

„““
Copyright (C) 2015 – 2017 Martin Kauss (yo@bishoph.org)

Licensed under the Apache License, Version 2.0 (the „License“); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software


distributed under the License is distributed on an „AS IS“ BASIS,
WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the
License for the specific language governing permissions and limitations
under the License.
„““

# Default plugin for output of analysis

def run(readable_results, data, rawbuf):


if (‚lampen‘ in readable_results and ‚aan‘ in readable_results):
print (‚Jups, 2 woorden gevonden, best genoch‘)
if (len(readable_results) == 2 and ‚aan‘ in readable_results[0] and
‚lampen‘ in readable_results[1]):
import requests

headers = {
‚Content-Type‘: ‚text/plain‘,
}

data = ‚OFF‘

response =
requests.post(‚http://192.168.1.253:8080/rest/items/wcd001_schakelaar‘,
headers=headers, data=data)

################################ END

I know that the curl command is correct, but how do I put it correctly in de
init file? Can you help?

Antworten

 bishoph says:

1. April 2019 at 13:58

Great that it is working for you! As you posted the code without
indentation I could argue that the indentation is missing/wrong.
And the import should be placed on top of the file. I suggest and
recommend that you get familiar with Python programming if you
want to start coding 😉

Antworten

 onacvooe says:

2. April 2019 at 10:10

Thank you, for all your help. I have put this issue on your
Github and it is already solved. So. But thank you 😉

71. Anthony Britton says:

9. April 2019 at 16:23


Hello,

I do not know anything about Raspberry Pi or programming, but Google had led me to
this page.
Is it possible to use this with a small 12vdc motor to use voice command to make it run
forward or reverse?

Antworten

o bishoph says:

9. April 2019 at 17:57

Short answer is yes. The longer answer is that you need experience in Python
development and electronic as you need
a) a SOPARE plugin for your custom motor control
b) a motor shield or maybe just a relay to separate the motor from the PI (at least
2 circuits: GPIO 3.3v and 12v)

Antworten

72. Sean says:

9. April 2019 at 18:27

Hi,
I have been trying to figure out how to get sopare working, and from all the other
comments i see that i need to clear the alsa.conf file. Could you please explain in detail
how to do that, because i can’t find any error messages in it. I have tried using a fresh
install of raspbian stretch on a raspberry pi 3.

[DELETED alsa.conf file]

Antworten

o bishoph says:

10. April 2019 at 9:36

First of all I deleted the alsa configuration from the comment as it makes no sense
to present us a standard alsa.conf in full detail here. Second: You don’t have to
clean the config, you want to clean it. Comment out the hardware/lines that show
up in the ALSA warnings and that are not attached/used. There are already
comments available how to do this:

https://www.bishoph.org/step-by-step-raspberry-pi-offline-voice-recognition-
with-sopare/#comment-234
https://github.com/bishoph/sopare/issues/7

Antworten

 Sean says:

10. April 2019 at 9:41

„You don’t have to clean the config, you want to clean it.“

What?
I cant find any ALSA warnings in the .conf file

Antworten

 bishoph says:

10. April 2019 at 9:53

Cleaning helps you to reduce warnings when you start SOPARE or


use any other program that uses ALSA, but you don’t have to, it’s
optional.

Antworten

73. Mubasher says:

15. April 2019 at 15:49

Hello sir,
I wanted to ask you what classification method did you used in sopare. Is it Feed forward
Neural network, Recurrent neural networks or HMM ?

Antworten

o bishoph says:

15. April 2019 at 19:54


Hello. This has been asked before. The classification is something I developed on
my own. No neural network involved nor the Hidden Markov Model. It’s just
some configurable classifications/parameters derived from selected
characteristics. You hopefully get the picture when you read this post 🙂

Antworten

74. Muhammad Hassaan says:

1. Mai 2019 at 22:17

I am really inspired by your Great effort,


everything works fine but test_audio give recommendations in which it ask to set
Threshold value: 32800
which is very large whereas other ones are normal; i set this value but during training i
get stream error and stucks
i lower the value and set it to 320 but result is the same
I am using webcam as the microphone

Antworten

o bishoph says:

6. Mai 2019 at 22:58

While the test_audio is running SOPARE measures the loudness of your


environment. 32800 means you are living inside of an airplane engine. Or
something similar. Such an environment is maybe too noisy for SOPARE. Not
sure…
Have fun!

Antworten

75. Renato says:

4. September 2019 at 1:00

That is not voice recognition. It is speech recognition. They are very different things.

Antworten

o bishoph says:
4. September 2019 at 9:47

From my perspective SOPARE is capable to recognition a voice. Can you please


explain why do you think hat SOPARE is not voice recognition?

Antworten

76. Elliot says:

19. September 2019 at 13:40

Hi Martin,

First at all congratulations for your work with Sopare.


Sopare and my mic work well in ubuntu and I am trying to get Sopare running on Pi 3 but
I am stuck at getting my threshold.
If I run test_audio.py, it always says THRESHOLD = 0. Or if I run ./sopare.py -v -t train,
it always stops at „INFO:sopare.recorder:start endless recording“ no matter how loud I
try to speak (I set THRESHOLD = 500 in config/default.ini).
I have a usb desktop microphone attached to the Raspberry Pi 3.
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
Audio recording with this microphone also works. So I don’t know why it doesn’t work
in Sopare.
Here is the shortened notice on the terminal:

pi@raspberrypi:~/dev/sopare $ python test/test_audio.py


test_audio init…

Your sopare/config.py recommendations:

SAMPLE_RATE = 48000
CHUNK = 512
THRESHOLD = 0

pi@raspberrypi:~/dev/sopare $ ./sopare.py -v -t train


sopare 1.5.0
Expression ‚alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams,
&alsaPeriodFrames, &dir )‘ failed in ’src/hostapi/alsa/pa_linux_alsa.c‘, line: 924
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
‚cards.bcm2835_alsa.pcm.front.0:CARD=0′


DEBUG:sopare.audio_factory:defaultSampleRate: 44100.0
INFO:sopare.worker:worker queue runner started
DEBUG:sopare.audio_factory:defaultLowOutputLatency: 0.0087074829932
DEBUG:sopare.audio_factory:defaultLowInputLatency: 0.0087074829932
DEBUG:sopare.audio_factory:maxInputChannels: 32
DEBUG:sopare.audio_factory:structVersion: 2
DEBUG:sopare.audio_factory:hostApi: 0
DEBUG:sopare.audio_factory:index: 4
DEBUG:sopare.audio_factory:defaultHighOutputLatency: 0.0348299319728
DEBUG:sopare.audio_factory:maxOutputChannels: 32
DEBUG:sopare.audio_factory:name: default
DEBUG:sopare.audio_factory:defaultHighInputLatency: 0.0348299319728
INFO:sopare.buffering:buffering queue runner
DEBUG:sopare.recorder:SAMPLE_RATE: 48000
DEBUG:sopare.recorder:CHUNK: 512
INFO:sopare.recorder:start endless recording
^CProcess buffering queue:
Process worker for filtered data:
Traceback (most recent call last):
Traceback (most recent call last):
File „/usr/lib/python2.7/multiprocessing/process.py“, line 258, in _bootstrap
File „/usr/lib/python2.7/multiprocessing/process.py“, line 258, in _bootstrap
self.run()
self.run()
File „/home/pi/dev/sopare/sopare/worker.py“, line 88, in run
File „/home/pi/dev/sopare/sopare/buffering.py“, line 40, in run
buf = self.queue.get()
obj = self.queue.get()
File „/usr/lib/python2.7/multiprocessing/queues.py“, line 117, in get
File „/usr/lib/python2.7/multiprocessing/queues.py“, line 117, in get
res = self._recv()
res = self._recv()
KeyboardInterrupt
KeyboardInterrupt
Traceback (most recent call last):
File „./sopare.py“, line 187, in
main(sys.argv[1:])
File „./sopare.py“, line 108, in main
recorder.recorder(cfg)
File „/home/pi/dev/sopare/sopare/recorder.py“, line 44, in __init__
self.recording()
File „/home/pi/dev/sopare/sopare/recorder.py“, line 88, in recording
buf = self.stream.read(self.cfg.getintoption(’stream‘, ‚CHUNK‘))
File „/usr/lib/python2.7/dist-packages/pyaudio.py“, line 608, in read
return pa.read_stream(self._stream, num_frames, exception_on_overflow)
KeyboardInterrupt

Do I have to specify something somewhere? Thanks!


Antworten

o bishoph says:

19. September 2019 at 18:55

Seems that you have two sound cards and the one that is able to record sound is
not the default card in the ASLA config. As soon as you change this it should
work…

Antworten

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Kommentar

Name *

E-Mail *

Website

Neueste Beiträge
 SOPARE architecture and plugins
 Step by step: Raspberry Pi offline voice recognition with SOPARE
 SOPARE 1.5 is available; Feedback
 Sopare precision and accuracy
 Sopare basic usage. Voice controlling a magic mirror

Buzzwords
Allgemein Banana Pi Development Mobile Pinball Raspberry Pi smarthome smartphone Solar

power voice recognition Wifi

You might also like