When using aplay agx reports underrun

hi,
I want to mix 3 audio streams with agx’s codec driver Mixer.
When I use aplay -D hw:1,0 input0.wav and aplay -D hw:1,1 input1.wav, agx works good,
but the command aplay -D hw:1,2 input2.wav, reports

user@AGX:~/forscp$ aplay -D hw:1,2 input2.wav
Playing WAVE 'input2.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
underrun!!! (at least 0.054 ms long)
underrun!!! (at least 10.059 ms long)
underrun!!! (at least 0.216 ms long)
underrun!!! (at least 8.071 ms long)
underrun!!! (at least 3.447 ms long)
underrun!!! (at least 0.925 ms long)
underrun!!! (at least 1.266 ms long)
underrun!!! (at least 10.878 ms long)
underrun!!! (at least 4.449 ms long)
underrun!!! (at least 0.802 ms long)

What is the problem?

Thanks
Jiaheng

Hello!

How have you configured the amixer controls for the mixer?

What is hw:1,2 routed to? In other words, what does the following show …

amixer -c 1 sget "ADMAIF3"

There is an example here that shows how to mix two streams, to mix a third you also need to route ADMAIF3 to ‘MIXER1-2 Mux’ and enable the Adder …

amixer -c 1 cset name="MIXER1-3 Mux" ADMAIF3
amixer -c 1 cset name="Adder1 RX3" 1

Regards,
Jon

hi,
I have read the document and successfully mixed 2 audio stream with that configuration,
but I use your cmd and have these report:

user@AGX:~$ amixer -c 1 sget "ADMAIF3"
amixer: Unable to find simple control 'ADMAIF3',0

user@AGX:~$ amixer -c 1 sget "ADMAIF2"
amixer: Unable to find simple control 'ADMAIF2',0

user@AGX:~$ amixer -c 1 sget "ADMAIF1"
amixer: Unable to find simple control 'ADMAIF1',0

And my command to mix 3 audio stream is:

amixer -c1 cset name="MIXER1-1 Mux" ADMAIF1
amixer -c1 cset name="MIXER1-2 Mux" ADMAIF2
amixer -c1 cset name="MIXER1-3 Mux" ADMAIF3

amixer -c1 cset name="Adder1 RX1" 1
amixer -c1 cset name="Adder1 RX2" 1
amixer -c1 cset name="Adder1 RX3" 1

amixer -c1 cset name="Mixer Enable" 1
amixer -c1 cset name="ADMAIF4 Mux" MIXER1-1

aplay -D hw:1,0 inputfile1.wav
aplay -D hw:1,1 inputfile2.wav
aplay -D hw:1,2 inputfile3.wav

arecord -D hw:1,3 -r 48000 -c 2 -f S16_LE out.wav

The underrun happens at when I try aplay -D hw:1,2 inputfile3.wav ,
Is there any error with my above command?

Hello!

Sorry yes that is not correct, what we want in this case is …

amixer -c 1 sget "Mixer1-3 Mux"

We need this to point to ADMAIF3.

Can you try …

echo 0 | sudo tee /sys/kernel/debug/tracing/trace
echo 0 | sudo tee /sys/kernel/debug/tracing/events/enable
echo 1 | sudo tee /sys/kernel/debug/tracing/tracing_on
aplay -D hw:1,0 inputfile1.wav
aplay -D hw:1,1 inputfile2.wav
aplay -D hw:1,2 inputfile3.wav
echo 1 | sudo tee /sys/kernel/debug/tracing/events/asoc/snd_soc_dapm_widget_power/enable

Regards,
Jon

hi Jon,
I just try amixer -c 1 sget "MIXER1-3 Mux"

user@AGX:~$ amixer -c 1 sget "MIXER1-3 Mux"
Simple mixer control 'MIXER1-3 Mux',0
  Capabilities: enum
  Items: 'None' 'ADMAIF1' 'ADMAIF2' 'ADMAIF3' 'ADMAIF4' 'ADMAIF5' 'ADMAIF6' 'ADMAIF7' 'ADMAIF8' 'ADMAIF9' 'ADMAIF10' 'ADMAIF11' 'ADMAIF12' 'ADMAIF13' 'ADMAIF14' 'ADMAIF15' 'ADMAIF16' 'I2S1' 'I2S2' 'I2S3' 'I2S4' 'I2S5' 'I2S6' 'SFC1' 'SFC2' 'SFC3' 'SFC4' 'MIXER1-1' 'MIXER1-2' 'MIXER1-3' 'MIXER1-4' 'MIXER1-5' 'AMX1' 'AMX2' 'AMX3' 'AMX4' 'ARAD1' 'AFC1' 'AFC2' 'AFC3' 'AFC4' 'AFC5' 'AFC6' 'OPE1' 'SPKPROT1' 'MVC1' 'MVC2' 'IQC1-1' 'IQC1-2' 'IQC2-1' 'IQC2-2' 'DMIC1' 'DMIC2' 'DMIC3' 'DMIC4' 'ADX1-1' 'ADX1-2' 'ADX1-3' 'ADX1-4' 'ADX2-1' 'ADX2-2' 'ADX2-3' 'ADX2-4' 'ADX3-1' 'ADX3-2' 'ADX3-3' 'ADX3-4' 'ADX4-1' 'ADX4-2' 'ADX4-3' 'ADX4-4' 'ADMAIF17' 'ADMAIF18' 'ADMAIF19' 'ADMAIF20' 'ASRC1-1' 'ASRC1-2' 'ASRC1-3' 'ASRC1-4' 'ASRC1-5' 'ASRC1-6'
  Item0: 'ADMAIF3'

And when I use
echo 0 | sudo tee /sys/kernel/debug/tracing/trace
echo 0 | sudo tee /sys/kernel/debug/tracing/events/enable
echo 1 | sudo tee /sys/kernel/debug/tracing/tracing_on
aplay -D hw:1,0 inputfile1.wav
aplay -D hw:1,1 inputfile2.wav
aplay -D hw:1,2 inputfile3.wav
echo 1 | sudo tee /sys/kernel/debug/tracing/events/asoc/snd_soc_dapm_widget_power/enable

agx report below msg at command aplay -D hw:1,2 ./forscp/jj.wav

user@AGX:~$ aplay -D hw:1,2 ./forscp/jj.wav
Playing WAVE './forscp/jj.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
underrun!!! (at least 11.422 ms long)
underrun!!! (at least 3.601 ms long)
underrun!!! (at least 10.901 ms long)
underrun!!! (at least 3.526 ms long)
underrun!!! (at least 0.523 ms long)
underrun!!! (at least 11.257 ms long)
underrun!!! (at least 0.969 ms long)
underrun!!! (at least 12.418 ms long)
underrun!!! (at least 7.996 ms long)
underrun!!! (at least 0.063 ms long)
underrun!!! (at least 0.676 ms long)

Thanks
Jiaheng

Hello!

Sorry I missed the final instruction. Please share the output from …

echo 0 | sudo tee /sys/kernel/debug/tracing/trace
echo 0 | sudo tee /sys/kernel/debug/tracing/events/enable
echo 1 | sudo tee /sys/kernel/debug/tracing/tracing_on
aplay -D hw:1,0 inputfile1.wav
aplay -D hw:1,1 inputfile2.wav
aplay -D hw:1,2 inputfile3.wav
echo 1 | sudo tee /sys/kernel/debug/tracing/events/asoc/snd_soc_dapm_widget_power/enable
sudo cat /sys/kernel/debug/tracing/trace

