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.

EVMK2G: Increasing the playback sample rate on Default Audio Device

Part Number: EVMK2G

It seems that my maximum playback sample rate using 'aplay' is 192000.

root@k2g-evm:~# aplay -Ddefault:K2GEVM 192000.wav
Playing WAVE '192000.wav' : Signed 16 bit Little Endian, Rate 192000 Hz, Mono

Is there any way I can increase this?  Kernel modification/rebuild?

Thanks,

Mike

  • Hi Mike,

    I am looking into this.
    Could you share which linux SDK are you using?

    Best Regards,
    YOrdan
  • Thanks for your response.

    I'm using ti-processor-sdk-linux-rt-k2g-evm-04.01.00.06.

    Would the TI-RTOS be more appropriate?

    Regards,

    Mike

  • Hi Mike,

    By default the sample rate should be adaptable to the file you're playing. In other words it should be set to be the same as the sample rate of the original file.

    There are some options to modify the sample rate, without recompiling the kernel. Try:
    1. in /etc/asound.conf add
    pcm.device{
    format S24_LE
    rate 96000
    type hw
    card 0
    device 0
    }

    2. in /etc/pulse/daemon.conf edit:
    ; default-sample-rate

    For further info on audio implementation in ti kernel, refer to this wiki:
    processors.wiki.ti.com/.../Sitara_Linux_Audio_DAC_Example


    Best Regards,
    Yordan
  • Hi Yordan,

    I'm trying to get more than 192000 samples per second out of aplay on my K2G-EVM board. If I try to play a WAV file at a faster rate, it bombs, that is:

    root@k2g-evm:~# aplay -Dplughw:0,0 384000.wav
    Playing WAVE '384000.wav' : Signed 16 bit Little Endian, Rate 384000 Hz, Mono
    aplay: set_params:1305: Unable to install hw params:
    ACCESS: RW_INTERLEAVED
    FORMAT: S16_LE
    SUBFORMAT: STD
    SAMPLE_BITS: 16
    FRAME_BITS: 16
    CHANNELS: 1
    RATE: NONE
    PERIOD_TIME: (92879 92880)
    PERIOD_SIZE: (35665 35666)
    PERIOD_BYTES: (71330 71332)
    PERIODS: (3 5)
    BUFFER_TIME: (371518 371519)
    BUFFER_SIZE: 142663
    BUFFER_BYTES: 285326
    TICK_TIME: 0

    I tried your suggestions 1. and 2. with results identical to the above output.

    Your processors.wiki.ti.com/.../Sitara_Linux_Audio_DAC_Example may work, but I haven't tried it yet.

    Other ideas are appreciated.

    Mike
  • Hi Mike,
    Let me see what I can find about this.

    Best Regards,
    Yordan
  • Hi Mike,

    Here is what I found. As I said the sample rate is set dynamically depending on the file that is being played, and according to the sample rate of that original file. However the kernel driver is configured to choose between these frequencies:
    static const unsigned int davinci_mcasp_dai_rates[] = {
    8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000,
    88200, 96000, 176400, 192000,
    };

    You can see that 192000 is the highest sample rate supported. Can you try to add 384000? Test to see if the McASP can support this higher sample rate. I am not that well familiar with the mcasp in k2g, I need to dig in the documentation to confirm, so the quickest way to verify this is to try it on the hw.

    Best Regards,
    Yordan
  • Thanks Yordan.

    I looked at davinci_mcasp_dai_rates[] in davinci-mcasp.c.  There are some obvious places where 384000 could be easily added and some other places where changes are probably required, but it's not obvious to me how to do it.

    I think more insight into the mcasp is needed, as you pointed out.

    By the way, I found some discussion of a kernel patch to ALSA sound cards:

    I presume a mcasp approach would be more efficient and expandable.

    Regards,

    Mike

  • Mike,

    I can't find a 384 kHz wav file to work with. Could you attache your test file here in the forum?

    Best Regards,
    Yordan
  • Hi,

    I haven't heard back. Is this issue resolved? If yes, I will close the thread for now.

    Best Regards,
    Yordan
  • Sorry, I've been out of the office. I sent you a 384000 Hz WAV file.

    Good luck!

    Mike
  • Hi,

    I tested this and it doesn't work.
    This only confirms what I've found in the TRM (section 11.9.1 McASP Overview):
    • Two independent clock generator modules for transmit and receive
    – Clocking flexibility allows the McASP to receive and transmit at different rates. For example, the
    McASP can receive data at 48 kHz but output up-sampled data at 96 kHz or 192 kHz.

    It seems that the McASP functional clock is not enough to support 384 kHz sample rate.

    Best Regards,
    Yordan