1回答

1收藏

Respeaker Mic array V2.0开发板 相关资料

#其他 #其他 7825 人阅读 | 1 人回复 | 2018-09-13




Seeed 的 ReSpeaker Mic Array v2.0 是基于 XVSM-2000 的 ReSpeaker Mic Array v1.0 的升级版本。v2.0 是基于 XMOS 的 XVF-3000 开发。它可以堆叠 (连接) 到 ReSpeaker Core 的顶部,显着改善语音交互体验。该主板集成了 4 个 PDM 麦克风,有助于将 ReSpeaker 的声学 DSP 性能提高到更高的水平。

ReSpeaker Mic Array v2.0 直接支持 USB Audio Class 1.0 (UAC 1.0)。所有主流的操作系统,如 Windows,MacOS,Linux 都与 UAC 1.0 兼容,因此它可以作为声卡运行而无需 ReSpeaker Core,但具有语音算法。
ReSpeaker Mic Array v2.0 有两个固件,一个包含语音算法,另一个仅捕获用于特殊用途的原始语音数据。


产品特性
  • 远场语音捕获
  • UAC 1.0
  • 四麦阵列
  • 12 个可编程 RGB LED 指示灯
  • 语音算法和功能
  • 语音活动检测 Voice Activity Detection
  • DOA
  • 波束成形
  • 噪声抑制
  • 消混响
  • 声学回声消除


规格参数
参数
16 内核 XVF-30002 个 xCore 磁贴上的 16 个实时逻辑核心
dual issue 模式下内核共享最高可达 2400 MIPS
512KB 内部单周期 SRAM 和 2MB 内置闪存
16KB 内部 OTP (每块最大 8KB)
USB PHY,完全符合 USB 2.0 规范
可编程 I/O
支持 DFU 模式
4 个数字麦克风 (型号 : MP34DT01-M)单电源电压
低功耗
120 dB SPL 声学过载点
61 dB 信噪比
全方位的灵敏度
-26 dB FS 灵敏度
PDM 输出
12 RGB LEDs (型号 : APA102)256 级亮度
800kHz 线路数据传输
音频输出板载 3.5mm Aux 输出
WOLFSON WM8960
24 位或 16 位 16kHz 立体声输出
16 Ω @ 3.3 V 下输出功率为 40mW
尺寸直径 70mm
功率Micro USB 或扩展接头供 5V 电源
功耗 190mA



硬件概述


  • XMOS XVF-3000 : 它集成了先进的 DSP 算法,包括声学回声消除 (AEC),波束成形,去混响,噪声抑制和增益控制。
  • WM8960 : WM8960 是一款低功耗立体声编解码器,采用 D 类扬声器驱动器,可为每个通道提供 1 W,总计 8 W 的负载。
  • 3.5mm Headphone jack : 输出音频,我们可以将有源音响或耳机插入此端口。
  • USB Port : 提供电源并控制麦克风阵列。
  • RGB LED : 三色 RGB LED。
  • Digital Microphone : MP34DT01-M 是一款超小型,低功耗,全方位的数字 MEMS 麦克风,内置电容式感应元件和 IC 接口。

引脚图



尺寸图



创意应用
  • USB 语音捕获
  • 智能音响
  • 智能语音助理系统
  • 录音机
  • 语音会议系统
  • 会议通信设备
  • 语音互动机器人
  • 车载语音助手
  • 其他需要语音命令的场景

入门指导
Note
ReSpeaker Mic Array v2.0 兼容 Windows,Mac 和 Linux 系统。以下脚本在 Python2.7 上进行了测试。

安装 DFU 和 LED 控制驱动程序
  • Windows : 音频录制和播放运行良好。Windows 上仅需 Libusb-win32 驱动程序来控制 LED 指示灯。我们使用 一个方便的工具 - Zadig为 SEEED DFU 和 SEEED Control 安装 libusb-win32 驱动程序 (ReSpeaker Mic Array 在 Windows 设备管理器中会显示 2 个设备)。



Warning
确保选择 libusb-win32,而不是 WinUSB 或 libusbK。

  • MAC : 无需安装驱动
  • Linux : 无需安装驱动

更行固件
有2个固件。 一个包含 1 个通道数据,另一个包含 6 个通道数据。这里是差异表 :