Regards,
Jon

hi jon,
I have tried your instructions and once I try the third aplay command,(aplay -D hw:1,2 inputfile3.wav), agx just report,

user@AGX:~/forscp$ aplay -D hw:1,2 ouyang.wav 
Playing WAVE 'ouyang.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
underrun!!! (at least 2.265 ms long)
underrun!!! (at least 2.260 ms long)
underrun!!! (at least 0.921 ms long)
underrun!!! (at least 2.943 ms long)
underrun!!! (at least 0.038 ms long)
underrun!!! (at least 0.893 ms long)
underrun!!! (at least 17.443 ms long)
underrun!!! (at least 3.879 ms long)
underrun!!! (at least 5.023 ms long)
underrun!!! (at least 2.563 ms long)
underrun!!! (at least 0.292 ms long)
underrun!!! (at least 0.203 ms long)
underrun!!! (at least 1.101 ms long)
underrun!!! (at least 6.185 ms long)
user@AGX:~/forscp$ 

Then the final cat command shows nothing but,

user@AGX:~/forscp$ sudo cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 0/0   #P:4
#
#                              _-----=> irqs-off
#                             / _----=> need-resched
#                            | / _---=> hardirq/softirq
#                            || / _--=> preempt-depth
#                            ||| /     delay
#           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |       |   ||||       |         |
user@AGX:~/forscp$ 

If I do not use the third aplay (just use aplay -D hw:1,0 inputfile1.wav and aplay -D hw:1,1 inputfile2.wav)
And the final cat command shows,

