Request for Support to Implement USB Microphone Recording Using arecord

I noticed that you have implemented aplay but not arecord (which is part of the alsa-utils package). I want to record some audio from my microphone. Could you implement it, please? Thank you for the great work. Below is the output of lsusb -t. Thanks again!
i using CoreELEC (official): 21.1.1-Omega (Amlogic-ne.aarch64)
Machine model: Ugoos X4
CoreELEC dt-id: sc2_s905x4_ugoos_x4
Linux version: 5.4.210 (portisch@ubuntu) #1 Mon Aug 26 19:57:51 CEST 2024
Kodi compiled: 2024-08-26 16:23:54 +0000
CoreELECX4:~ # lsusb -t
/: Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci-hcd/2p, 480M
|__ Port 001: Dev 002, If 0, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 001: Dev 002, If 1, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 001: Dev 002, If 3, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 002: Dev 003, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 002: Dev 003, If 1, Class=Human Interface Device, Driver=usbhid, 12M
/: Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci-hcd/1p, 5000M
CoreELECX4:~ # lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 31b2:0011 DCMT Technology USB Condenser Microphone
Bus 001 Device 003: ID 17ef:6166 Lenovo LEGION M7
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

Will it work? If yes it should be easy I guess.

Yes, I hope you will deploy it directly on the host. I tried creating a container docker, adding --device usb, running a Debian Bookworm image, and installing alsa-utils, but arecord could not detect the recording device. Thank you for the excellent work!

Can you assist in guiding me to install arecord on CoreELEC to enable recording? Currently, I have no way to record using my microphone.

arecord is removed here

which means you need to adjust this package and build your own CE.

Or try this binary: 67.4 KB file on MEGA

Save it to downloads folder or someone else and set execute permission.

chmod 755 arecord
./arecord
1 Like

Guide for Recording Audio in a Docker Container with USB Microphone COREELEC.
This is my guide, I have successfully completed it and want to share it with everyone.

On the host:

docker run -it --privileged -v /dev/snd:/dev/snd debian:bookworm bash

Inside the container bash:

  1. Update and install alsa-utils:
    apt update && apt install -y alsa-utils

  2. Run alsamixer to check the soundcard (mute or gain state). In my case, the default volume was set to the lowest, so I had to adjust it. Without this adjustment, there would be no sound. After adjusting, list the devices with the command:
    arecord -L

    This will display your sound device (e.g., plughw:CARD=Microphone,DEV=0).

  3. To record from the USB condenser microphone (labeled as “Microphone”), use the following command:
    arecord -D plughw:CARD=Microphone,DEV=0 -f cd -t wav -d 10 test_audio.wav

    This command records for 10 seconds in CD quality (44.1kHz, 16-bit, stereo) and saves the audio file in WAV format.

  4. After recording, run ls to see the test_audio.wav file.

  5. To exit the container while keeping it running, press Ctrl + P, then Ctrl + Q.

  6. Use docker ps to find the container ID (e.g., e45ab62e37af).

  7. To copy the audio file from the container to the host machine, use:
    docker cp e45ab62e37af:/test_audio.wav /storage

    Replace “e45ab62e37af” with the actual container ID from the docker ps output.

  8. You will find the test_audio.wav file in the /storage directory on the host.

Thank you, and good luck!

1 Like

Thank you very much. The method works perfectly.

. Thank you for your work, I hope the next builds will have alsamixer, arecord integrated by default. Have a great day and excellent work.

The binary should be included since 20250103 in Amlogic-no.

1 Like

Thank you, it’s working.

1 Like