How to play audiofile with original rate in L4T 35.5.0

We are testing L4T 35.5.0 in AGX Orin DevKit.

We created an 8KHz rate file from a 48kHz rate file with the following command in HostPC.
This is for playback at an arbitrary rate for audio output.

$ ffmpeg -i /usr/share/sounds/alsa/Front_Right.wav -ar 8000 /usr/share/sounds/alsa/Front_Right_8000.wav 

$ file Front_Right.wav
Front_Right.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 48000 Hz

$ file Front_Right_8000.wav
Front_Right_8000.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz

When I played it on DevKit with aplay without the -D option,
it finally played back at 8KHz → 48KHz by “Rate conversion PCM”.

# aplay -v ./Front_Left_8000.wav
Playing WAVE './Front_Left_8000.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono
Plug PCM: Rate conversion PCM (48000, sformat=S16_LE)
Converter: libspeex (builtin)
Protocol version: 10002
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 8000
  exact rate   : 8000 (8000/1)
  msbits       : 16
  buffer_size  : 1365
  period_size  : 341
  period_time  : 42666
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 341
  period_event : 0
  start_threshold  : 1365
  stop_threshold   : 1365
  silence_threshold: 0
  silence_size : 0
  boundary     : 768426686420090880
Slave: Route conversion PCM (sformat=S16_LE)
  Transformation table:
    0 <- 0
    1 <- 0
Its setup is:
  stream       : PLAYBACK
  access       : MMAP_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 16
  buffer_size  : 8192
  period_size  : 2048
  period_time  : 42666
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 2048
  period_event : 0
  start_threshold  : 8192
  stop_threshold   : 8192
  silence_threshold: 0
  silence_size : 0
  boundary     : 4611686018427387904
Slave: Hardware PCM card 1 'NVIDIA Jetson AGX Orin APE' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : MMAP_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 16
  buffer_size  : 8192
  period_size  : 2048
  period_time  : 42666
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 2048
  period_event : 0
  start_threshold  : 8192
  stop_threshold   : 8192
  silence_threshold: 0
  silence_size : 0
  boundary     : 4611686018427387904
  appl_ptr     : 0
  hw_ptr       : 0

In addition, when we specify “-D hw:1,0” or “-D plughw:APE”, playback was possible at 8KHz.
However, only a small noise was heared in the output audio.

# aplay -v -D hw:1,0 ./Front_Left_8000.wav
Playing WAVE './Front_Left_8000.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono
Hardware PCM card 1 'NVIDIA Jetson AGX Orin APE' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 8000
  exact rate   : 8000 (8000/1)
  msbits       : 16
  buffer_size  : 4000
  period_size  : 1000
  period_time  : 125000
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 1000
  period_event : 0
  start_threshold  : 4000
  stop_threshold   : 4000
  silence_threshold: 0
  silence_size : 0
  boundary     : 9007199254740992000
  appl_ptr     : 0
  hw_ptr       : 0

# aplay -v -D plughw:APE ./Front_Left_8000.wav
Playing WAVE './Front_Left_8000.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono
Plug PCM: Hardware PCM card 1 'NVIDIA Jetson AGX Orin APE' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 8000
  exact rate   : 8000 (8000/1)
  msbits       : 16
  buffer_size  : 4000
  period_size  : 1000
  period_time  : 125000
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 1000
  period_event : 0
  start_threshold  : 4000
  stop_threshold   : 4000
  silence_threshold: 0
  silence_size : 0
  boundary     : 9007199254740992000
  appl_ptr     : 0
  hw_ptr       : 0

Coud you tell me how to play the file in its original rate
in the Jetson Orin DevKit environment?

Hi,
On AGX Orin developer kit, there is audio codec RT5640. Do you use it for audio playback? If you run aplay command to play audio file through the codec, it is supposed to be original rate.

Hi,

On AGX Orin developer kit, there is audio codec RT5640.

Yes, We believe RT5640 supports various sampling rate at playing audio, like 8kHz ~ 192kHz.

If you run aplay command to play audio file through the codec, it is supposed to be original rate.

If we don’t specify alsa device with -D,it may be automatically converted to 48kHz for playback, not original rate.
The audio in this case is playing normally.

As you can see, we found two command pattern for played by original rate 8000,

# aplay -v -D hw:1,0 ./Front_Left_8000.wav
Playing WAVE './Front_Left_8000.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono
Hardware PCM card 1 'NVIDIA Jetson AGX Orin APE' device 0 subdevice 0
...
 rate         : 8000