user@AGX:~/forscp$ sudo cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 246/246   #P:4
#
#                              _-----=> irqs-off
#                             / _----=> need-resched
#                            | / _---=> hardirq/softirq
#                            || / _--=> preempt-depth
#                            ||| /     delay
#           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |       |   ||||       |         |
           aplay-20772 [003] .... 486044.146053: snd_soc_dapm_widget_power: widget=Playback 1 val=0
           aplay-20772 [003] .... 486044.146066: snd_soc_dapm_widget_power: widget=ADMAIF1 Receive val=0
           aplay-20772 [003] .... 486044.146069: snd_soc_dapm_widget_power: widget=ADMAIF1 RX val=0
           aplay-20772 [003] .... 486044.146079: snd_soc_dapm_widget_power: widget=I2S1 Mux val=0
           aplay-20772 [003] .... 486044.146082: snd_soc_dapm_widget_power: widget=I2S1 TX val=0
           aplay-20772 [003] .... 486044.146083: snd_soc_dapm_widget_power: widget=I2S1 Transmit val=0
           aplay-20772 [003] .... 486044.146085: snd_soc_dapm_widget_power: widget=I2S1 Transmit-I2S1 CIF Receive val=0
           aplay-20772 [003] .... 486044.146087: snd_soc_dapm_widget_power: widget=I2S1 CIF Receive val=0
           aplay-20772 [003] .... 486044.146089: snd_soc_dapm_widget_power: widget=I2S1 CIF RX val=0
           aplay-20772 [003] .... 486044.146091: snd_soc_dapm_widget_power: widget=I2S1 DAP TX val=0
           aplay-20772 [003] .... 486044.146093: snd_soc_dapm_widget_power: widget=I2S1 DAP Transmit val=0
           aplay-20772 [003] .... 486044.146095: snd_soc_dapm_widget_power: widget=I2S1 DAP Transmit-x AIF1 Playback val=0
           aplay-20772 [003] .... 486044.146097: snd_soc_dapm_widget_power: widget=x AIF1 Playback val=0
           aplay-20772 [003] .... 486044.146099: snd_soc_dapm_widget_power: widget=x AIF1RX val=0
           aplay-20772 [003] .... 486044.146102: snd_soc_dapm_widget_power: widget=x IF1 DAC1 val=0
           aplay-20772 [003] .... 486044.146118: snd_soc_dapm_widget_power: widget=x I2S1 val=0
           aplay-20772 [003] .... 486044.146121: snd_soc_dapm_widget_power: widget=x IF1 DAC1 R val=0
           aplay-20772 [003] .... 486044.146122: snd_soc_dapm_widget_power: widget=x IF1 DAC1 L val=0
           aplay-20772 [003] .... 486044.146124: snd_soc_dapm_widget_power: widget=x I2S1 ASRC val=0
           aplay-20772 [003] .... 486044.146126: snd_soc_dapm_widget_power: widget=x DAC R1 Mux val=0
           aplay-20772 [003] .... 486044.146128: snd_soc_dapm_widget_power: widget=x DAC L1 Mux val=0
           aplay-20772 [003] .... 486044.146130: snd_soc_dapm_widget_power: widget=x DAC Stereo1 Filter val=0
           aplay-20772 [003] .... 486044.146133: snd_soc_dapm_widget_power: widget=x DAC1 MIXR val=0
           aplay-20772 [003] .... 486044.146135: snd_soc_dapm_widget_power: widget=x DAC1 MIXL val=0
           aplay-20772 [003] .... 486044.146137: snd_soc_dapm_widget_power: widget=x Stereo DAC MIXR val=0
           aplay-20772 [003] .... 486044.146140: snd_soc_dapm_widget_power: widget=x Stereo DAC MIXL val=0
           aplay-20772 [003] .... 486044.146142: snd_soc_dapm_widget_power: widget=x DAC R2 Source val=0
           aplay-20772 [003] .... 486044.146145: snd_soc_dapm_widget_power: widget=x DAC R1 Source val=0
           aplay-20772 [003] .... 486044.146147: snd_soc_dapm_widget_power: widget=x DAC L2 Source val=0
           aplay-20772 [003] .... 486044.146150: snd_soc_dapm_widget_power: widget=x DAC L1 Source val=0
           aplay-20772 [003] .... 486044.146152: snd_soc_dapm_widget_power: widget=x DAC R2 Power val=0
           aplay-20772 [003] .... 486044.146154: snd_soc_dapm_widget_power: widget=x DAC R2 val=0
           aplay-20772 [003] .... 486044.146157: snd_soc_dapm_widget_power: widget=x DAC R1 Power val=0
           aplay-20772 [003] .... 486044.146159: snd_soc_dapm_widget_power: widget=x DAC R1 val=0
           aplay-20772 [003] .... 486044.146161: snd_soc_dapm_widget_power: widget=x DAC L2 Power val=0
           aplay-20772 [003] .... 486044.146162: snd_soc_dapm_widget_power: widget=x DAC L2 val=0
           aplay-20772 [003] .... 486044.146165: snd_soc_dapm_widget_power: widget=x DAC L1 Power val=0
           aplay-20772 [003] .... 486044.146167: snd_soc_dapm_widget_power: widget=x DAC L1 val=0
           aplay-20772 [003] .... 486044.146169: snd_soc_dapm_widget_power: widget=x SPK MIXR val=0
           aplay-20772 [003] .... 486044.146171: snd_soc_dapm_widget_power: widget=x HP Amp val=0
           aplay-20772 [003] .... 486044.146174: snd_soc_dapm_widget_power: widget=x SPK MIXL val=0
           aplay-20772 [003] .... 486044.146176: snd_soc_dapm_widget_power: widget=x SPKVOL R val=0
           aplay-20772 [003] .... 486044.146180: snd_soc_dapm_widget_power: widget=x SYS CLK DET val=0
           aplay-20772 [003] .... 486044.146184: snd_soc_dapm_widget_power: widget=x Charge Pump val=0
           aplay-20772 [003] .... 486044.146186: snd_soc_dapm_widget_power: widget=x HPO R Playback val=0
           aplay-20772 [003] .... 486044.146188: snd_soc_dapm_widget_power: widget=x HPO L Playback val=0
           aplay-20772 [003] .... 486044.146190: snd_soc_dapm_widget_power: widget=x SPKVOL L val=0
           aplay-20772 [003] .... 486044.146192: snd_soc_dapm_widget_power: widget=x SPO R MIX val=0
           aplay-20772 [003] .... 486044.146194: snd_soc_dapm_widget_power: widget=x CLKDET val=0
           aplay-20772 [003] .... 486044.146197: snd_soc_dapm_widget_power: widget=x Headphone Jack val=0
           aplay-20772 [003] .... 486044.146198: snd_soc_dapm_widget_power: widget=x SPO L MIX val=0
           aplay-20772 [003] .... 486044.146200: snd_soc_dapm_widget_power: widget=x SPK Amp val=0
           aplay-20772 [003] .... 486044.146202: snd_soc_dapm_widget_power: widget=x SPO Playback val=0
           aplay-20772 [003] .... 486044.146204: snd_soc_dapm_widget_power: widget=x Int Spk val=0
           aplay-20775 [002] .... 486044.865226: snd_soc_dapm_widget_power: widget=Playback 2 val=0
           aplay-20775 [002] .... 486044.865237: snd_soc_dapm_widget_power: widget=ADMAIF2 Receive val=0
           aplay-20775 [002] .... 486044.865240: snd_soc_dapm_widget_power: widget=ADMAIF2 RX val=0
           aplay-20775 [002] .... 486044.865306: snd_soc_dapm_widget_power: widget=I2S2 Mux val=0
           aplay-20775 [002] .... 486044.865308: snd_soc_dapm_widget_power: widget=I2S2 TX val=0
           aplay-20775 [002] .... 486044.865310: snd_soc_dapm_widget_power: widget=I2S2 Transmit val=0
           aplay-20775 [002] .... 486044.865311: snd_soc_dapm_widget_power: widget=I2S2 Transmit-I2S2 CIF Receive val=0
           aplay-20775 [002] .... 486044.865313: snd_soc_dapm_widget_power: widget=I2S2 CIF Receive val=0
           aplay-20775 [002] .... 486044.865314: snd_soc_dapm_widget_power: widget=I2S2 CIF RX val=0
           aplay-20775 [002] .... 486044.865316: snd_soc_dapm_widget_power: widget=I2S2 DAP TX val=0
           aplay-20775 [002] .... 486044.865318: snd_soc_dapm_widget_power: widget=I2S2 DAP Transmit val=0
           aplay-20775 [002] .... 486044.865319: snd_soc_dapm_widget_power: widget=I2S2 DAP Transmit-y Playback val=0
           aplay-20775 [002] .... 486044.865321: snd_soc_dapm_widget_power: widget=y Playback val=0
           aplay-20775 [002] .... 486044.865323: snd_soc_dapm_widget_power: widget=y OUT val=0
           aplay-20775 [002] .... 486044.865324: snd_soc_dapm_widget_power: widget=y Headphone val=0
           aplay-20861 [000] .... 486048.126976: snd_soc_dapm_widget_power: widget=Playback 1 val=1
           aplay-20861 [000] .... 486048.126983: snd_soc_dapm_widget_power: widget=ADMAIF1 Receive val=1
           aplay-20861 [000] .... 486048.126985: snd_soc_dapm_widget_power: widget=ADMAIF1 RX val=1
           aplay-20861 [000] .... 486048.126993: snd_soc_dapm_widget_power: widget=I2S1 Mux val=1
           aplay-20861 [000] .... 486048.126994: snd_soc_dapm_widget_power: widget=I2S1 TX val=1
           aplay-20861 [000] .... 486048.126995: snd_soc_dapm_widget_power: widget=I2S1 Transmit val=1
           aplay-20861 [000] .... 486048.126996: snd_soc_dapm_widget_power: widget=I2S1 Transmit-I2S1 CIF Receive val=1
           aplay-20861 [000] .... 486048.126997: snd_soc_dapm_widget_power: widget=I2S1 CIF Receive val=1
           aplay-20861 [000] .... 486048.126999: snd_soc_dapm_widget_power: widget=I2S1 CIF RX val=1
           aplay-20861 [000] .... 486048.127000: snd_soc_dapm_widget_power: widget=I2S1 DAP TX val=1
           aplay-20861 [000] .... 486048.127001: snd_soc_dapm_widget_power: widget=I2S1 DAP Transmit val=1
           aplay-20861 [000] .... 486048.127002: snd_soc_dapm_widget_power: widget=I2S1 DAP Transmit-x AIF1 Playback val=1
           aplay-20861 [000] .... 486048.127003: snd_soc_dapm_widget_power: widget=x AIF1 Playback val=1
           aplay-20861 [000] .... 486048.127004: snd_soc_dapm_widget_power: widget=x AIF1RX val=1
           aplay-20861 [000] .... 486048.127006: snd_soc_dapm_widget_power: widget=x IF1 DAC1 val=1
           aplay-20861 [000] .... 486048.127007: snd_soc_dapm_widget_power: widget=x I2S1 val=1
           aplay-20861 [000] .... 486048.127010: snd_soc_dapm_widget_power: widget=x IF1 DAC1 R val=1
           aplay-20861 [000] .... 486048.127011: snd_soc_dapm_widget_power: widget=x IF1 DAC1 L val=1
           aplay-20861 [000] .... 486048.127012: snd_soc_dapm_widget_power: widget=x I2S1 ASRC val=1
           aplay-20861 [000] .... 486048.127013: snd_soc_dapm_widget_power: widget=x DAC R1 Mux val=1
           aplay-20861 [000] .... 486048.127015: snd_soc_dapm_widget_power: widget=x DAC L1 Mux val=1
           aplay-20861 [000] .... 486048.127016: snd_soc_dapm_widget_power: widget=x DAC Stereo1 Filter val=1
           aplay-20861 [000] .... 486048.127018: snd_soc_dapm_widget_power: widget=x DAC1 MIXR val=1
           aplay-20861 [000] .... 486048.127019: snd_soc_dapm_widget_power: widget=x DAC1 MIXL val=1
           aplay-20861 [000] .... 486048.127030: snd_soc_dapm_widget_power: widget=x Stereo DAC MIXR val=1
           aplay-20861 [000] .... 486048.127032: snd_soc_dapm_widget_power: widget=x Stereo DAC MIXL val=1
           aplay-20861 [000] .... 486048.127034: snd_soc_dapm_widget_power: widget=x DAC R2 Source val=1
           aplay-20861 [000] .... 486048.127035: snd_soc_dapm_widget_power: widget=x DAC R1 Source val=1
           aplay-20861 [000] .... 486048.127037: snd_soc_dapm_widget_power: widget=x DAC L2 Source val=1
           aplay-20861 [000] .... 486048.127038: snd_soc_dapm_widget_power: widget=x DAC L1 Source val=1
           aplay-20861 [000] .... 486048.127040: snd_soc_dapm_widget_power: widget=x DAC R2 Power val=1
           aplay-20861 [000] .... 486048.127041: snd_soc_dapm_widget_power: widget=x DAC R2 val=1
           aplay-20861 [000] .... 486048.127043: snd_soc_dapm_widget_power: widget=x DAC R1 Power val=1
           aplay-20861 [000] .... 486048.127044: snd_soc_dapm_widget_power: widget=x DAC R1 val=1
           aplay-20861 [000] .... 486048.127045: snd_soc_dapm_widget_power: widget=x DAC L2 Power val=1
           aplay-20861 [000] .... 486048.127046: snd_soc_dapm_widget_power: widget=x DAC L2 val=1
           aplay-20861 [000] .... 486048.127047: snd_soc_dapm_widget_power: widget=x DAC L1 Power val=1
           aplay-20861 [000] .... 486048.127048: snd_soc_dapm_widget_power: widget=x DAC L1 val=1
           aplay-20861 [000] .... 486048.127050: snd_soc_dapm_widget_power: widget=x SPK MIXR val=1
           aplay-20861 [000] .... 486048.127051: snd_soc_dapm_widget_power: widget=x HP Amp val=1
           aplay-20861 [000] .... 486048.127053: snd_soc_dapm_widget_power: widget=x SPK MIXL val=1
           aplay-20861 [000] .... 486048.127054: snd_soc_dapm_widget_power: widget=x SPKVOL R val=1
           aplay-20861 [000] .... 486048.127056: snd_soc_dapm_widget_power: widget=x SYS CLK DET val=1
           aplay-20861 [000] .... 486048.127057: snd_soc_dapm_widget_power: widget=x Charge Pump val=1
           aplay-20861 [000] .... 486048.127059: snd_soc_dapm_widget_power: widget=x HPO R Playback val=1
           aplay-20861 [000] .... 486048.127060: snd_soc_dapm_widget_power: widget=x HPO L Playback val=1
           aplay-20861 [000] .... 486048.127061: snd_soc_dapm_widget_power: widget=x SPKVOL L val=1
           aplay-20861 [000] .... 486048.127063: snd_soc_dapm_widget_power: widget=x SPO R MIX val=1
           aplay-20861 [000] .... 486048.127064: snd_soc_dapm_widget_power: widget=x CLKDET val=1
           aplay-20861 [000] .... 486048.127065: snd_soc_dapm_widget_power: widget=x Headphone Jack val=1
           aplay-20861 [000] .... 486048.127067: snd_soc_dapm_widget_power: widget=x SPO L MIX val=1
           aplay-20861 [000] .... 486048.127068: snd_soc_dapm_widget_power: widget=x SPK Amp val=1
           aplay-20861 [000] .... 486048.127070: snd_soc_dapm_widget_power: widget=x SPO Playback val=1
           aplay-20861 [000] .... 486048.127071: snd_soc_dapm_widget_power: widget=x Int Spk val=1
           aplay-20861 [001] .... 486056.331908: snd_soc_dapm_widget_power: widget=Playback 1 val=0
           aplay-20861 [001] .... 486056.331920: snd_soc_dapm_widget_power: widget=ADMAIF1 Receive val=0
           aplay-20861 [001] .... 486056.331923: snd_soc_dapm_widget_power: widget=ADMAIF1 RX val=0
           aplay-20861 [001] .... 486056.331933: snd_soc_dapm_widget_power: widget=I2S1 Mux val=0
           aplay-20861 [001] .... 486056.331936: snd_soc_dapm_widget_power: widget=I2S1 TX val=0
           aplay-20861 [001] .... 486056.331938: snd_soc_dapm_widget_power: widget=I2S1 Transmit val=0
           aplay-20861 [001] .... 486056.331940: snd_soc_dapm_widget_power: widget=I2S1 Transmit-I2S1 CIF Receive val=0
           aplay-20861 [001] .... 486056.331942: snd_soc_dapm_widget_power: widget=I2S1 CIF Receive val=0
           aplay-20861 [001] .... 486056.331945: snd_soc_dapm_widget_power: widget=I2S1 CIF RX val=0
           aplay-20861 [001] .... 486056.331947: snd_soc_dapm_widget_power: widget=I2S1 DAP TX val=0
           aplay-20861 [001] .... 486056.331949: snd_soc_dapm_widget_power: widget=I2S1 DAP Transmit val=0
           aplay-20861 [001] .... 486056.331951: snd_soc_dapm_widget_power: widget=I2S1 DAP Transmit-x AIF1 Playback val=0
           aplay-20861 [001] .... 486056.331953: snd_soc_dapm_widget_power: widget=x AIF1 Playback val=0
           aplay-20861 [001] .... 486056.331956: snd_soc_dapm_widget_power: widget=x AIF1RX val=0
           aplay-20861 [001] .... 486056.331958: snd_soc_dapm_widget_power: widget=x IF1 DAC1 val=0
           aplay-20861 [001] .... 486056.331975: snd_soc_dapm_widget_power: widget=x I2S1 val=0
           aplay-20861 [001] .... 486056.331977: snd_soc_dapm_widget_power: widget=x IF1 DAC1 R val=0
           aplay-20861 [001] .... 486056.331980: snd_soc_dapm_widget_power: widget=x IF1 DAC1 L val=0
           aplay-20861 [001] .... 486056.331982: snd_soc_dapm_widget_power: widget=x I2S1 ASRC val=0
           aplay-20861 [001] .... 486056.331984: snd_soc_dapm_widget_power: widget=x DAC R1 Mux val=0
           aplay-20861 [001] .... 486056.331986: snd_soc_dapm_widget_power: widget=x DAC L1 Mux val=0
           aplay-20861 [001] .... 486056.331988: snd_soc_dapm_widget_power: widget=x DAC Stereo1 Filter val=0
           aplay-20861 [001] .... 486056.331991: snd_soc_dapm_widget_power: widget=x DAC1 MIXR val=0
           aplay-20861 [001] .... 486056.331993: snd_soc_dapm_widget_power: widget=x DAC1 MIXL val=0
           aplay-20861 [001] .... 486056.331996: snd_soc_dapm_widget_power: widget=x Stereo DAC MIXR val=0
           aplay-20861 [001] .... 486056.331999: snd_soc_dapm_widget_power: widget=x Stereo DAC MIXL val=0
           aplay-20861 [001] .... 486056.332001: snd_soc_dapm_widget_power: widget=x DAC R2 Source val=0
           aplay-20861 [001] .... 486056.332004: snd_soc_dapm_widget_power: widget=x DAC R1 Source val=0
           aplay-20861 [001] .... 486056.332006: snd_soc_dapm_widget_power: widget=x DAC L2 Source val=0
           aplay-20861 [001] .... 486056.332008: snd_soc_dapm_widget_power: widget=x DAC L1 Source val=0
           aplay-20861 [001] .... 486056.332011: snd_soc_dapm_widget_power: widget=x DAC R2 Power val=0
           aplay-20861 [001] .... 486056.332013: snd_soc_dapm_widget_power: widget=x DAC R2 val=0
           aplay-20861 [001] .... 486056.332016: snd_soc_dapm_widget_power: widget=x DAC R1 Power val=0
           aplay-20861 [001] .... 486056.332018: snd_soc_dapm_widget_power: widget=x DAC R1 val=0
           aplay-20861 [001] .... 486056.332020: snd_soc_dapm_widget_power: widget=x DAC L2 Power val=0
           aplay-20861 [001] .... 486056.332022: snd_soc_dapm_widget_power: widget=x DAC L2 val=0
           aplay-20861 [001] .... 486056.332024: snd_soc_dapm_widget_power: widget=x DAC L1 Power val=0
           aplay-20861 [001] .... 486056.332027: snd_soc_dapm_widget_power: widget=x DAC L1 val=0
           aplay-20861 [001] .... 486056.332029: snd_soc_dapm_widget_power: widget=x SPK MIXR val=0
           aplay-20861 [001] .... 486056.332032: snd_soc_dapm_widget_power: widget=x HP Amp val=0
           aplay-20861 [001] .... 486056.332034: snd_soc_dapm_widget_power: widget=x SPK MIXL val=0
           aplay-20861 [001] .... 486056.332036: snd_soc_dapm_widget_power: widget=x SPKVOL R val=0
           aplay-20861 [001] .... 486056.332041: snd_soc_dapm_widget_power: widget=x SYS CLK DET val=0
           aplay-20861 [001] .... 486056.332044: snd_soc_dapm_widget_power: widget=x Charge Pump val=0
           aplay-20861 [001] .... 486056.332046: snd_soc_dapm_widget_power: widget=x HPO R Playback val=0
           aplay-20861 [001] .... 486056.332049: snd_soc_dapm_widget_power: widget=x HPO L Playback val=0
           aplay-20861 [001] .... 486056.332051: snd_soc_dapm_widget_power: widget=x SPKVOL L val=0
           aplay-20861 [001] .... 486056.332053: snd_soc_dapm_widget_power: widget=x SPO R MIX val=0
           aplay-20861 [001] .... 486056.332055: snd_soc_dapm_widget_power: widget=x CLKDET val=0
           aplay-20861 [001] .... 486056.332058: snd_soc_dapm_widget_power: widget=x Headphone Jack val=0
           aplay-20861 [001] .... 486056.332059: snd_soc_dapm_widget_power: widget=x SPO L MIX val=0
           aplay-20861 [001] .... 486056.332061: snd_soc_dapm_widget_power: widget=x SPK Amp val=0
           aplay-20861 [001] .... 486056.332063: snd_soc_dapm_widget_power: widget=x SPO Playback val=0
           aplay-20861 [001] .... 486056.332066: snd_soc_dapm_widget_power: widget=x Int Spk val=0
           aplay-21014 [000] .... 486102.107068: snd_soc_dapm_widget_power: widget=Playback 1 val=1
           aplay-21014 [000] .... 486102.107081: snd_soc_dapm_widget_power: widget=ADMAIF1 Receive val=1
           aplay-21014 [000] .... 486102.107084: snd_soc_dapm_widget_power: widget=ADMAIF1 RX val=1
           aplay-21014 [000] .... 486102.107107: snd_soc_dapm_widget_power: widget=I2S1 Mux val=1
           aplay-21014 [000] .... 486102.107110: snd_soc_dapm_widget_power: widget=I2S1 TX val=1
           aplay-21014 [000] .... 486102.107112: snd_soc_dapm_widget_power: widget=I2S1 Transmit val=1
           aplay-21014 [000] .... 486102.107114: snd_soc_dapm_widget_power: widget=I2S1 Transmit-I2S1 CIF Receive val=1
           aplay-21014 [000] .... 486102.107116: snd_soc_dapm_widget_power: widget=I2S1 CIF Receive val=1
           aplay-21014 [000] .... 486102.107119: snd_soc_dapm_widget_power: widget=I2S1 CIF RX val=1
           aplay-21014 [000] .... 486102.107121: snd_soc_dapm_widget_power: widget=I2S1 DAP TX val=1
           aplay-21014 [000] .... 486102.107123: snd_soc_dapm_widget_power: widget=I2S1 DAP Transmit val=1
           aplay-21014 [000] .... 486102.107125: snd_soc_dapm_widget_power: widget=I2S1 DAP Transmit-x AIF1 Playback val=1
           aplay-21014 [000] .... 486102.107128: snd_soc_dapm_widget_power: widget=x AIF1 Playback val=1
           aplay-21014 [000] .... 486102.107130: snd_soc_dapm_widget_power: widget=x AIF1RX val=1
           aplay-21014 [000] .... 486102.107133: snd_soc_dapm_widget_power: widget=x IF1 DAC1 val=1
           aplay-21014 [000] .... 486102.107136: snd_soc_dapm_widget_power: widget=x I2S1 val=1
           aplay-21014 [000] .... 486102.107139: snd_soc_dapm_widget_power: widget=x IF1 DAC1 R val=1
           aplay-21014 [000] .... 486102.107141: snd_soc_dapm_widget_power: widget=x IF1 DAC1 L val=1
           aplay-21014 [000] .... 486102.107143: snd_soc_dapm_widget_power: widget=x I2S1 ASRC val=1
           aplay-21014 [000] .... 486102.107146: snd_soc_dapm_widget_power: widget=x DAC R1 Mux val=1
           aplay-21014 [000] .... 486102.107149: snd_soc_dapm_widget_power: widget=x DAC L1 Mux val=1
           aplay-21014 [000] .... 486102.107151: snd_soc_dapm_widget_power: widget=x DAC Stereo1 Filter val=1
           aplay-21014 [000] .... 486102.107154: snd_soc_dapm_widget_power: widget=x DAC1 MIXR val=1
           aplay-21014 [000] .... 486102.107157: snd_soc_dapm_widget_power: widget=x DAC1 MIXL val=1
           aplay-21014 [000] .... 486102.107180: snd_soc_dapm_widget_power: widget=x Stereo DAC MIXR val=1
           aplay-21014 [000] .... 486102.107183: snd_soc_dapm_widget_power: widget=x Stereo DAC MIXL val=1
           aplay-21014 [000] .... 486102.107185: snd_soc_dapm_widget_power: widget=x DAC R2 Source val=1
           aplay-21014 [000] .... 486102.107187: snd_soc_dapm_widget_power: widget=x DAC R1 Source val=1
           aplay-21014 [000] .... 486102.107191: snd_soc_dapm_widget_power: widget=x DAC L2 Source val=1
           aplay-21014 [000] .... 486102.107194: snd_soc_dapm_widget_power: widget=x DAC L1 Source val=1
           aplay-21014 [000] .... 486102.107196: snd_soc_dapm_widget_power: widget=x DAC R2 Power val=1
           aplay-21014 [000] .... 486102.107199: snd_soc_dapm_widget_power: widget=x DAC R2 val=1
           aplay-21014 [000] .... 486102.107201: snd_soc_dapm_widget_power: widget=x DAC R1 Power val=1
           aplay-21014 [000] .... 486102.107203: snd_soc_dapm_widget_power: widget=x DAC R1 val=1
           aplay-21014 [000] .... 486102.107206: snd_soc_dapm_widget_power: widget=x DAC L2 Power val=1
           aplay-21014 [000] .... 486102.107207: snd_soc_dapm_widget_power: widget=x DAC L2 val=1
           aplay-21014 [000] .... 486102.107210: snd_soc_dapm_widget_power: widget=x DAC L1 Power val=1
           aplay-21014 [000] .... 486102.107212: snd_soc_dapm_widget_power: widget=x DAC L1 val=1
           aplay-21014 [000] .... 486102.107214: snd_soc_dapm_widget_power: widget=x SPK MIXR val=1
           aplay-21014 [000] .... 486102.107217: snd_soc_dapm_widget_power: widget=x HP Amp val=1
           aplay-21014 [000] .... 486102.107220: snd_soc_dapm_widget_power: widget=x SPK MIXL val=1
           aplay-21014 [000] .... 486102.107222: snd_soc_dapm_widget_power: widget=x SPKVOL R val=1
           aplay-21014 [000] .... 486102.107225: snd_soc_dapm_widget_power: widget=x SYS CLK DET val=1
           aplay-21014 [000] .... 486102.107228: snd_soc_dapm_widget_power: widget=x Charge Pump val=1
           aplay-21014 [000] .... 486102.107230: snd_soc_dapm_widget_power: widget=x HPO R Playback val=1
           aplay-21014 [000] .... 486102.107233: snd_soc_dapm_widget_power: widget=x HPO L Playback val=1
           aplay-21014 [000] .... 486102.107235: snd_soc_dapm_widget_power: widget=x SPKVOL L val=1
           aplay-21014 [000] .... 486102.107238: snd_soc_dapm_widget_power: widget=x SPO R MIX val=1
           aplay-21014 [000] .... 486102.107240: snd_soc_dapm_widget_power: widget=x CLKDET val=1
           aplay-21014 [000] .... 486102.107243: snd_soc_dapm_widget_power: widget=x Headphone Jack val=1
           aplay-21014 [000] .... 486102.107246: snd_soc_dapm_widget_power: widget=x SPO L MIX val=1
           aplay-21014 [000] .... 486102.107248: snd_soc_dapm_widget_power: widget=x SPK Amp val=1
           aplay-21014 [000] .... 486102.107251: snd_soc_dapm_widget_power: widget=x SPO Playback val=1
           aplay-21014 [000] .... 486102.107253: snd_soc_dapm_widget_power: widget=x Int Spk val=1
           aplay-21016 [001] .... 486104.358127: snd_soc_dapm_widget_power: widget=Playback 2 val=1
           aplay-21016 [001] .... 486104.358133: snd_soc_dapm_widget_power: widget=ADMAIF2 Receive val=1
           aplay-21016 [001] .... 486104.358136: snd_soc_dapm_widget_power: widget=ADMAIF2 RX val=1
           aplay-21016 [001] .... 486104.358143: snd_soc_dapm_widget_power: widget=I2S2 Mux val=1
           aplay-21016 [001] .... 486104.358145: snd_soc_dapm_widget_power: widget=I2S2 TX val=1
           aplay-21016 [001] .... 486104.358146: snd_soc_dapm_widget_power: widget=I2S2 Transmit val=1
           aplay-21016 [001] .... 486104.358147: snd_soc_dapm_widget_power: widget=I2S2 Transmit-I2S2 CIF Receive val=1
           aplay-21016 [001] .... 486104.358148: snd_soc_dapm_widget_power: widget=I2S2 CIF Receive val=1
           aplay-21016 [001] .... 486104.358149: snd_soc_dapm_widget_power: widget=I2S2 CIF RX val=1
           aplay-21016 [001] .... 486104.358150: snd_soc_dapm_widget_power: widget=I2S2 DAP TX val=1
           aplay-21016 [001] .... 486104.358152: snd_soc_dapm_widget_power: widget=I2S2 DAP Transmit val=1
           aplay-21016 [001] .... 486104.358153: snd_soc_dapm_widget_power: widget=I2S2 DAP Transmit-y Playback val=1
           aplay-21016 [001] .... 486104.358154: snd_soc_dapm_widget_power: widget=y Playback val=1
           aplay-21016 [001] .... 486104.358155: snd_soc_dapm_widget_power: widget=y OUT val=1
           aplay-21016 [001] .... 486104.358156: snd_soc_dapm_widget_power: widget=y Headphone val=1
user@AGX:~/forscp$

Thanks,
Jiaheng

Hello!

I tried the following and I did not observe the errors show above …

amixer -c 1 cset name="MIXER1-1 Mux" ADMAIF1
amixer -c 1 cset name="MIXER1-2 Mux" ADMAIF2
amixer -c 1 cset name="MIXER1-3 Mux" ADMAIF3
amixer -c 1 cset name="Adder1 RX1" 1
amixer -c 1 cset name="Adder1 RX2" 1
amixer -c 1 cset name="Adder1 RX3" 1
amixer -c 1 cset name="Mixer Enable" 1
amixer -c 1 cset name="ADMAIF3 Mux" MIXER1-1
aplay -D hw:1,0 <in.wav> & 
aplay -D hw:1,1 <in.wav> &
aplay -D hw:1,2 <in.wav> &
arecord -D hw:1,2 -r 48000 -c 1 -f S16_LE -d 10 out.wav

You should be able to try just the one input as well …

aplay -D hw:1,2 <in.wav> & arecord -D hw:1,2 -r 48000 -c 2 -f S16_LE -d 10 out.wav

Regards,
Jon

Hi jon,

There is a good news that these commands,

amixer -c 1 cset name="MIXER1-1 Mux" ADMAIF1
amixer -c 1 cset name="MIXER1-2 Mux" ADMAIF2
amixer -c 1 cset name="MIXER1-3 Mux" ADMAIF3
amixer -c 1 cset name="Adder1 RX1" 1
amixer -c 1 cset name="Adder1 RX2" 1
amixer -c 1 cset name="Adder1 RX3" 1
amixer -c 1 cset name="Mixer Enable" 1
amixer -c 1 cset name="ADMAIF3 Mux" MIXER1-1
aplay -D hw:1,0 <in.wav> & 
aplay -D hw:1,1 <in.wav> &
aplay -D hw:1,2 <in.wav> &
arecord -D hw:1,2 -r 48000 -c 1 -f S16_LE -d 10 out.wav

can produce the out.wav which is exactly what I wanted, however agx report,

user@AGX:~/forscp$ aplay -D hw:1,0 jj.wav & aplay -D hw:1,1 deng.wav & aplay -D hw:1,2 ouyang.wav & arecord -D hw:1,2 -r 48000 -c 1 -f S16_LE  out_3.wav
[1] 13357
[2] 13358
[3] 13359
Playing WAVE 'jj.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Playing WAVE 'deng.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Playing WAVE 'ouyang.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Recording WAVE 'out_3.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
^CAborted by signal Interrupt...
user@AGX:~/forscp$
user@AGX:~/forscp$
user@AGX:~/forscp$
user@AGX:~/forscp$ aplay: pcm_write:2011: write error: Input/output error
aplay: pcm_write:2011: write error: Input/output error

[1]   Exit 1                  aplay -D hw:1,0 jj.wav
[2]-  Exit 1                  aplay -D hw:1,1 deng.wav
user@AGX:~/forscp$
user@AGX:~/forscp$
user@AGX:~/forscp$ aplay: pcm_write:2011: write error: Input/output error
^C
[3]+  Exit 1                  aplay -D hw:1,2 ouyang.wav
user@AGX:~/forscp$

I don’t know how above errors produced.

By the way, aplay -D hw:1,2 <in.wav> & arecord -D hw:1,2 -r 48000 -c 2 -f S16_LE -d 10 out.wav reports,