这是 audacity 刷 i6_firmware 后的录音
对于 Linux 系统 : ReSpeaker Mic Array v2.0 支持 USB DFU。我们开发了一个 python script dfu.py 来通过 USB 更新固件。
  1. sudo apt-get update
  2. sudo pip install pyusb click
  3. git clone https://github.com/respeaker/usb_4_mic_array.git
  4. cd usb_4_mic_array
  5. sudo python dfu.py --download default_firmware.bin  # Change the bin names base on needs
复制代码
这是固件下载结果。
对于 Windows 用户 :我们不建议使用 Windows 更新固件。

控制 LED
我们可以通过 USB 控制 ReSpeaker Mic Array V2 的 LED。USB 设备具有供应商特定的等级接口,可用于通过 USB 控制传输发送数据。我们引用 pyusb python library 并发布 usb_pixel_ring python library

LED 控制命令由 pyusb 的 usb.core.Device.ctrl_transfer() 发送,其参数如下 :
  1. ctrl_transfer(usb.util.CTRL_OUT | usb.util.CTRL_TYPE_VENDOR | usb.util.CTRL_RECIPIENT_DEVICE, 0, command, 0x1C, data, TIMEOUT)
复制代码
这里是 usb_pixel_ring APIs。

对于 Linux 系统 :这里是控制 LED 的示例。
  1. git clone https://github.com/respeaker/pixel_ring.git
  2. cd pixel_ring
  3. sudo python setup.py install
  4. sudo python examples/usb_mic_array.py
复制代码
这里是 usb_mic_array.py 的代码。
  1. import time
  2. from pixel_ring import pixel_ring


  3. if __name__ == '__main__':
  4.     pixel_ring.change_pattern('echo')
  5.     while True:

  6.         try:
  7.             pixel_ring.wakeup()
  8.             time.sleep(3)
  9.             pixel_ring.think()
  10.             time.sleep(3)
  11.             pixel_ring.speak()
  12.             time.sleep(6)
  13.             pixel_ring.off()
  14.             time.sleep(3)
  15.         except KeyboardInterrupt:
  16.             break


  17.     pixel_ring.off()
  18.     time.sleep(1)
复制代码
对于 Windows 系统
这里是控制 LED 的示例
  1. git clone https://github.com/respeaker/pixel_ring.git
  2. cd pixel_ring/pixel_ring
复制代码
用下面的代码创建一个led_control.py并运行 'python led_control.py'
  1. from usb_pixel_ring_v2 import PixelRing
  2. import usb.core
  3. import usb.util
  4. import time

  5. dev = usb.core.find(idVendor=0x2886, idProduct=0x0018)
  6. print dev
  7. if dev:
  8.     pixel_ring = PixelRing(dev)

  9.     while True:
  10.         try:
  11.             pixel_ring.wakeup(180)
  12.             time.sleep(3)
  13.             pixel_ring.listen()
  14.             time.sleep(3)
  15.             pixel_ring.think()
  16.             time.sleep(3)
  17.             pixel_ring.set_volume(8)
  18.             time.sleep(3)
  19.             pixel_ring.off()
  20.             time.sleep(3)
  21.         except KeyboardInterrupt:
  22.             break

  23.     pixel_ring.off()
复制代码
Note
如果您在屏幕上看到 "None",请重新安装 libusb-win32 驱动程序。

调音
我们可以配置一些内置算法的参数。它适用于 Linux 和 Windows。
  • 获取完整列表参数 :
  1. git clone https://github.com/respeaker/usb_4_mic_array.git
  2. cd usb_4_mic_array
  3. python tuning.py -p
复制代码
  • 例如,我们可以关闭自动增益控制 (AGC) :
  1. python tuning.py AGCONOFF 0
复制代码

提取语音
使用 PyAudio python library 通过 USB 提取语音。
对于 Linux 系统 : 可以使用下面的命令来录制或播放语音。
  1. arecord -D plughw:1,0 -f cd test.wav # record, please use the arecord -l to check the card and hardware first
  2. aplay -D plughw:1,0 -f cd test.wav # play, please use the aplay -l to check the card and hardware first
  3. arecord -D plughw:1,0 -f cd |aplay -D plughw:1,0 -f cd # record and play at the same time
复制代码
我们也可以使用 python 脚本来提取语音。
  • 步骤 1,我们需要运行以下脚本来获取麦克风阵列的设备索引号 :
  1. sudo pip install pyaudio
  2. cd ~
  3. nano get_index.py
