ARECORD fails to work even after NVIDIA-recommended configuration updates

Hello,

I am using the Jetson TK1 with 3.10.40-grinch-21.3.4 running Ubuntu 14.04.5 LTS. I would like to record audio using the microphone jack, but there seems to be a configuration issue with the device. I have confirmed that ‘aplay’ successfully plays audio through the output jack, so this is not the nature of the issue.

I’ve update the configuration parameters as specified in the following link to no avail:
https://devtalk.nvidia.com/default/topic/772401/audio-input-on-jetson-tk1/?offset=4

Executing ‘arecord -d 5 -c 1 -v foobar.wav’ returns:

Recording WAVE 'foobar.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
Plug PCM: Rate conversion PCM (48000, sformat=U8)
Converter: libspeex (builtin)
Protocol version: 10002
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : U8
  subformat    : STD
  channels     : 1
  rate         : 8000
  exact rate   : 8000 (8000/1)
  msbits       : 8
  buffer_size  : 2730
  period_size  : 682
  period_time  : 85333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 682
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 2730
  silence_threshold: 0
  silence_size : 0
  boundary     : 178913280
Slave: Route conversion PCM (sformat=S8)
  Transformation table:
    0 <- 0*0.5 + 1*0.5
Its setup is:
  stream       : CAPTURE
  access       : MMAP_INTERLEAVED
  format       : U8
  subformat    : STD
  channels     : 1
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 8
  buffer_size  : 16384
  period_size  : 4096
  period_time  : 85333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 4096
  period_event : 0
  start_threshold  : 6
  stop_threshold   : 16384
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
Slave: Hardware PCM card 1 'tegra-rt5639' device 0 subdevice 0
Its setup is:
  stream       : CAPTURE
  access       : MMAP_INTERLEAVED
  format       : S8
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 8
  buffer_size  : 16384
  period_size  : 4096
  period_time  : 85333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 4096
  period_event : 0
  start_threshold  : 6
  stop_threshold   : 16384
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
  appl_ptr     : 0
  hw_ptr       : 0

The file is written, and size seems to correlate with capture duration, but the contents are as follows and, needless to say, ‘aplay foobar.wav’ does not produce sound on the connected speakers:

0000000: 5249 4646 e45d 0000 5741 5645 666d 7420  RIFF.]..WAVEfmt
0000010: 1000 0000 0100 0100 401f 0000 401f 0000  ........@...@...
0000020: 0100 0800 6461 7461 c05d 0000 8080 8080  ....data.]......
0000030: 8080 8080 8080 8080 8080 8080 8080 8080  ................
0000040: 8080 8080 8080 8080 8080 8080 8080 8080  ................
0000050: 8080 8080 8080 8080 8080 8080 8080 8080  ................

I’ve found no information on troubleshooting if the suggested configuration changes fail, so I’m not sure how to proceed.

In the past I’ve found some audio setup to be difficult on most every flavor of Linux there is. One trick is that I install the mumble chat client and set up the microphone to work with this…I don’t use mumble, but this leaves mixers in a working state in many cases.

Here are some notes when I set up both microphone and headphones in the past (sorry, it’s brief without much explanation):

SET AUDIO:
==========
amixer cset name="Stereo ADC MIXL ADC2 Switch" 0
amixer cset name="Stereo ADC MIXR ADC2 Switch" 0
amixer cset name="Int Mic Switch" 0
amixer cset name="ADC Capture Switch" 1
amixer cset name="RECMIXL BST1 Switch" 0
amixer cset name="RECMIXR BST1 Switch" 0
amixer cset name="RECMIXL BST2 Switch" 1
amixer cset name="RECMIXR BST2 Switch" 1
amixer cset name="Stereo ADC L1 Mux" "ADC"
amixer cset name="Stereo ADC R1 Mux" "ADC"
amixer cset name="Stereo ADC MIXL ADC1 Switch" 1
amixer cset name="Stereo ADC MIXR ADC1 Switch" 1
amixer cset name="Stereo ADC MIXL ADC2 Switch" 0
amixer cset name="Stereo ADC MIXR ADC2 Switch" 0
amixer cset name="IN1 Mode Control" "Single ended"
amixer cset name="IN2 Mode Control" "Single ended"
amixer cset name="Mic Jack Switch" 1


EXAMPLE:
arecord -t wav -c 1 -d 4 -v tmp.wav
aplay tmp.wav


DISPLAY AUDIO SETTINGS:
=======================
amixer cget name="Stereo ADC MIXL ADC2 Switch"
amixer cget name="Stereo ADC MIXR ADC2 Switch"
amixer cget name="Int Mic Switch"
amixer cget name="ADC Capture Switch"
amixer cget name="RECMIXL BST1 Switch"
amixer cget name="RECMIXR BST1 Switch"
amixer cget name="RECMIXL BST2 Switch"
amixer cget name="RECMIXR BST2 Switch"
amixer cget name="Stereo ADC L1 Mux"
amixer cget name="Stereo ADC R1 Mux"
amixer cget name="Stereo ADC MIXL AD1 Switch"
amixer cget name="Stereo ADC MIXR ADC1 Switch"
amixer cget name="Stereo ADC MIXL ADC2 Switch"
amixer cget name="Stereo ADC MIXR ADC2 Switch"
amixer cget name="IN1 Mode Control"
amixer cget name="IN2 Mode Control"
amixer cget name="Mic Jack Switch"

Thanks for the response. I’ve already attempted to update these parameters, with output given below, yet arecord continues to misbehave:

ubuntu@tegra-ubuntu:~$ amixer cset name="Mic Jack Switch" 1
numid=126,iface=MIXER,name='Mic Jack Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
ubuntu@tegra-ubuntu:~$ 
ubuntu@tegra-ubuntu:~$ clear all

ubuntu@tegra-ubuntu:~$ amixer cset name="Stereo ADC MIXL ADC2 Switch" 0
numid=97,iface=MIXER,name='Stereo ADC MIXL ADC2 Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
ubuntu@tegra-ubuntu:~$ amixer cset name="Stereo ADC MIXR ADC2 Switch" 0
numid=95,iface=MIXER,name='Stereo ADC MIXR ADC2 Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
ubuntu@tegra-ubuntu:~$ amixer cset name="Int Mic Switch" 0
numid=127,iface=MIXER,name='Int Mic Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
ubuntu@tegra-ubuntu:~$ amixer cset name="ADC Capture Switch" 1
numid=17,iface=MIXER,name='ADC Capture Switch'
  ; type=BOOLEAN,access=rw------,values=2
  : values=on,on
ubuntu@tegra-ubuntu:~$ amixer cset name="RECMIXL BST1 Switch" 0
numid=116,iface=MIXER,name='RECMIXL BST1 Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
ubuntu@tegra-ubuntu:~$ amixer cset name="RECMIXR BST1 Switch" 0
numid=110,iface=MIXER,name='RECMIXR BST1 Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
ubuntu@tegra-ubuntu:~$ amixer cset name="RECMIXL BST2 Switch" 1
numid=115,iface=MIXER,name='RECMIXL BST2 Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
ubuntu@tegra-ubuntu:~$ amixer cset name="RECMIXR BST2 Switch" 1
numid=109,iface=MIXER,name='RECMIXR BST2 Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
ubuntu@tegra-ubuntu:~$ amixer cset name="Stereo ADC L1 Mux" "ADC"
numid=103,iface=MIXER,name='Stereo ADC L1 Mux'
  ; type=ENUMERATED,access=rw------,values=1,items=2
  ; Item #0 'DIG MIX'
  ; Item #1 'ADC'
  : values=1
ubuntu@tegra-ubuntu:~$ amixer cset name="Stereo ADC R1 Mux" "ADC"
numid=102,iface=MIXER,name='Stereo ADC R1 Mux'
  ; type=ENUMERATED,access=rw------,values=1,items=2
  ; Item #0 'DIG MIX'
  ; Item #1 'ADC'
  : values=1
ubuntu@tegra-ubuntu:~$ amixer cset name="Stereo ADC MIXL ADC1 Switch" 1
numid=96,iface=MIXER,name='Stereo ADC MIXL ADC1 Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
ubuntu@tegra-ubuntu:~$ amixer cset name="Stereo ADC MIXR ADC1 Switch" 1
numid=94,iface=MIXER,name='Stereo ADC MIXR ADC1 Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
ubuntu@tegra-ubuntu:~$ amixer cset name="Stereo ADC MIXL ADC2 Switch" 0
numid=97,iface=MIXER,name='Stereo ADC MIXL ADC2 Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
ubuntu@tegra-ubuntu:~$ amixer cset name="Stereo ADC MIXR ADC2 Switch" 0
numid=95,iface=MIXER,name='Stereo ADC MIXR ADC2 Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
ubuntu@tegra-ubuntu:~$ amixer cset name="IN1 Mode Control" "Single ended"
numid=12,iface=MIXER,name='IN1 Mode Control'
  ; type=ENUMERATED,access=rw------,values=1,items=2
  ; Item #0 'Single ended'
  ; Item #1 'Differential'
  : values=0
ubuntu@tegra-ubuntu:~$ amixer cset name="IN2 Mode Control" "Single ended"
numid=14,iface=MIXER,name='IN2 Mode Control'
  ; type=ENUMERATED,access=rw------,values=1,items=2
  ; Item #0 'Single ended'
  ; Item #1 'Differential'
  : values=0
ubuntu@tegra-ubuntu:~$ amixer cset name="Mic Jack Switch" 1
numid=126,iface=MIXER,name='Mic Jack Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
ubuntu@tegra-ubuntu:~$

I’ve tried removing pulseaudio (which subsequently removes most of System Setting icons, which doesn’t really matter because the Sound settings are completely useless anyways), and changing card with alsamixer.

I tried installing mumble. During setting configuration, I’ve gone through the entire list of input devices, yet once at the input level selection window, the level bar is completely unresponsive to noise at the microphone. The only activity I saw on the level bar is a strange echoing which is completely unrelated to noise at the microphone, and this only occurred for 1 or 2 of the input device choices.

When staring up mumble I see:

buntu@tegra-ubuntu:~$ mumble
PulseAudio: Connection failure: Connection refused
G15LCDEngineUnix: Unable to connect to G15Daemon.
CELT bitstream 8000000b from /usr/lib/mumble/libcelt0.so.0.7.0
Locale is "C" (System: "C")
TextToSpeech: Failed to contact speech dispatcher.
Database SQLite: "3.8.2" 
Overlay: Removing old socket on "/home/ubuntu/.MumbleOverlayPipe" 
Overlay: Listening on "/home/ubuntu/.MumbleOverlayPipe" 
GlobalShortcutX: Unable to open any keyboard input devices under /dev/input, falling back to XInput
GlobalShortcutX: Using XI2 2.0
SocketRPC: Removing old socket on "/home/ubuntu/.MumbleSocket" 
AudioInput: 40000 bits/s, 48000 hz, 480 sample
ALSAAudioOutput: Initialized
ALSAAudioOutput: ALSA reports 10000 output channels. Clamping to 2.
ALSAAudioOutput: Actual buffer 48000 hz, 2 channel 2880 samples [480 per period]
ALSAAudioOutput: Initializing 2 channel, 48000 hz mixer
AudioOutput: Initialized 2 channel 48000 hz mixer
ALSAAudioInput: Initing audiocapture default.
ALSAAudioInput: Actual buffer 48000 hz, 1 channel 3840 samples [480 per period]
AudioInput: Initialized mixer for 1 channel 48000 hz mic and 0 channel 48000 hz echo
warning: The VAD has been replaced by a hack pending a complete rewrite

Although pulseaudio failed to start, ALSAAudio seems to work fine.

I am unsure of how to debug this, but I do suspect that audio issues can be related to X11 desktop environment settings. I say this because mixer and input/output devices are often tied to the specific user login settings (and migrate depending on session login status), plus I see this:

GlobalShortcutX: Unable to open any keyboard input devices under /dev/input, falling back to XInput

Are you logged in directly with GUI? What other audio hardware is connected? In particular does your monitor have speakers and what kind of cables are used with the monitor (for example, HDMI has audio, plus there might be a line in/out path with a simple audio cable in addition to this)?