user@AGX:~/forscp$ aplay -D hw:1,2 ./jj.wav & arecord -D hw:1,2 -r 48000 -c 2 -f S16_LE -d 10 out.wav
[2] 14276
aplay: main:788: audio open error: Device or resource busy
Recording WAVE 'out.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
underrun!!! (at least 5.376 ms long)
overrun!!! (at least 8.078 ms long)
[2]+  Exit 1                  aplay -D hw:1,2 ./jj.wav
user@AGX:~/forscp$

It seems not worked correctly?

Thanks,
Jiaheng

Hello!

Please make sure that you don’t have any instances of aplay still running …

$ killall aplay

The ‘Device or resource busy’ seems to indicate that maybe aplay is still running.

Now if arecord is not running and so not reading the data from the mixer, then the aplay will not be able to send the data and hence you see those ‘write error: Input/output error’ messages. Similarly if aplay is not running then arecord will not receive data. Can you try …

arecord -D hw:1,2 --nonblock -r 48000 -c 1 -f S16_LE out.wav &
aplay -D hw:1,0 <in.wav> & 
aplay -D hw:1,1 <in.wav> &
aplay -D hw:1,2 <in.wav>

Regards,
Jon

hi jon,

Thank you for your support. The commands you provided works very well, but I still want to know that if there is any problem with aplay -D hw:1,2 <in.wav> on your agx? Will it show underrun?

