Speaker Volume Set/Get API for DSPK2 on TX2

Hi

I am using DSPK2 pin connected to speaker on Jetson-TX2 4GB varient.
Is there any api to set/get the volume of speaker for runtime volume configuration ?

Please suggest on this.

Hi anjali.dutt,

Have you managed to get issue resolve? Any result can be shared?

Hi Kaycc,

I did not find any relevant api for setting the speaker volume.
Please provide input on this.

Hello!

The DSPK interface itself cannot apply any gain to the audio PCM samples. However, if you wish to manipulate the volume you could route the audio via the MVC (master volume control) and use it to control the gain. There is an example here for the I2S, but you can simply swap the I2S for the DSPK in the example.

Regards,
Jon

thanks jonathanh,

I will try out this suggestion and will update.

Hi Jonathanh,

I am able to control the volume of the speaker, thanks for the help. below command worked for me:
amixer -c tegrasndt186ref cset name=“MVC1 Vol” 12602

1 Like

Hi Jon,

I have one more query.

We are enabling mixer setting using the amixer commands, there is a ‘tak-tak’ noise coming from the speaker every time after reboot/power cycle whenever mixer settings are initialized.

Currently i am using below settings:

  1. Audio: Enabling DMIC Routing Path
    amixer -c tegrasndt186ref cset name=“MVC1 Mux” DMIC3
    amixer -c tegrasndt186ref cset name=“ADMAIF1 Mux” MVC1
    amixer -c tegrasndt186ref cset name=“DMIC3 Boost Gain” 1400
    amixer -c tegrasndt186ref cset name=“MVC1 Vol” 12602
    amixer -c tegrasndt186ref cset name=“MVC1 input bit format” 32
    amixer -c tegrasndt186ref cset name=“DMIC3 output bit format” 32
  2. Audio: Enabling DSPK Routing Path
    amixer -c tegrasndt186ref cset name=“DSPK2 Mux” ADMAIF1

please clarify-
Do I need to trigger some other mixer setting to disable that noise ??
How will i change digital gain of the speaker ??
Please revert.

Hello!

Did you try routing the DSPK via MVC as mentioned in this comment?

Jon

yes jon,

first i set below routing-
amixer -c tegrasndt186ref cset name=“MVC1 Mux” ADMAIF1
amixer -c tegrasndt186ref cset name=“DSPK2 Mux” MVC1

then controlling the speaker volume using this-
amixer -c tegrasndt186ref cset name=“MVC1 Vol” 12602

for better understanding, i am talking about the push and pop sound which comes whenever we initialize speaker after reboot/power cycle and this sound is coming since starting irrespective of above changes.

Hello

Are you able to probe the DSPK pins to see what is happening on boot?

Regards,
Jon

As soon as the board is powered up the pin is high for few miliseconds and then its continuously low.