Search This Blog

Wednesday, August 1, 2018

Audio sw - Control Logic - State machine

Projects / Audio Switching  Original post date:08/01/2016

While I am waiting for the PCB to come back, here is what I have in mind. This is a state machine for the switching logic that determines which of the input to the amplifier is selected. The volume levels from both sources are continuously sampled by the ARM every 3.33ms.

  1. When there is only one active audio source, then the audio is switched to that source.
  2. The PC side is given a high priority, so it can interrupt audio from the TV. I like to watch something else on my PC while the long commercial breaks.
  3. If the source is loud prior to switching, then the volume is attenuated by using a voltage divider.
  4. If the loud source has became quiet, then the volume is switched back to normal.
    (I might try to implement some hysteresis to go between 3 & 4?)


I might have to play around with additional timeouts etc. These are the kind of things that I have to tweak with the analog daughter PCB arrives and assembled.

I have deviated from the state machine some what. Here is what I use and it seems to be working well so far.


This state machine is called at the end of each block of audio data processed when the volume is calculated and compared against thresholds. The code also maintains timeout counters to allow for moments of silences in the audio source to prevent sputtering.
The loudness control can't be tested as the PCB hasn't arrived. Getting the parameters for that part could be tricky.




No comments:

Post a Comment

Note: Only a member of this blog may post a comment.