Mixer Usage#

The following diagram shows the mixer usage flow:

Diagram showing three ADMAIF blocks feeding into a MIXER block, which then connects to an AMX block, and finally to an I2S block.
  • Mixer connection:

// Route ADMAIF1 (hw:0,0) to MIXER Input 1
amixer -c 0 cset name='MIXER1 RX1 Mux' 'ADMAIF1'
// Route ADMAIF2 (hw:0,1) to MIXER Input 2
amixer -c 0 cset name='MIXER1 RX2 Mux' 'ADMAIF2'
// Route ADMAIF3 (hw:0,2) to MIXER Input 3
amixer -c 0 cset name='MIXER1 RX3 Mux' 'ADMAIF3'
// Route Mixer output 1 to AMX1 (Multiplexer to generate TDM) Input 1
amixer -c 0 cset name='AMX1 RX1 Mux' 'MIXER1 TX1'
// Route the output of AMX1 to I2S3
amixer -c 0 cset name='I2S3 Mux' 'AMX1'

Note

Assuming that the channel configurations for both AMX Output and I2S instances are identical. For instance, in the case of Thor, I2S5 should be used instead of I2S3.

  • Mixer setup:

// Enable Mixer input 1 for Adder 1 (There are 5 adders available)
amixer -c 0 cset name='MIXER1 Adder1 RX1' 1
// Enable Mixer input 2 for Adder 1 (There are 5 adders available)
amixer -c 0 cset name='MIXER1 Adder1 RX2' 1
// Enable Mixer input 3 for Adder 1 (There are 5 adders available)
amixer -c 0 cset name='MIXER1 Adder1 RX3' 1
// Set Gain for Mixer Inputs: Gain is in 16.16 format
amixer –c 0 cset name="MIXER1 RX1 Gain Volume" 65536
amixer –c 0 cset name="MIXER1 RX2 Gain Volume" 65536
amixer –c 0 cset name="MIXER1 RX3 Gain Volume" 65536
  • Testing commands

aplay -D hw:0,0 "file to be played" &
aplay -D hw:0,1 "file to be played" &
// Should hear mixed sound
aplay -D hw:0,2 "file to be played" &
// Should hear all 3 sounds mixed.
amixer cset name="MIXER1 RX2 Gain Volume" 0
// Mixer Input 2 should keep playing but mixed with 0 gain so will not be heard
  • Turn ON/OFF Mixer Input:

amixer -c 0 cset name="MIXER1 Adder1 RX1" 1 (Turned on)
amixer -c 0 cset name="MIXER1 Adder1 RX1" 0 (Turned off)
  • Control Gain:

amixer -c 0 cset name="MIXER1 RX1 Gain Volume" 65536
(Gain must be in unsigned Q16.16 format; unity gain means 2^16)