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.

Offline and real time voice speech recognition for Raspberry Pi

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.

Raspberry Pi with Mic

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!

100 thoughts on “Step by step: Raspberry Pi offline voice recognition with SOPARE

  1. 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.

      • 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)

        • 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.

        • 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 😉

          • 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! 🙂

          • 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. 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

    • 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
      ...
      
  3. 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

    • 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.

  4. 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

    • 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.

  5. 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).communicate()[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

    • 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 😉

  6. 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

  7. 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

  8. 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 ..

  9. 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

    • 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 🙂

      • 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

        • 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=203547

          Check if you your system is capable of record audio by running the audio test SOPARE provides:

          python test/test_audio.py

  10. 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.

    • 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.

      • This is a fresh installation, standard raspian without X, age of max. 10 minutes, sopare from git, and only the changes as mentioned.

        • 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.

          • 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.

  11. 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

  12. 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

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

  14. 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.

  15. 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

    • 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 😉

  16. 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

  17. 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.

    • 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.

  18. 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

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

  19. 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?

      • 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

  20. 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

    • 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…

      • 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 😉

  21. …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]

    • 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….

  22. 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

    • 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.

      • 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…

          • Nee, am Pi liegt es nicht, bei mir läuft es auch allen Modellen. Details zum möglichen Vorgehen und Debuggen siehe Kommentar unten.

        • 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…

          • 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 ] ]
            }

          • 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=item25f0c00e73:g:jxUAAOSwWCBarrtJ)

          • 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?

  23. 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!

    • 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.

  24. ü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 ] ]
    }

  25. 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

    • 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…

  26. 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… 🙂

  27. … 🙂
    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 😉

  28. 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

  29. 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

    • 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 🙂

  30. 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.

    • 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.

  31. 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__
    []
    []
    []
    []
    []
    []
    []
    []

  32. 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)

    • 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.

  33. 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

  34. 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

    • 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

    • 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.

      • 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

  35. 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

  36. 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

    • 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.

  37. 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

    • 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.

  38. 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

    • 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!

  39. 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

    • 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 🙂

Schreibe einen Kommentar

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