Skip to content

Cannot record 6-channel audio on MAIX Bit + Sipeed Microphone Array #135

Description

@ikhwanuddin

Hi Developers,

I’m trying to build a Maix Bit + Sipeed Microphone Array and record audio from 6 channels to an SD card.

My wiring is exactly following tutorial from here http://www.yahboom.net/study/MicArray.

I’ve been trying to modify the record_wav.py, but I haven’t had any luck.

I’ve attached the code I tried to modify below. Can you help me out?

import image, lcd, time
import audio
from Maix import GPIO, I2S
from fpioa_manager import fm

# user setting
sample_rate   = 16000
record_time   = 4  #s
# default seting
sample_points = 2048
wav_ch        = 6

fm.register(8,  fm.fpioa.GPIO0, force=True)
wifi_en = GPIO(GPIO.GPIO0, GPIO.OUT)
wifi_en.value(0)

fm.register(23,fm.fpioa.I2S0_IN_D0, force=True)
fm.register(22,fm.fpioa.I2S0_IN_D1, force=True)
fm.register(21,fm.fpioa.I2S0_IN_D2, force=True)
fm.register(20,fm.fpioa.I2S0_IN_D3, force=True)
fm.register(19,fm.fpioa.I2S0_WS, force=True)    # 19 on Go Board and Bit(new version)
fm.register(18,fm.fpioa.I2S0_SCLK, force=True)  # 18 on Go Board and Bit(new version)

rx = I2S(I2S.DEVICE_0)
rx.channel_config(rx.CHANNEL_0, rx.RECEIVER, align_mode=I2S.STANDARD_MODE)

rx.set_sample_rate(sample_rate)
print(rx)

#import time
# init audio
recorder = audio.Audio(path="/sd/record.wav", is_create=True, samplerate=sample_rate)

queue = []

frame_cnt = record_time*sample_rate//sample_points

for i in range(frame_cnt):
    tmp = rx.record(sample_points*wav_ch)
    if len(queue) > 0:
        ret = recorder.record(queue[0])
        queue.pop(0)
    rx.wait_record()
    queue.append(tmp)
    print(str(i) + ":" + str(time.ticks()))

recorder.finish()

I’m trying my best to grasp the concepts of fm, fpioa, and I2S from the documentation, but I’m still a bit lost. Can you help me out?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions