< >
Home » ROS与传感器教程 » ROS与传感器教程-麦克风阵列Respeaker

ROS与传感器教程-麦克风阵列Respeaker

说明:

  • 介绍如何使用麦克风阵列Respeaker

相关设备

步骤:

  • 安装audio-common和相关依赖库
sudo apt-get install ros-kinetic-audio-common
sudo apt-get install libasound2
sudo apt-get install mplayer
  • 创建catkin工作空间
mkdir -p ~/catkin_ws/src
cd ~catkin_ws/src
catkin_make
  • 将远程库中的代码克隆下来
cd ~/catkin_ws/src
git clone https://github.com/furushchev/respeaker_ros.git
  • 安装缺失的依赖项
cd ..
rosdep install --from-paths src -i -r -n -y
  • 编译
cd ~/catkin_ws
catkin_make
  • 对respeaker麦克风提供外部设备许可
roscd respeaker_ros
sudo cp -f $(rospack find respeaker_ros)/config/60-respeaker.rules /etc/udev/rules.d/60-respeaker.rules
sudo systemctl restart udev
  • 安装python包的依赖
roscd respeaker_ros
sudo pip install -r requirements.txt
  • 更新firmware以实现对底层设备的控制,从远程仓库中可以获取到相应的包
git clone https://github.com/respeaker/usb_4_mic_array.git
cd usb_4_mic_array
sudo python dfu.py --download 6_channels_firmware.bin  # The 6 channels version 
  • 运行sound_play节点
roslaunch sound_play soundplay_node.launch
  • 运行respeaker程序包。运行后,需要稍等一会
roslaunch respeaker_ros respeaker.launch

process[respeaker_node-1]: started with pid [11267]
process[static_transformer-2]: started with pid [11269]
process[speech_to_text-3]: started with pid [11282]
[INFO] [1623723687.040805]: Initializing Respeaker device
[INFO] [1623723761.165163]: Respeaker device initialized (Version: 16)
[INFO] [1623723762.641870]: Found 2: ReSpeaker 4 Mic Array (UAC1.0): USB Audio (hw:1,0) (channels: 6)
[INFO] [1623723762.642348]: Using channels [0, 1, 2, 3, 4, 5]
[INFO] [1623723770.416170]: Speech detected for 2.024 seconds
  • 查看话题
rostopic list

/audio
/audio/channel0
/audio/channel1
/audio/channel2
/audio/channel3
/audio/channel4
/audio/channel5
/diagnostics
/is_speeching
/respeaker_node/parameter_descriptions
/respeaker_node/parameter_updates
/robotsound
/rosout
/rosout_agg
/sound_direction
/sound_localization
/sound_play/cancel
/sound_play/feedback
/sound_play/goal
/sound_play/result
/sound_play/status
/speech_audio
/speech_to_text
/status_led
/tf
  • 通过发布在rostopic上的消息获得诸如声源位置角度等信息
rostopic echo /sound_location


data: 36
---
data: 37
---
data: 40
---
data: 39
---
data: 37
---
data: 40
---
data: 40


rostopic echo /sound_localization

header: 
  seq: 1
  stamp: 
    secs: 1634800677
    nsecs: 213996887
  frame_id: "respeaker_base"
pose: 
  position: 
    x: 0.0
   y: 0.0
    z: 0.0
  orientation: 
    x: 0.0
    y: 0.0
    z: 0.861629160442
    w: 0.507538362961
---

  • 控制LED
git clone https://github.com/respeaker/pixel_ring.git
cd pixel_ring
sudo python setup.py install
sudo python examples/usb_mic_array.py

  • 调音,配置一些内置算法的参数

  • 获取完整列表参数:

git clone https://github.com/respeaker/usb_4_mic_array.git
cd usb_4_mic_array
python tuning.py -p
  • 关闭自动增益控制 (AGC) :
python tuning.py AGCONOFF 0
  • 安装可视化的调音软件
sudo apt-get install pavucontrol

  • 提取语音,使用PyAudio python library通过USB提取语音

  • 录制语音

arecord -D plughw:1,0 -f cd test.wav   # record, please use the arecord -l to check the card and hardware first
  • 播放语音
aplay -D plughw:1,0 -f cd test.wav   # play, please use the aplay -l to check the card and hardware first
  • 录制语音 和 播放语音
arecord -D plughw:1,0 -f cd |aplay -D plughw:1,0 -f cd   # record and play at the same time

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: ros与传感器教程-麦克风阵列respeaker