This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Is there a way to detect number of audio channels from source?

Hello TI,


We have DM8148 based custom board. We are using GS2971A as the decoder IC for SDI inputs and ADV7611 for HDMI. I am looking for a way by which I can detect the number of audio channels(2/4 channels) coming from the source i.e. camera.


So is there a way by which we can achieve so?


Thanks,

Krunal

  • Hi Krunal,

    The DM814x HDMI driver support audio in stereo mode by default (1 RX channel for capture and 1 TX channel for playback).

    processors.wiki.ti.com/index.php

    For capturing more than one audio channel you can use the ALSA audio capture application (which is similar to the audio playback application) and configure this capture application for the number of channels you are expecting to capture.

    processors.wiki.ti.com/index.php

    Regards,
    Pavel
  • Hi Pavel,

    Thanks for your response.

    But what I am looking for is to detect the number of active channels. The source can give 2-channel/4-channel audio. So depending on the channels present I will capture the data.

    For example: If I am configuring my driver for 4 channel audio capture and if the source gives me only 2 channel audio. In this case there will be no need to configure my driver for 4 channels. There will be dummy data in my other channels.

    So in order to avoid the extra usage of the resources I want to detect the number of channels active and to configure my driver appropriately.

    Please let me know if there are any queries and need some more clarification.

    Thanks,
    Krunal
  • Krunal,

    What is the SDK you are planning to use (EZSDK, DVR RDK, IPNC RDK, else)?

    Krunal Patel_11 said:
    I am looking for a way by which I can detect the number of audio channels(2/4 channels) coming from the source i.e. camera.

    So you have source/camera that would provide audio data (channels) to the DM814x pins? And to which module pins you will provide this data (Camera interface, HDMI, McASP)?

    Regards,
    Pavel

  • Pavel,

    We are using ezsdk_dm814x-evm_5_05_01_04.

    Please find below our setup:

    HDMI -> HDMI Receiver -> McASP0

    SDI -> SDI Receiver -> McASP1

    Please let me know if you need more information.

    Thanks,

    Krunal

  • Krunal,

    So you might have 4 channel audio case:

    HDMI -> 2 ch audio -> McASP0

    SDI -> 2 ch audio -> McASP1

    And you might have 2 channel audio case:

    HDMI -> 2 ch audio -> McASP0

    SDI -> 0 ch audio -> McASP1

    And you need to configure the McASP audio driver to dynamically detect the number of audio channels (4 or 2) it should capture?

    Regards,
    Pavel
  • Pavel,

    You got it right but there is little correction. The case will be like:

    HDMI -> 4 ch audio -> McASP0

    SDI -> 4 ch audio -> McASP1

    Else we might have 2 channel audio case:

    HDMI -> 2 ch audio -> McASP0

    SDI -> 2 ch audio -> McASP1

    I need to configure the McASP audio driver to dynamically detect the number of audio channels (4 or 2) it should capture?

    Thanks,
    Krunal
  • Krunal,

    Krunal Patel_11 said:
    I need to configure the McASP audio driver to dynamically detect the number of audio channels (4 or 2) it should capture?

    I have check the TI81xx McASP audio driver (in the wiki below) and it seems to me that number of audio channels to capture/record is not configured in the McASP audio driver, but in the audio application or in the ALSA utility (that run over the driver, in user space):

    Capture/record application for stereo audio:

     /* Set number of channels */
      if ((err = snd_pcm_hw_params_set_channels(capture_handle, hw_params, 2)) < 0) {
        fprintf (stderr, "cannot set channel count (%s)\n", snd_strerror (err));
        exit (1);
      }

    Modify the number of channel specified in the code to enable multi-channel capture bases on input given.

    /* Set number of channels */
     if ((err = snd_pcm_hw_params_set_channels(capture_handle, hw_params, <Number of channels>)) < 0) {
       fprintf (stderr, "cannot set channel count (%s)\n", snd_strerror (err));
       exit (1);
     }
    
    For testing purpose use the ALSA arecrod utility to capture the data to a WAV file and verify the data using the audio analyzer tool.

    EVM#    arecord –f cd  -t wav  -c <num of channels to capture> <Audio file.wav> 

    Regards,
    Pavel
  • Pavel,

    But before I configure my audio driver I need to know how many channels are active in the source.

    So presently I am looking for a solution which can help me detect the number of active audio channels.
    Please let me know if there are any queries.

    Thanks,
    Krunal
  • Krunal,

    I do not see such option (dynamically detect anything from the source) listed in the TI81xx audio driver features. We have only Dynamic Audio Power Management (DAPM) support in the AIC3x codec driver.

    Regards,
    Pavel
  • Thanks for the responses. Please let me know if there are any ways by which this can be achieved.

    Thanks,
    Krunal