That command is important to me and I wish it can also work well on my agx.

Thanks
Jiaheng

Hello!

I did not see any issues with 'aplay -D hw:1,2 '. Does it always get you an Device or resource busy error? If so, can you try 'aplay -D plughw:1,2 '?

Regards
Jon

hi,

I don’t mean to get a Device or resource busy error,which happens when you are using one device with more than one commands at the same time.

I just run only one command, aplay -D hw:1,2 jj.wav , and the agx report the below message,

user@AGX:~/forscp$ aplay -D hw:1,2 jj.wav 
Playing WAVE 'jj.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
underrun!!! (at least 1.164 ms long)
underrun!!! (at least 0.505 ms long)
underrun!!! (at least 1.213 ms long)
underrun!!! (at least 2.434 ms long)
underrun!!! (at least 6.200 ms long)
underrun!!! (at least 4.293 ms long)
underrun!!! (at least 1.995 ms long)
underrun!!! (at least 0.087 ms long)
underrun!!! (at least 0.366 ms long)
underrun!!! (at least 1.295 ms long)
underrun!!! (at least 3.095 ms long)
underrun!!! (at least 0.051 ms long)
underrun!!! (at least 2.464 ms long)
user@AGX:~/forscp$

It dose not seem to a Device or resource busy error.

The aplay -D plughw:1,2 jj.wav shows the same error as above.

user@AGX:~/forscp$ aplay -D plughw:1,2 jj.wav 
Playing WAVE 'jj.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
underrun!!! (at least 2.872 ms long)
underrun!!! (at least 2.615 ms long)
underrun!!! (at least 0.559 ms long)
underrun!!! (at least 1.720 ms long)
underrun!!! (at least 6.809 ms long)
underrun!!! (at least 6.363 ms long)
underrun!!! (at least 9.680 ms long)
underrun!!! (at least 4.474 ms long)
underrun!!! (at least 1.977 ms long)
underrun!!! (at least 26.081 ms long)
underrun!!! (at least 0.214 ms long)
underrun!!! (at least 3.871 ms long)
underrun!!! (at least 0.543 ms long)
underrun!!! (at least 1.150 ms long)
underrun!!! (at least 0.286 ms long)
underrun!!! (at least 0.578 ms long)
underrun!!! (at least 0.137 ms long)
underrun!!! (at least 1.139 ms long)
underrun!!! (at least 6.763 ms long)
underrun!!! (at least 1.854 ms long)
underrun!!! (at least 0.931 ms long)
underrun!!! (at least 1.252 ms long)
underrun!!! (at least 1.832 ms long)
underrun!!! (at least 0.132 ms long)
underrun!!! (at least 1.589 ms long)
underrun!!! (at least 0.013 ms long)
underrun!!! (at least 1.955 ms long)
underrun!!! (at least 19.877 ms long)
underrun!!! (at least 0.056 ms long)
underrun!!! (at least 0.602 ms long)
underrun!!! (at least 0.019 ms long)
underrun!!! (at least 1.346 ms long)
underrun!!! (at least 2.400 ms long)
underrun!!! (at least 2.270 ms long)
underrun!!! (at least 12.989 ms long)
underrun!!! (at least 7.384 ms long)
underrun!!! (at least 0.370 ms long)
underrun!!! (at least 28.097 ms long)
underrun!!! (at least 0.157 ms long)
underrun!!! (at least 2.564 ms long)
underrun!!! (at least 0.664 ms long)
underrun!!! (at least 0.418 ms long)
underrun!!! (at least 2.391 ms long)
underrun!!! (at least 0.017 ms long)
underrun!!! (at least 1.269 ms long)
underrun!!! (at least 0.169 ms long)
underrun!!! (at least 3.654 ms long)
underrun!!! (at least 0.103 ms long)
underrun!!! (at least 5.294 ms long)
underrun!!! (at least 0.505 ms long)
underrun!!! (at least 0.246 ms long)
underrun!!! (at least 5.210 ms long)
underrun!!! (at least 4.069 ms long)
underrun!!! (at least 1.595 ms long)
underrun!!! (at least 8.262 ms long)
underrun!!! (at least 0.842 ms long)
underrun!!! (at least 0.040 ms long)
underrun!!! (at least 25.363 ms long)
underrun!!! (at least 0.634 ms long)
underrun!!! (at least 0.014 ms long)
underrun!!! (at least 4.265 ms long)
underrun!!! (at least 1.188 ms long)
underrun!!! (at least 0.925 ms long)
underrun!!! (at least 1.261 ms long)
underrun!!! (at least 2.884 ms long)
underrun!!! (at least 0.228 ms long)
underrun!!! (at least 0.023 ms long)
underrun!!! (at least 0.536 ms long)
underrun!!! (at least 2.105 ms long)
underrun!!! (at least 1.673 ms long)
underrun!!! (at least 0.734 ms long)
underrun!!! (at least 5.802 ms long)
underrun!!! (at least 0.418 ms long)
user@AGX:~/forscp$ 

And you mean seeing no issues with aplay -D plughw:1,2 <in.wav>?
Is there any problem with my agx?

Thanks
Jiaheng

Hello!

Yes I see the same …

$ aplay -D hw:1,2 sfbd-48k.wav 
Playing WAVE 'sfbd-48k.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
underrun!!! (at least 2.017 ms long)
underrun!!! (at least 3.156 ms long)

By default, I don’t see this with hw:1,0 and hw:1,1 but this is because these are routed to I2S1 and I2S2 by default …