复制代码
  1. import pyaudio

  2. p = pyaudio.PyAudio()
  3. info = p.get_host_api_info_by_index(0)
  4. numdevices = info.get('deviceCount')

  5. for i in range(0, numdevices):
  6.         if (p.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels')) > 0:
  7.             print "Input Device id ", i, " - ", p.get_device_info_by_host_api_device_index(0, i).get('name')
复制代码
  • Step 3, 按 Ctrl + X 退出并按 Y 保存。
  • Step 4, 运行 'sudo python get_index.py',我们将看到如下的设备 ID。

  1. Input Device id  2  -  ReSpeaker 4 Mic Array (UAC1.0): USB Audio (hw:1,0)
复制代码
  • Step 5, 将 RESPE***ER_INDEX = 2 更改为索引号。运行 python 脚本 record.py 来录制语音。
  1. import pyaudio
  2. import wave

  3. RESPE***ER_RATE = 16000
  4. RESPE***ER_CHANNELS = 1 # change base on firmwares, default_firmware.bin as 1 or i6_firmware.bin as 6
  5. RESPE***ER_WIDTH = 2
  6. # run getDeviceInfo.py to get index
  7. RESPE***ER_INDEX = 2  # refer to input device id
  8. CHUNK = 1024
  9. RECORD_SECONDS = 5
  10. WAVE_OUTPUT_FILENAME = "output.wav"

  11. p = pyaudio.PyAudio()

  12. stream = p.open(
  13.             rate=RESPE***ER_RATE,
  14.             format=p.get_format_from_width(RESPE***ER_WIDTH),
  15.             channels=RESPE***ER_CHANNELS,
  16.             input=True,
  17.             input_device_index=RESPE***ER_INDEX,)

  18. print("* recording")

  19. frames = []

  20. for i in range(0, int(RESPE***ER_RATE / CHUNK * RECORD_SECONDS)):
  21.     data = stream.read(CHUNK)
  22.     frames.append(data)

  23. print("* done recording")

  24. stream.stop_stream()
  25. stream.close()
  26. p.terminate()

  27. wf = wave.open(WAVE_OUTPUT_FILENAME, 'wb')
  28. wf.setnchannels(RESPE***ER_CHANNELS)
  29. wf.setsampwidth(p.get_sample_size(p.get_format_from_width(RESPE***ER_WIDTH)))
  30. wf.setframerate(RESPE***ER_RATE)
  31. wf.writeframes(b''.join(frames))
  32. wf.close()
复制代码
对于 Windows 系统:我们首先运行命令 'pip install pyaudio',然后使用 get_index.pyrecord.py来提取语音。

Warning
如果看到 "Error: %1 is not a valid Win32 application.",请安装 Python Win32 版本。

实时声源定位跟踪
ODAS 代表 Open embeddeD Audition System。这是一个专门用于声源定位,追踪,分离和后期过滤的库。
对于 Linux 用户:
  • Step 1. 获得 ODAS 并构建它。
  1. sudo apt-get install libfftw3-dev libconfig-dev libasound2-dev
  2. sudo apt-get install cmake
  3. git clone https://github.com/introlab/odas.git --branch=dev
  4. mkdir odas/build
  5. cd odas/build
  6. cmake ..
  7. make
复制代码
  • Step 2. 获得 ODAS Studio 然后打开.
  • Step 3. odascore 将位于 odas/bin/odascore,配置文件是 odas.cfg。请根据您的声卡号更改 odas.cfg。

  1. interface: {
  2.     type = "soundcard";
  3.     card = 1;
  4.     device = 0;
  5. }
复制代码
  • Step 4. 使用包含 4 声道原始音频数据的 i6_firmware.bin 更新麦克风阵列。

对于 Windows 系统 : 请参考 ODAS.

FAQ
Q1: Parameters of built-in algorithms
  1. pi@raspberrypi:~/usb_4_mic_array $ python tuning.py -p
  2. name            type    max min r/w info
  3. -------------------------------
  4. AECFREEZEONOFF      int 1   0   rw  Adaptive Echo Canceler updates inhibit.
  5.                                                             0 = Adaptation enabled
  6.                                                             1 = Freeze adaptation, filter only
  7. AECNORM             float   16  0.25    rw  Limit on norm of AEC filter coefficients
  8. AECPATHCHANGE       int 1   0   ro  AEC Path Change Detection.
  9.                                                             0 = false (no path change detected)
  10.                                                             1 = true (path change detected)
  11. AECSILENCELEVEL     float   1   1e-09   rw  Threshold for signal detection in AEC [-inf .. 0] dBov (Default: -80dBov = 10log10(1x10-8))
  12. AECSILENCEMODE      int 1   0   ro  AEC far-end silence detection status.
  13.                                                             0 = false (signal detected)
  14.                                                             1 = true (silence detected)
  15. AGCDESIREDLEVEL     float   0.99    1e-08   rw  Target power level of the output signal.
  16.                                                             [−inf .. 0] dBov (default: −23dBov = 10log10(0.005))
  17. AGCGAIN             float   1000    1   rw  Current AGC gain factor.
  18.                                                             [0 .. 60] dB (default: 0.0dB = 20log10(1.0))
  19. AGCMAXGAIN          float   1000    1   rw  Maximum AGC gain factor.
  20.                                                             [0 .. 60] dB (default 30dB = 20log10(31.6))
  21. AGCONOFF            int 1   0   rw  Automatic Gain Control.
  22.                                                             0 = OFF
  23.                                                             1 = ON
  24. AGCTIME             float   1   0.1 rw  Ramps-up / down time-constant in seconds.
  25. CNIONOFF            int 1   0   rw  Comfort Noise Insertion.
  26.                                                             0 = OFF
  27.                                                             1 = ON
  28. DOAANGLE            int 359 0   ro  DOA angle. Current value. Orientation depends on build configuration.
  29. ECHOONOFF           int 1   0   rw  Echo suppression.
  30.                                                             0 = OFF
  31.                                                             1 = ON
  32. FREEZEONOFF         int 1   0   rw  Adaptive beamformer updates.
  33.                                                             0 = Adaptation enabled
  34.                                                             1 = Freeze adaptation, filter only
  35. FSBPATHCHANGE       int 1   0   ro  FSB Path Change Detection.
  36.                                                             0 = false (no path change detected)
  37.                                                             1 = true (path change detected)
  38. FSBUPDATED          int 1   0   ro  FSB Update Decision.
  39.                                                             0 = false (FSB was not updated)
  40.                                                             1 = true (FSB was updated)
  41. GAMMAVAD_SR         float   1000    0   rw  Set the threshold for voice activity detection.
  42.                                                             [−inf .. 60] dB (default: 3.5dB 20log10(1.5))
  43. GAMMA_E             float   3   0   rw  Over-subtraction factor of echo (direct and early components). min .. max attenuation
  44. GAMMA_ENL           float   5   0   rw  Over-subtraction factor of non-linear echo. min .. max attenuation
  45. GAMMA_ETAIL         float   3   0   rw  Over-subtraction factor of echo (tail components). min .. max attenuation
  46. GAMMA_NN            float   3   0   rw  Over-subtraction factor of non- stationary noise. min .. max attenuation
  47. GAMMA_NN_SR         float   3   0   rw  Over-subtraction factor of non-stationary noise for ASR.
  48.                                                             [0.0 .. 3.0] (default: 1.1)
  49. GAMMA_NS            float   3   0   rw  Over-subtraction factor of stationary noise. min .. max attenuation
  50. GAMMA_NS_SR         float   3   0   rw  Over-subtraction factor of stationary noise for ASR.
  51.                                                             [0.0 .. 3.0] (default: 1.0)
  52. HPFONOFF            int 3   0   rw  High-pass Filter on microphone signals.
  53.                                                             0 = OFF
  54.                                                             1 = ON - 70 Hz cut-off
  55.                                                             2 = ON - 125 Hz cut-off
  56.                                                             3 = ON - 180 Hz cut-off
  57. MIN_NN              float   1   0   rw  Gain-floor for non-stationary noise suppression.
  58.                                                             [−inf .. 0] dB (default: −10dB = 20log10(0.3))
  59. MIN_NN_SR           float   1   0   rw  Gain-floor for non-stationary noise suppression for ASR.
  60.                                                             [−inf .. 0] dB (default: −10dB = 20log10(0.3))
  61. MIN_NS              float   1   0   rw  Gain-floor for stationary noise suppression.
  62.                                                             [−inf .. 0] dB (default: −16dB = 20log10(0.15))
  63. MIN_NS_SR           float   1   0   rw  Gain-floor for stationary noise suppression for ASR.
  64.                                                             [−inf .. 0] dB (default: −16dB = 20log10(0.15))
  65. NLAEC_MODE          int 2   0   rw  Non-Linear AEC training mode.
  66.                                                             0 = OFF
  67.                                                             1 = ON - phase 1
  68.                                                             2 = ON - phase 2
  69. NLATTENONOFF        int 1   0   rw  Non-Linear echo attenuation.
  70.                                                             0 = OFF
  71.                                                             1 = ON
  72. NONSTATNOISEONOFF   int 1   0   rw  Non-stationary noise suppression.
  73.                                                             0 = OFF
  74.                                                             1 = ON
  75. NONSTATNOISEONOFF_SR    int 1   0   rw  Non-stationary noise suppression for ASR.
  76.                                                             0 = OFF
  77.                                                             1 = ON
  78. RT60                float   0.9 0.25    ro  Current RT60 estimate in seconds
  79. RT60ONOFF           int 1   0   rw  RT60 Estimation for AES. 0 = OFF 1 = ON
  80. SPEECHDETECTED      int 1   0   ro  Speech detection status.
  81.                                                             0 = false (no speech detected)
  82.                                                             1 = true (speech detected)
  83. STATNOISEONOFF      int 1   0   rw  Stationary noise suppression.
  84.                                                             0 = OFF
  85.                                                             1 = ON
  86. STATNOISEONOFF_SR   int 1   0   rw  Stationary noise suppression for ASR.
  87.                                                             0 = OFF
  88.                                                             1 = ON
  89. TRANSIENTONOFF      int 1   0   rw  Transient echo suppression.
  90.                                                             0 = OFF
  91.                                                             1 = ON
  92. VOICEACTIVITY       int 1   0   ro  VAD voice activity status.
  93.                                                             0 = false (no voice activity)
  94.                                                             1 = true (voice activity)
复制代码
Q2: ImportError: No module named usb.core
A2: Run sudo pip install pyusb to install the pyusb.
  1. pi@raspberrypi:~/usb_4_mic_array $ sudo python tuning.py DOAANGLE
  2. Traceback (most recent call last):
  3.   File "tuning.py", line 5, in <module>
  4.     import usb.core
  5. ImportError: No module named usb.core
  6. pi@raspberrypi:~/usb_4_mic_array $ sudo pip install pyusb
  7. Collecting pyusb
  8.   Downloading pyusb-1.0.2.tar.gz (54kB)
  9.     100% |████████████████████████████████| 61kB 101kB/s
  10. Building wheels for collected packages: pyusb
  11.   Running setup.py bdist_wheel for pyusb ... done
  12.   Stored in directory: /root/.cache/pip/wheels/8b/7f/fe/baf08bc0dac02ba17f3c9120f5dd1cf74aec4c54463bc85cf9
  13. Successfully built pyusb
  14. Installing collected packages: pyusb
  15. Successfully installed pyusb-1.0.2
  16. pi@raspberrypi:~/usb_4_mic_array $ sudo python tuning.py DOAANGLE
  17. DOAANGLE: 180
复制代码
Q3: 有没有树莓派的Alexa的样例?
A3: Yes, we can connect the mic array v2.0 to raspberry usb port and follow Raspberry Pi Quick Start Guide with Scriptto do the voice interaction with alexa.

Q4: Do you have the example for Mic array v2.0 with ROS system?
A4: Yes, thanks for Yuki sharing the package for integrating ReSpeaker Mic Array v2 with ROS (Robot Operating System) Middleware.

Q5: 能直接通过3.5mm耳机孔听到采样的声音吗?
A5 不行的。3.5mm耳机孔音源来自于上位机,但是如果用树莓派的话可以通过执行arecord -D plughw:1,0 -f cd |aplay -D plughw:1,0 -f cd 达到目的

资源下载
[产品简介] XVF3000-3100-product-brief_1.4.pdf (249.51 KB, 下载次数: 12)
[芯片数据手册] XVF3000-3100-TQ128-Datasheet_1.0.pdf (4.23 MB, 下载次数: 14)
产品简介 ReSpeaker MicArray v2.0 Product Brief.pdf (555.91 KB, 下载次数: 27)

分享到:
回复

使用道具 举报

回答|共 1 个

倒序浏览

沙发

sunnycandy

发表于 2020-4-23 09:42:14 | 只看该作者

您好,请问您有使用Respeaker Mic array v2.0开发板在windows上调用ODAS嘛,如您看到,请回复下,十分感谢
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /2 下一条