Python example of DOA for any sound?

My respeaker 4 mic array for raspberry pi installed fine. Does anyone know how to get the direction of arrival for any sound, not just voice? I want to get the degrees (0-360) of any sound loud enough to activate the microphone array. No speech recognition, just the direction of arrival. Thanks! It seems simple but I can’t figure it out.

Hi there,


  1. install the dependencies



    sudo apt-get install portaudio19-dev

    pip install webrtcvad

    pip install pyaudio

    pip install pyusb


  2. run the vad_doa.py



    git clone https://github.com/respeaker/mic_array.git

    cd mic_array

    python vad_doa.py


  3. result:





    pi@raspberrypi:~/mic_array $ python vad_doa.py

    No USB device found

    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

    (0, ‘bcm2835 ALSA: - (hw:0,0)’, 0L, 2L)

    (1, ‘bcm2835 ALSA: IEC958/HDMI (hw:0,1)’, 0L, 2L)

    (2, ‘seeed-4mic-voicecard: - (hw:1,0)’, 4L, 0L)

    Use seeed-4mic-voicecard: - (hw:1,0)

    11111110000000000000000000000000000000000000000000000000000000111111111111111100

    194

    0000000000000000000000000000000000000000000000000000000000000001111111110000000000000000000000000000000000000000000000000000000000000000000111111111111111111111

    194

    111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111

    194

    11111111111111111111

    194

    110000000000000000000000000000000000000111111111111111111111

    194

    11111111111111111111

    194

    11111111111111111111

    194

    00000000000000000000000000000000000000000000000000000000000000000000111111110000000000000000111111111111111110000000000000111111111111111111

    358

    11111111111111111111

    14

    11111111111111111111

    30

    11111111111111111111

    14