$ amixer -c 1 sget "I2S1 Mux"
Simple mixer control 'I2S1 Mux',0
  Capabilities: enum
  Items: 'None' 'ADMAIF1' 'ADMAIF2' 'ADMAIF3' 'ADMAIF4' 'ADMAIF5' 'ADMAIF6' 'ADMAIF7' 'ADMAIF8' 'ADMAIF9' 'ADMAIF10' 'ADMAIF11' 'ADMAIF12' 'ADMAIF13' 'ADMAIF14' 'ADMAIF15' 'ADMAIF16' 'I2S1' 'I2S2' 'I2S3' 'I2S4' 'I2S5' 'I2S6' 'SFC1' 'SFC2'
 'SFC3' 'SFC4' 'MIXER1-1' 'MIXER1-2' 'MIXER1-3' 'MIXER1-4' 'MIXER1-5' 'AMX1' 'AMX2' 'AMX3' 'AMX4' 'ARAD1' 'AFC1' 'AFC2' 'AFC3' 'AFC4' 'AFC5' 'AFC6' 'OPE1' 'SPKPROT1' 'MVC1' 'MVC2' 'IQC1-1' 'IQC1-2' 'IQC2-1' 'IQC2-2' 'DMIC1' 'DMIC2' 'DMIC3
' 'DMIC4' 'ADX1-1' 'ADX1-2' 'ADX1-3' 'ADX1-4' 'ADX2-1' 'ADX2-2' 'ADX2-3' 'ADX2-4' 'ADX3-1' 'ADX3-2' 'ADX3-3' 'ADX3-4' 'ADX4-1' 'ADX4-2' 'ADX4-3' 'ADX4-4' 'ADMAIF17' 'ADMAIF18' 'ADMAIF19' 'ADMAIF20' 'ASRC1-1' 'ASRC1-2' 'ASRC1-3' 'ASRC1-4' 'ASRC1-5' 'ASRC1-6'
  Item0: 'ADMAIF1'
$ amixer -c 1 sget "I2S2 Mux"
Simple mixer control 'I2S2 Mux',0
  Capabilities: enum
  Items: 'None' 'ADMAIF1' 'ADMAIF2' 'ADMAIF3' 'ADMAIF4' 'ADMAIF5' 'ADMAIF6' 'ADMAIF7' 'ADMAIF8' 'ADMAIF9' 'ADMAIF10' 'ADMAIF11' 'ADMAIF12' 'ADMAIF13' 'ADMAIF14' 'ADMAIF15' 'ADMAIF16' 'I2S1' 'I2S2' 'I2S3' 'I2S4' 'I2S5' 'I2S6' 'SFC1' 'SFC2'
 'SFC3' 'SFC4' 'MIXER1-1' 'MIXER1-2' 'MIXER1-3' 'MIXER1-4' 'MIXER1-5' 'AMX1' 'AMX2' 'AMX3' 'AMX4' 'ARAD1' 'AFC1' 'AFC2' 'AFC3' 'AFC4' 'AFC5' 'AFC6' 'OPE1' 'SPKPROT1' 'MVC1' 'MVC2' 'IQC1-1' 'IQC1-2' 'IQC2-1' 'IQC2-2' 'DMIC1' 'DMIC2' 'DMIC3
' 'DMIC4' 'ADX1-1' 'ADX1-2' 'ADX1-3' 'ADX1-4' 'ADX2-1' 'ADX2-2' 'ADX2-3' 'ADX2-4' 'ADX3-1' 'ADX3-2' 'ADX3-3' 'ADX3-4' 'ADX4-1' 'ADX4-2' 'ADX4-3' 'ADX4-4' 'ADMAIF17' 'ADMAIF18' 'ADMAIF19' 'ADMAIF20' 'ASRC1-1' 'ASRC1-2' 'ASRC1-3' 'ASRC1-4' 'ASRC1-5' 'ASRC1-6'
  Item0: 'ADMAIF2'

If I disable the route to I2S1 and I2S2, then you may see the same issue …

$ amixer -c 1 sset "I2S1 Mux" None
$ amixer -c 1 sset "I2S2 Mux" None
$ aplay -D hw:1,1 sfbd-48k.wav 
Playing WAVE 'sfbd-48k.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
underrun!!! (at least 0.883 ms long)

Regards,
Jon

Hi,
Thank you very much. I have tried amixer -c 1 sset “I2S3 Mux” ADMAIF3, and then aplay -D hw:1,2 jj.wav works well without underrun.
Can you explain why the command works well with the routing ADMAIF3 to I2S3?
And I see just
user@AGX:~/forscp$ amixer -c1 | grep “I2S.* Mux”
Simple mixer control ‘I2S1 Mux’,0
Simple mixer control ‘I2S2 Mux’,0
Simple mixer control ‘I2S3 Mux’,0
Simple mixer control ‘I2S4 Mux’,0
Simple mixer control ‘I2S5 Mux’,0
Simple mixer control ‘I2S6 Mux’,0
What if I need to mix more than 6 audio streams?

Jiaheng?

Hello!

Yes I can explain. Without routing the audio to one of the I2S ports, the data will be fed to the mixer as fast as possible without any hardware throttling. In this case the playback or capture maybe not be able to keep up and so underruns on the playback side or overruns on the capture side could be seen. If the audio is also routed to the mixer and I2S, then the I2S port will slow the playback down to the sample rate that is given. Hence, you will see that to play the WAV file without the audio being sent to the I2S port is much quicker.

If you need to mix more than 6 audio streams you could try something like the following where you use a single I2S to route the output of the mixer through …

amixer -c 1 cset name"I2S1 Mux" None
amixer -c 1 cset name"I2S2 Mux" None
amixer -c 1 cset name"I2S3 Mux" None
amixer -c 1 cset name="MIXER1-1 Mux" ADMAIF1
amixer -c 1 cset name="MIXER1-2 Mux" ADMAIF2
amixer -c 1 cset name="MIXER1-3 Mux" ADMAIF3
amixer -c 1 cset name="MIXER1-4 Mux" ADMAIF4
amixer -c 1 cset name="MIXER1-5 Mux" ADMAIF5
amixer -c 1 cset name="MIXER1-6 Mux" ADMAIF6
amixer -c 1 cset name="MIXER1-7 Mux" ADMAIF7
amixer -c 1 cset name="MIXER1-8 Mux" ADMAIF8
amixer -c 1 cset name="MIXER1-9 Mux" ADMAIF9
amixer -c 1 cset name="MIXER1-10 Mux" ADMAIF10
amixer -c 1 cset name="Adder1 RX1" 1
amixer -c 1 cset name="Adder1 RX2" 1
amixer -c 1 cset name="Adder1 RX3" 1
amixer -c 1 cset name="Adder1 RX4" 1
amixer -c 1 cset name="Adder1 RX5" 1
amixer -c 1 cset name="Adder1 RX6" 1
amixer -c 1 cset name="Adder1 RX7" 1
amixer -c 1 cset name="Adder1 RX8" 1
amixer -c 1 cset name="Adder1 RX9" 1
amixer -c 1 cset name="Adder1 RX10" 1
amixer -c 1 cset name="Mixer Enable" 1
amixer -c 1 cset name="I2S3 Mux" MIXER1-1
amixer -c 1 cset name="ADMAIF3 Mux" I2S3
amixer -c 1 cset name="I2S3 Loopback" on

Regards,
Jon

1 Like

Hi

Yes, these commands are very useful.
So, Do you mean the audio stream flow like,
<in.wav> —>>> ADMAIF1 —>>> Mixer RX1 —>>> adder1 —>>>TX1 —>>> I2S3 —>>> ADMAIF3 —>>> <out.wav>

Thanks
Jiaheng

Hello!

Yes that’s correct. That way we can use the I2S to throttle the audio stream and prevent underruns.

Jon

Hi Jon

Thank you very much!
My problem is solved.

Thanks again :)
Jiaheng

Hi Jiaheng,

No problem. Thanks for the follow-up.

Jon