matrix-io / matrix-creator-hal

Hardware Abstraction Layer for MATRIX Creator & MATRIX Voice
https://matrix-io.github.io/matrix-documentation/matrix-hal/overview/
GNU General Public License v3.0
70 stars 50 forks source link

"./micarray_recorder_direct" returns "can't open any device". #69

Open luc2yj opened 6 years ago

luc2yj commented 6 years ago

"./micarray_recorder_direct" returns "can't open any device"

How can I solve this?

kdpatino commented 6 years ago

Hello @luc2yj ,

It means that you are using the kernel modules but the regmap module has not been loaded.

could you run:

1- If you install the kernel modules with apt:

sudo apt remove --purge matrixio-kernel-modules
sudo apt update
sudo apt upgrade

sudo reboot

#After reboot
sudo apt update

2- If you compile the kernel modules:

sudo rm /boot/overlays/matrixio.dtbo
sudo rm /lib/modules/$(shell uname -r)/kernel/drivers/mfd/matrixio*.ko
sudo reboot

3- You need to install matrixio-creator-init

# Add repo and key
curl https://apt.matrix.one/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.matrix.one/raspbian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/matrixlabs.list

# Update packages and install
sudo apt update
sudo apt upgrade

sudo apt install matrixio-creator-init

sudo reboot

4- If you want use Microphone HAL examples, just a simple pull of the repo and compile again the examples and not install the kernel modules.

5- If you want to use ther kernel modules, you should record from alsa ultils. For example:

sudo apt update
sudo apt upgrade

sudo apt install matrixio-kernel-modules

sudo reboot

Record with:

$ sudo apt install sox
$ rec -r 96000 -c 8 96KHz.wav

Input File     : 'default' (alsa)
Channels       : 8
Sample Rate    : 96000
Precision      : 16-bit
Sample Encoding: 16-bit Signed Integer PCM

In:0.00% 00:00:06.83 [00:00:00.00] Out:654k  [      |-     ]        Clip:0    ^C
Aborted.

Let me know how it work now.

Best Regards,

Kevin Patino

luc2yj commented 6 years ago

Thanks for your help @kdpatino . After reinstalling the kernel module and modifying the .asound.rc I am now able to record at 96Khz. Have you succeeded to get 8 different wav files instead of one?

kdpatino commented 6 years ago

Hello @luc2yj : You could use: arecord -f S16_LE -r 96000 -c 8 -I -d 5 test but it generates raw files for each channel, then you need to format as wav file.

arecord -h
Usage: arecord [OPTION]... [FILE]...
......
-I, --separate-channels one file for each channel
-c, --channels=#        channels
-f, --format=FORMAT     sample format (case insensitive)
-d, --duration=#        interrupt after # seconds
....

Regards,

Kevin Patino