Auto-select the mux input with signal (help)?

There maybe something on this already in this forum, if so I apologies for the repeat but I couldn't find it.

My application is this: I have two stereo analog inputs that run into an indexed multiplexer.  I would like to choose the input based on if there is signal on channel on of the channels. For example if stereo channel 1 is playing music and then stereo channel 2 starts playing music, the mux should switch to stereo channel 2. In fact, as long as there is signal on stereo channel 2, I would like the mux to select stereo channel 2.

I am trying to use an indexed multiplexer with an RMS table as the index, but I am having trouble getting this working. Any ideas on how to accomplish?

  • 0
    •  Super User 
    on Jun 6, 2014 6:26 AM

         Hello,

         In the example below, the ABCD Comparator determines whether Input 2 is present, directing the mux accordingly.  If the level at Input 2 is above the threshold set by the slider, it outputs a logic "1" (integer), which switches the mux to Input 2.  Otherwise, it outputs a zero which selects Input 1.

         The Index Selectable Mux takes an integer control input (0, 1, 2...) to choose among its audio inputs.  Integers in most SigmaDSPs are "28.0" numbers, the new -145x series uses "32.0" integers.  Find a description of SigmaDSP number formats at What are the number formats for SigmaDSP?

         It's generally a good idea to include highpass or DC block filtering when performing threshold comparisons, to prevent any residual DC at the input from influencing the switching.  The arrangement above also measures each Input 2 channel separately and chooses the higher one, rather than mixing the channels into one envelope block.  This insures that if there's anything on Input 2, the mux will switch.

         I tested this circuit on a ADAU1452 mini board, as it was handy and includes two stereo inputs.  If you're using that board, the attached project will run directly.

         Best regards,

         Bob

    Switch-level.dspproj.zip