# aplay -v -D plughw:APE ./Front_Left_8000.wav
Playing WAVE './Front_Left_8000.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono
Plug PCM: Hardware PCM card 1 'NVIDIA Jetson AGX Orin APE' device 0 subdevice 0
...
 rate         : 8000

But both when we play with aplay, we heard only a small noise in the headphone output
instead of original file sound. This is the problem.

We connect following HD audio jack I/O Board with Devkit.

How to play the file in its original rate and original sound in the Jetson Orin DevKit environment?

Hi, Any Update?

We want to know how to play audio file with specific rate in AGX Orin Devkit.

Hi,
Please share the steps and we will set up to reproduce the issue on AGX Orin developer kit.

Hi, reproduce procedure is as follows.

1. Prepare AGX Orin DevKit Environment work with L4T 35.5.0.

2. Prepare AUDIO connector Board such as following and connect with 10pin Audio Panel Header(J511) of AGX Orin Devkit

3. Connect Headphone with Headphone Output pin of AUDIO connector Board.

4. Convert wav file to 8kHz by following command in Ubuntu HostPC.

$ sudo apt install -y ffmpeg
$ ffmpeg -i /usr/share/sounds/alsa/Front_Right.wav -ar 8000 /usr/share/sounds/alsa/Front_Right_8000.wav
$ cd /usr/share/sounds/alsa/
$ file Front_Right.wav
/usr/share/sounds/alsa/Front_Right.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 48000 Hz
$ file Front_Right_8000.wav
Front_Right_8000.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz

5. Transfer /usr/share/sounds/alsa/Front_Right_8000.wav from HostPC to AGX Orin Devkit Environment.

6. Play /usr/share/sounds/alsa/Front_Right_8000.wav file with aplay, verbose argument in AGX Orin Devkit.

# aplay -v ./Front_Left_8000.wav
Playing WAVE './Front_Left_8000.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono
Plug PCM: Rate conversion PCM (48000, sformat=S16_LE)
Converter: libspeex (builtin)
Protocol version: 10002
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 8000
  exact rate   : 8000 (8000/1)
  msbits       : 16
  buffer_size  : 1365
  period_size  : 341
  period_time  : 42666
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 341
  period_event : 0
  start_threshold  : 1365
  stop_threshold   : 1365
  silence_threshold: 0
  silence_size : 0
  boundary     : 768426686420090880
Slave: Route conversion PCM (sformat=S16_LE)
  Transformation table:
    0 <- 0
    1 <- 0
Its setup is:
  stream       : PLAYBACK
  access       : MMAP_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 16
  buffer_size  : 8192
  period_size  : 2048
  period_time  : 42666
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 2048
  period_event : 0
  start_threshold  : 8192
  stop_threshold   : 8192
  silence_threshold: 0
  silence_size : 0
  boundary     : 4611686018427387904
Slave: Hardware PCM card 1 'NVIDIA Jetson AGX Orin APE' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : MMAP_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 16
  buffer_size  : 8192
  period_size  : 2048
  period_time  : 42666
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 2048
  period_event : 0
  start_threshold  : 8192
  stop_threshold   : 8192
  silence_threshold: 0
  silence_size : 0
  boundary     : 4611686018427387904
  appl_ptr     : 0
  hw_ptr       : 0

Playing sound is good, but it is converted rate to 48000Hz by “Rate conversion PCM” automatically.

7. Play /usr/share/sounds/alsa/Front_Right_8000.wav file with aplay, “-D hw:1,0” or “-D plughw:APE” argument.

# aplay -v -D hw:1,0 ./Front_Left_8000.wav
Playing WAVE './Front_Left_8000.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono
Hardware PCM card 1 'NVIDIA Jetson AGX Orin APE' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 8000
  exact rate   : 8000 (8000/1)
  msbits       : 16
  buffer_size  : 4000
  period_size  : 1000
  period_time  : 125000
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 1000
  period_event : 0
  start_threshold  : 4000
  stop_threshold   : 4000
  silence_threshold: 0
  silence_size : 0
  boundary     : 9007199254740992000
  appl_ptr     : 0
  hw_ptr       : 0

# aplay -v -D plughw:APE ./Front_Left_8000.wav
Playing WAVE './Front_Left_8000.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono
Plug PCM: Hardware PCM card 1 'NVIDIA Jetson AGX Orin APE' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 8000
  exact rate   : 8000 (8000/1)
  msbits       : 16
  buffer_size  : 4000
  period_size  : 1000
  period_time  : 125000
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 1000
  period_event : 0
  start_threshold  : 4000
  stop_threshold   : 4000
  silence_threshold: 0
  silence_size : 0
  boundary     : 9007199254740992000
  appl_ptr     : 0
  hw_ptr       : 0

