Skip to main content
Visitor II
February 25, 2022
Question

Audio play different bitrate test

  • February 25, 2022
  • 5 replies
  • 4817 views

i am using gst-play-1.0 for testing different bitrate audio play, found that 44.1 kbps, 22.050 kbps were not working but 48kbps mp3 works neatly without noise

Please let me know if i miss anything, i am using I2S1 to derive the base MCLK and feed to codec

log:

gst-play-1.0  /run/media/mmcblk0p1/AudioFiles/test.wav 

playing 22.05kbps--- (256*22.05k) = 5644800

Press 'k' to see a list of keyboard shortcuts.

Now playing /run/media/sda1/AudioFiles/BabyElephantWalk60.wav

[ 1164.185749] st,stm32-i2s 44004000.audio-controller: Error -16 setting i2sclk parent clock 5644800

playing 44.1kbps--- (256*44.1k) = 11289600

Now playing /run/media/sda1/AudioFiles/Railroad.mp3

[ 1523.259773] st,stm32-i2s 44004000.audio-controller: Error -16 setting i2sclk parent clock 11289600 -309581440 -309581312

[ 1523.269268] asoc-audio-graph-card sound@0: ASoC: machine hw_params failed: -16

ERROR Could not get/set settings from/on resource. for file:///run/media/sda1/AudioFiles/Railroad.mp3

ERROR debug information: ../../../gst-plugins-base-1.14.4/ext/alsa/gstalsasink.c(617): set_hwparams (): /GstPlayBin:playbin/GstPlaySink:playsink/GstBin:abin/GstBin:bin0/GstAlsaSink:alsasink0:

Unable to set hw params for playback: Device or resource busy

Reached end of play list.

    This topic has been closed for replies.

    5 replies

    Ara.1Author
    Visitor II
    February 25, 2022

    Hi any one came across this ?

    Ara.1Author
    Visitor II
    March 2, 2022

    Hi Any body can able to test from eval board ?

    Ara.1Author
    Visitor II
    March 2, 2022

    44.1kbs file

    Ara.1Author
    Visitor II
    March 2, 2022

    22 kbps

    Technical Moderator
    March 3, 2022

    Hello @Ara.1​ ,

    Thank you for the files.

    On my side, the two files are working well with the stm32mp157f-dk2 and a headset plugged on the jack plug.

    I am using the internal codec with the starter package v3.1.

    root@stm32mp1:~# gst-play-1.0 /usr/local/Test_44100.mp3 
    Press 'k' to see a list of keyboard shortcuts.
    Now playing /usr/local/Test_44100.mp3
    Redistribute latency...
    0:02:00.5 / 0:05:40.9 
    root@stm32mp1:~# gst-play-1.0 /usr/local/Test_22050.mp3 
    Press 'k' to see a list of keyboard shortcuts.
    Now playing /usr/local/Test_22050.mp3
    Redistribute latency...
    0:00:05.1 / 0:00:05.1 
    Reached end of play list.
     

    In your log, you have a lot of error that I didn't have. I think it can explains your errors.

    -------------

    Which version of ecosystem do you use?

    Can I have your DTS file and the complete boot log of your board please?

    Regards,

    Kevin

    Ara.1Author
    Visitor II
    March 3, 2022

    Hi Kevin,

    Thanks for replay

    i do see two audio interface

    SAI

    I2S2

    as per board you mentioned,

    in command line can you run following command:

    root@stm32mp1:~# aplay -l

    may you try play gstplay with specific HW or instance where I2S2 runs

     root@stm32mp1:~# speaker-test --device hw:0,2 --rate 44100 --channels 2 --format S16_LE --test wav

    Technical Moderator
    March 10, 2022

    Hello @Ara.1​ ,

    I am now on a board 157C-DK2 and it works well. Below the results of the two commands that you asked for:

    root@stm32mp1:~# aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: STM32MP15DK [STM32MP15-DK], device 0: 4400b004.audio-controller-cs42l51-hifi cs42l51-hifi-0 [4400b004.audio-controller-cs42l51-hifi cs42l51-hifi-0]
     Subdevices: 1/1
     Subdevice #0: subdevice #0
    card 0: STM32MP15DK [STM32MP15-DK], device 2: 4000b000.audio-controller-i2s-hifi i2s-hifi-2 [4000b000.audio-controller-i2s-hifi i2s-hifi-2]
     Subdevices: 1/1
     Subdevice #0: subdevice #0
    root@stm32mp1:~# speaker-test --device hw:0,2 --rate 44100 --channels 2 --format S16_LE --test wav
     
    speaker-test 1.2.1
     
    Playback device is hw:0,2
    Stream parameters are 44100Hz, S16_LE, 2 channels
    WAV file(s)
    Rate set to 44100Hz (requested 44100Hz)
    Buffer size range from 512 to 8192
    Period size range from 256 to 4096
    Using max buffer size 8192
    Periods = 4
    was set period_size = 2048
    was set buffer_size = 8192
    Sample rate doesn't match (48000) for /usr/share/sounds/alsa/Front_Left.wav
    root@stm32mp1:~# speaker-test --device hw:0,2 --rate 48000 --channels 2 --format S16_LE --test wav
     
    speaker-test 1.2.1
     
    Playback device is hw:0,2
    Stream parameters are 48000Hz, S16_LE, 2 channels
    WAV file(s)
    Rate set to 48000Hz (requested 48000Hz)
    Buffer size range from 512 to 8192
    Period size range from 256 to 4096
    Using max buffer size 8192
    Periods = 4
    was set period_size = 2048
    was set buffer_size = 8192
     0 - Front Left
     1 - Front Right
    Time per period = 2.863147
     0 - Front Left
     1 - Front Right

    -------------------------------------

    Please can you answer to these questions:

    • Which version of ecosystem do you use? (Version of linux)
    • Can I have your DTB file and the complete boot log of your board please?
    Please let me know if i miss anything, i am using I2S1 to derive the base MCLK and feed to codec

    Which kind of board are you using please? I saw in other topics that you were using a custom board, but is it the case here?

    And can you please also send me the traces of the command:

    root@stm32mp1:~# aplay -l

    and:

    root@stm32mp1:~# pactl list cards

    Regards,

    Kévin

    Ara.1Author
    Visitor II
    March 25, 2022

    i have the stm32m157C-DK2 board now, i too seen all the bit rates are working, but the mclk is floating , i did a grep on mclk on /sys/debug/clk_summary i do not see any spix_mclk getting created, whic means that i2s2 is slave, and codec is master in the HDMI I2S2,

    please correct me if am wrong

    Technical Moderator
    April 19, 2022

    Hello @Ara.1​ ,

    As already asked twice I will need your DTS file and your complete DTB to help you.

    Can you send me your complete bootlog too please?

    I modified my DTS of the DK2 to have the codec CS42L51 as a consumer of SAI2A master clock and it works also.

    I would like to have your DTS and DTB as asked above to reproduce a configuration like yours with the i2s2 that feed the codec and reproduce the problem.

    In your first log, you had a lot of error i2sclk that looks like error of configuration in the DTS.

    Regards,

    Kevin