respeaker / usb_4_mic_array

ReSpeaker 4 Mic Array with builtin VAD, DOA, AEC, Beamforming & NS
https://www.seeedstudio.com/ReSpeaker-Mic-Array-v2.0-p-3053.html
Apache License 2.0
141 stars 65 forks source link

ODAS with Mic Array v2.0 on ReSpeaker Core v1.0 #2

Closed jawsman closed 6 years ago

jawsman commented 6 years ago

Hello, guys. I’d like to express my big gratitude for your work. I am so excited to use Mic Array v2 with ReSpeaker Core v1.0. Actually I bought these boards because I found your mention about ODAS project.

Now I wonder if you showed me how to install on ReSpeaker Core v1.0 following libraries which are needed as prerequisites so that ODAS would work. CMake, GCC, libfftw3-dev, libconfig-dev, libasound2-dev Here is their github page. https://github.com/introlab/odas/wiki/installation

First of all I have tried to install CMake on ReSpeaker Core. So I did like this via the web terminal.

# wget https://cmake.org/files/v3.11/cmake-3.11.1.tar.gz
# tar xvf cmake-3.10.3.tar.gz
tar: invalid tar magic

See? tar command doesn’t work. In case the file got broken I tried downloading twice. Maybe should I update BusyBox first? If you have detailed webpages I am grad to see that though I’ve been trying to find related articles. Thanks.

xiongyihui commented 6 years ago

ODAS can not be used with respeaker core v1.0. To use ODAS, ReSpeaker 4 Mic Array for Pi or ReSpeaker USB Mic Array v1.0/v2.0 is needed. ODAS should be running on a computer or raspberry pi.

jawsman commented 6 years ago

Thank you for your quick reply. Ive been disappointed to hear my ReSpeaker Core v1.0 was not useless and struggling with a Raspberry Pi. To run ODAS I put in Pi the necessary libraries which were shown at ODAS github page. But Pi doesn't seem to recognize 4 channels of mics because Audacity which runs with Mic Array v2.0 only shows a MONO channel. Now I wounder if you showed me how to record with 4 channel with Mic Array v2.0. What kind of library is needed for it?

jawsman commented 6 years ago

For more info I tried these command showed at the page bellow for Pi. https://github.com/respeaker/mic_array_dfu sudo apt-get install libusb-1.0-0-dev git clone https://github.com/respeaker/mic_array_dfu.git cd mic_array_dfu make sudo ./dfu --download respeaker_mic_array_8ch_raw.bin

But turned like this $ sudo ./dfu --download respeaker_mic_array_8ch_raw.bin VID = 0x2886, PID = 0x18, BCDDevice: 0x112 VID = 0x424, PID = 0xec00, BCDDevice: 0x200 VID = 0x424, PID = 0x9514, BCDDevice: 0x200 VID = 0x1d6b, PID = 0x2, BCDDevice: 0x414 Could not find/open device

Maybe is the hardware broken?

xiongyihui commented 6 years ago

Are you using the ReSpeaker USB Mic Array v2.0 (4 microphones)? You should use tools of this repo, see https://github.com/respeaker/usb_4_mic_array#device-firmware-update

jawsman commented 6 years ago

Yes. I've been try with USB Mic Array v2.0 which is the same as below link. http://wiki.seeedstudio.com/ReSpeaker_Mic_Array_v2.0/ And also tried with ReSpeaker 4-Mic Array for Raspberry Pi as shown this link. http://wiki.seeedstudio.com/ReSpeaker_4_Mic_Array_for_Raspberry_Pi/

Now I would like to tell you I have already tried the way you suggested at your reply. Could you show me exactly how to use Audacity with USB Mic Array v2.0, please. Maybe it comes from its setting.

xiongyihui commented 6 years ago

Would you mind to provide more information of your operations, such as your OS, firmware update log.

To upgrade the firmware of the usb 4 mic array

git clone https://github.com/respeaker/usb_4_mic_array
cd usb_4_mic_array
pip install pyusb
python dfu.py --download i6_firmware.bin

