Jetson TX2 sound initialization

Hi everyone,
Currently, I am using rt565x codec to get audio input,
The tegra_t186ref_dai_init() function initializes parameters like following:

pll_a_out0 = 45158400 Hz, aud_mclk = 11289600 Hz, codec rate = 44100 Hz

However, for my application I would like to initialize parameters like this:

pll_a_out0 = 49152000 Hz, aud_mclk = 12288000 Hz, codec rate = 48000 Hz

How can I do this?
Any suggestion is appreciated.
Thank in advance.
Best regards,

Hello!

The pll_a_out0 and aud_mclk are reconfigured everytime a new playback/capture session is initiated. So if you were to play or capture a stereo 48kHz 16-bit sample, then you should see that the pll_a_out0 and mclk_aud get updated.

Regards,
Jon

Dear Jonathan,
I know that those parameters will be re-initiated when I capture stereo 48kHz 16-bit sample but it will make my application delay.
I want to have those parameters are initiated as for 48kHz sample when the TX2 finish booting.
Do you have any suggestion?
Thank in advance

The above print should occur when ‘hw_params()’ is called to intiate playback/capture. If you have the desktop installed (which should be by default), then I am wondering if this is happening because on boot the ubuntu startup chime is being played. I will need to check on this. Jon

Hi jonathanh,
Do you have any update for this problem?
Thank!
Best regards,

Hi,
I found the solution, we need to modify /etc/pulse/daemon.conf such that

default-sample-rate = 48000
alternate-sample-rate = 44100

And then TX2 will initialize with configuration for 48Khz sample.
However, I have ones question:
Why do TX2 call hw_params() several times after finish booting (about 10 times)? How can I just do 1 time?
Best regards.

Hello!

hw_params() will be called everytime audio is played/captured. So if it is getting called about 10 times, then something is playing audio. Now if you are running the desktop then this could be just audio sound effects being played. You could try disabling any audio sound effects to see if this helps.

Regards,
Jon

Dear Jon,
How can I check which audio sound effect is being played?
Thank in advance.
Best regards,

Hello!

I believe that the calls to hw_params are caused by pulseaudio when it starts. If I kill pulseaudio …

$ pulseaudio -k

It should automatically restart in the background and then I see more calls to hw_params. So it is not sound effects (but those could trigger further calls) but pulseaudio. If you do not need pulseaudio you could uninstall it. However, then you would be unable to control audio through the desktop GUI but maybe that does not matter for your application.

Regards,
Jon