Audio (USB)

Audio over USB is supported on the phyCORE-AM65x 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.

Connect the Device

  • Plug the headset into the USB0 (X18) connector

    ../_images/pcm-67-audio-usb-callout.png
  • After the device is connected, you should see Linux console messages similar to the below:

    Expected Output
    root@am65xx-phycore-kit:~# [ 2112.471895] usb 1-1: new full-speed USB device number 2 using xhci-hcd
    [ 2112.845265] usb 1-1: New USB device found, idVendor=046d, idProduct=0a56
    [ 2112.851993] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [ 2112.859159] usb 1-1: Product: Logitech H570e Stereo
    [ 2112.864075] usb 1-1: Manufacturer: Logitech Inc
    [ 2112.868630] usb 1-1: SerialNumber: 00000000
    [ 2113.087212] input: Logitech Inc Logitech H570e Stereo as /devices/platform/soc0/4000000.dwc3/4010000.usb/xhci-hcd.0.auto/usb1/1-1/1-1:1.3/0003:046D:0A56.0001/input/input1
    [ 2113.160301] hid-generic 0003:046D:0A56.0001: input: USB HID v1.11 Device [Logitech Inc Logitech H570e Stereo] on usb-xhci-hcd.0.auto-1/input3
    [ 2113.173231] usbcore: registered new interface driver usbhid
    [ 2113.180432] usbhid: USB HID core driver
    [ 2113.236174] usb 1-1: Warning! Unlikely big volume range (=4125), cval->res is probably wrong.
    [ 2113.244735] usb 1-1: [11] FU [Sidetone Playback Volume] ch = 1, val = 0/4125/1
    [ 2113.255929] usbcore: registered new interface driver snd-usb-audio
    
  • 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@am65xx-phycore-kit:~# lsusb
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 003: 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.

  • In order to use this command an internet connection must first be established. Plug in the Ethernet cable, included with your kit, into ETH0 (X29) and connect it to an Ethernet Switch. Refer to Ethernet 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.

Target (Linux)
arecord -d 10 -f cd -t wav test.wav
  • To play the recorded audio, use the following command:

    Target (Linux)
    aplay test.wav
    

Adjusting Playback and Capture Settings

  • The alsamixer program can be used to change volume settings or mute the device.

    Target (Linux)
    alsamixer
    
  • A GUI interface will pop up. This can be navigated using arrow keys.

    ../_images/pcm-067-audio-usb-alsamixer.png

Tip

Click on the link for more information about alsamixer: https://linux.die.net/man/1/alsamixer