반응형
Respeaker
- 6채널 또는 1채널의 마이크 입력
- 소리가 발생하는 방향을 알 수 있음 (아래의 프로그램을 활용, resoultion : 1 degree)
Update Firmware
Firmware | Channels | Note |
1_channel_firmware.bin | 1 | processed audio for ASR |
6_channels_firmware.bin | 6 | channel 0 : processed audio for ASR, channel 1-4 : 4 microphones' raw data, channel 5: playback(factory firmware) |
$ sudo apt-get update
$ sudo apt-get install python-usb
$ sudo pip install pyusb click
$ 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
# if you want to use 1 channel,then the command should be like:
$ sudo python dfu.py --download 1_channel_firmware.bin
Tuning
$ git clone https://github.com/respeaker/usb_4_mic_array.git
$ cd usb_4_mic_array
$ python tuning.py -p
DOA (Direction of Arrival)
$ git clone https://github.com/respeaker/usb_4_mic_array.git
$ cd usb_4_mic_array
$ nano doa.py
Copy and Paste to doa.py
from tuning import Tuning
import usb.core
import usb.util
import time
dev = usb.core.find(idVendor=0x2886, idProduct=0x0018)
if dev:
Mic_tuning = Tuning(dev)
print Mic_tuning.direction
while True:
try:
print Mic_tuning.direction
time.sleep(1)
except KeyboardInterrupt:
break
$ sudo python doa.py
184
183
175
105
104
104
103
Extract Voice
$ sudo apt-get install portaudio19-dev python-pyaudio
$ sudo pip install pyaudio
$ cd usb_4_mic_array
$ gedit get_idx.py
import pyaudio
p = pyaudio.PyAudio()
info = p.get_host_api_info_by_index(0)
numdevices = info.get('deviceCount')
for i in range(0, numdevices):
if (p.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels')) > 0:
print "Input Device id ", i, " - ", p.get_device_info_by_host_api_device_index(0, i).get('name')
$ python get_idx.py
...
Input Device id 24 - ReSpeaker 4 Mic Array (UAC1.0): USB Audio (hw:2,0)
...
# index : 24
import pyaudio
import wave
RESPEAKER_RATE = 16000
RESPEAKER_CHANNELS = 6 # change base on firmwares, 1_channel_firmware.bin as 1 or 6_channels_firmware.bin as 6
RESPEAKER_WIDTH = 2
# run getDeviceInfo.py to get index
RESPEAKER_INDEX = 24 # refer to input device id
CHUNK = 1024
RECORD_SECONDS = 5
WAVE_OUTPUT_FILENAME = "output.wav"
p = pyaudio.PyAudio()
stream = p.open(
rate=RESPEAKER_RATE,
format=p.get_format_from_width(RESPEAKER_WIDTH),
channels=RESPEAKER_CHANNELS,
input=True,
input_device_index=RESPEAKER_INDEX,)
print("* recording")
frames = []
for i in range(0, int(RESPEAKER_RATE / CHUNK * RECORD_SECONDS)):
data = stream.read(CHUNK)
frames.append(data)
print("* done recording")
stream.stop_stream()
stream.close()
p.terminate()
wf = wave.open(WAVE_OUTPUT_FILENAME, 'wb')
wf.setnchannels(RESPEAKER_CHANNELS)
wf.setsampwidth(p.get_sample_size(p.get_format_from_width(RESPEAKER_WIDTH)))
wf.setframerate(RESPEAKER_RATE)
wf.writeframes(b''.join(frames))
wf.close()
https://wiki.seeedstudio.com/ReSpeaker-USB-Mic-Array/
ReSpeaker USB Mic Array - Seeed Wiki
edit ReSpeaker USB Mic Array An out-of-the-box voice pick-up device is the voice of the customer. During the past year, Respeaker Mic Array V2.0 has been sold out for more than 10K units in the format of the development board. Customers keep requesting a c
wiki.seeedstudio.com
반응형