Playback was possible at 8KHz.
However, only a small noise was heared in the output audio.

Hi,

Please share the below details:

  • By original rate you mean, 8KHz and Mono Or 48KHz and Mono? Please share the audio file that is being used.
  • Share the output of sudo cat /sys/kernel/debug/clk/clk_summary while running the playback with -D option,
  • Next, Run amixer -c APE sset 'I2S1 Client Channels' 2 before running the usecase and see if it helps. Also share the output of sudo cat /sys/kernel/debug/clk/clk_summary while playback is running.
  • Please try with 2 channel audio file and share the observation.

Hi,

By original rate you mean, 8KHz and Mono Or 48KHz and Mono? Please share the audio file that is being used.

Test audio file is located in default Linux environment /usr/share/sounds/alsa/
The original file path and file format is below.

$ file Front_Right.wav
/usr/share/sounds/alsa/Front_Right.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 48000 Hz

・Share the output of sudo cat /sys/kernel/debug/clk/clk_summary while running the playback with -D option,

We are attaching clk_summmary result while running following command.

# aplay -v -D hw:1,0 ./Front_Left_8000.wav

20240528_0917_playback_with_D_clk_summary.txt (78.7 KB)

・Next, Run amixer -c APE sset ‘I2S1 Client Channels’ 2 before running the usecase and see if it helps.
Also share the output of sudo cat /sys/kernel/debug/clk/clk_summary while playback is running.

# amixer -c APE sset 'I2S1 Client Channels' 2
Simple mixer control 'I2S1 Client Channels',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 16
  Mono: 2 [12%]

# aplay -v -D hw:1,0 ./Front_Left_8000.wav
Playing WAVE './Front_Left_8000.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono
Hardware PCM card 1 'NVIDIA Jetson AGX Orin APE' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 8000
  exact rate   : 8000 (8000/1)
  msbits       : 16
  buffer_size  : 4000
  period_size  : 1000
  period_time  : 125000
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 1000
  period_event : 0
  start_threshold  : 4000
  stop_threshold   : 4000
  silence_threshold: 0
  silence_size : 0
  boundary     : 9007199254740992000
  appl_ptr     : 0
  hw_ptr       : 0
[ 2050.184069] tegra210-admaif 290f000.admaif: timeout: failed to disable ADMAIF1_TX

“amixer set client channels as 2” works for me.
Audio was heard normally from the left only.
But we heard some small noise from right while runnning.

And here is clk_summmary result.
i2s1 req_clk_rate is changed from 128000 to 256000 Hz.

20240528_0944_playback_with_channels2_clk_summary.txt (78.7 KB)

・Please try with 2 channel audio file and share the observation.

# wget https://freewavesamples.com/files/Alesis-Fusion-Voice-Oohs-C4.wav
# file Alesis-Fusion-Voice-Oohs-C4.wav
Alesis-Fusion-Voice-Oohs-C4.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz
# aplay -v -D hw:1,0 ./Alesis-Fusion-Voice-Oohs-C4.wav
Playing WAVE './Alesis-Fusion-Voice-Oohs-C4.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Hardware PCM card 1 'NVIDIA Jetson AGX Orin APE' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 44100
  exact rate   : 44100 (44100/1)
  msbits       : 16
  buffer_size  : 8192
  period_size  : 2048
  period_time  : 46439
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 2048
  period_event : 0
  start_threshold  : 8192
  stop_threshold   : 8192
  silence_threshold: 0
  silence_size : 0
  boundary     : 4611686018427387904
  appl_ptr     : 0
  hw_ptr       : 0

Playing stereo file is fine.

When specifying APE devices with -D option, do we always have to specify channels 2 via amixer?
Is the channels option (-c 2) of aplay not supported?
How to disable “timeout: failed to disable ADMAIF1_TX” error?

  • Yes, if trying to play mono.
  • aplay won’t override the input audio file channels from mono to stereo if trying to play mono file using -c 2.

It won’t affect the usecase.

do we always have to specify channels 2 via amixer
Yes, if trying to play mono.

Are there any side effects of always setting channels 2?
(e.g., it cannot be played by other commands, etc.)

Ideally there shouldn’t be any issues with other commands.
Are you looking for any specific command.

Are you looking for any specific command.
No, just a confirmation.
Thank you for your support.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.