The log of dfu.py is like:

$ python dfu.py --download i6_firmware.bin 
entering dfu mode
found dfu device
downloading
150336 bytes
done

After the upgrade, the mic array should have 6 channels input. We can run arecord --dump-hw-params -D hw:{sound card number} to check if the upgrade is OK or not. Replace {sound card number} with your sound card number. My sound card number is 1, so the log is like:

$lsusb
Bus 003 Device 021: ID 2886:0018

$ arecord --dump-hw-params -D hw:1
Recording WAVE 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono
HW Params of device "hw:1":
--------------------
ACCESS:  MMAP_INTERLEAVED RW_INTERLEAVED
FORMAT:  S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: 16
FRAME_BITS: 96
CHANNELS: 6
RATE: 16000
PERIOD_TIME: [1000 2730625]
PERIOD_SIZE: [16 43690]
PERIOD_BYTES: [192 524280]
PERIODS: [2 1024]
BUFFER_TIME: [2000 5461313)
BUFFER_SIZE: [32 87381]
BUFFER_BYTES: [384 1048572]
TICK_TIME: ALL
--------------------
arecord: set_params:1233: Sample format non available
Available formats:
- S16_LE

$ arecord -D hw:1 -f S16_LE -r 16000 -c 6 -v test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Channels 6
Hardware PCM card 1 'ReSpeaker 4 Mic Array (UAC1.0)' device 0 subdevice 0
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 6
  rate         : 16000
  exact rate   : 16000 (16000/1)
  msbits       : 16
  buffer_size  : 8000
  period_size  : 2000
  period_time  : 125000
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 2000
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 8000
  silence_threshold: 0
  silence_size : 0
  boundary     : 9007199254740992000
  appl_ptr     : 0
  hw_ptr       : 0
^CAborted by signal Interrupt...

Then you can use audacity to record 6 channels audio (open audacity >> select ReSpeaker ... on the toolbar >> change channel number to 6 >> start to record)

image

Note:

If the mic array is used as the default sound card of your system, audacity would fail to list the usb mic array if the other application is already using it.

jawsman commented 6 years ago

Thank you for your detailed info! Actually I am on a business trip now. So I have no Pi, neither MicArray at this moment and can't tell you my environment.I would like to try your suggestions ASAP. Thank you so much again. talk to you soon.

jawsman commented 6 years ago

I tried this code with pi. $ python dfu.py --download i6_firmware.bin

But the response is like this Traceback (most recent call last): File "dfu.py", line 229, in <module> main() File "/usr/lib/python2.7/dist-packages/click/core.py", line 716, in __call__ return self.main(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/usr/lib/python2.7/dist-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/lib/python2.7/dist-packages/click/core.py", line 534, in invoke return callback(*args, **kwargs) File "dfu.py", line 218, in main dev = XMOS_DFU() File "dfu.py", line 198, in __init__ super(XMOS_DFU, self).__init__() File "dfu.py", line 71, in __init__ devices = self.find() File "dfu.py", line 61, in find configuration = device.get_active_configuration() File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 875, in get_active_configuration return self._ctx.get_active_configuration(self) File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 102, in wrapper return f(self, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 236, in get_active_configuration self.managed_open() File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 102, in wrapper return f(self, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 120, in managed_open self.handle = self.backend.open_device(self.dev) File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 786, in open_device return _DeviceHandle(dev) File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 643, in __init__ _check(_lib.libusb_open(self.devid, byref(self.handle))) File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 595, in _check raise USBError(_strerror(ret), ret, _libusb_errno[ret]) usb.core.USBError: [Errno 13] Access denied (insufficient permissions)

Some errors happened. Could you show me what is going on,please.

xiongyihui commented 6 years ago

It's usb permission issue. Should try python dfu.py --download i6_firmware.bin

xiongyihui commented 6 years ago

Sorry, it's sudo python dfu.py --download i6_firmware.bin