Audio-USB
Audio over USB is supported on the phyCORE-i.MX7 development kit. This guide shows you how to connect and use a USB headset for audio and microphone support. For this guide, a Logitech H570e headset was used.
Step-by-Step Guide
Connect the Device
- Plug the headset into the USB2.0 (X9) connector
After the device is connected, you should see Linux console output similar to the below:
Expected Output
root@imx7d-phyboard-zeta-004:~# usb 1-1: new full-speed USB device number 6 using ci_hdrc
usb 1-1: Warning! Unlikely big volume range (=4125), cval->res is probably wrong.
usb 1-1: [11] FU [Sidetone Playback Volume] ch = 1, val = 0/4125/1
input: Logitech Inc Logitech H570e Stereo as /devices/soc0/soc/30800000.aips-bus/30b10000.usb/ci_hdrc.0/usb1/1-1/1-1:1.3/0003:046D:0A56.0005/input/input6
hid-generic 0003:046D:0A56.0005: input: USB HID v1.11 Device [Logitech Inc Logictech H570e Stereo] on usb-ci_hdrc.0-1/input3
- You can also make sure the device is connected by using the lsusb command:
Target (Linux)
lsusb
You will see the logitech headset in the output:
Expected Output
root@imx7d-phyboard-zeta-004:~# lsusb
Bus 001 Device 006: ID 046d:0a56 Logitech, Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Playing Audio
You can play audio from the command line using aplay. The below example shows you how to pull a wav file from the internet and start playing it.
The following command will only work if your phyCORE-i.MX7 Development Kit is already connected to the internet. See the Ethernet Peripheral Guide first for more information.
Target (Linux)
wget http://www.music.helsinki.fi/tmt/opetus/uusmedia/esim/a2002011001-e02.wav
aplay a2002011001-e02.wav
Capturing Sound
You can use arecord to record audio using the microphone on the headset. The following command will record audio from the microphone for 10 seconds and save it to testrecord.wav.
Target (Linux)
arecord -d 10 -f cd -t wav testrecord.wav
Use the following to play the file you just recorded:
Target (Linux)
aplay testrecord.wav
Adjusting Playback and Capture Settings
The alsamixer program can be used to change volume settings or mute the device. (This command will only work after a compatible audio device is connected).
Target (Linux)
alsamixer
A GUI interface will pop up. This can be navigated using arrow keys.
Click on the link for more information about alsamixer: https://linux.die.net/man/1/alsamixer