Skip to main content
rafael23
Associate II
May 13, 2013
Question

Playback PCM audio file

  • May 13, 2013
  • 5 replies
  • 1730 views
Posted on May 13, 2013 at 11:19

Hi,

I am trying to playback a file with short PCM data recorded at 8KHz, 16bits, mono. I have tryed to configure the I2S with ''I2S_Standard_PCMShort'' but I can�t hear any sound. I have made a file like the file ''audio_sample.c'' included into the example, with the hexadecimal information of my PCM audio file.

Should I do something that I have missed? How should I configure the ''Interface Ctl 1'' registry of the audio codec? I have configured it like for the Phillips standard (0x04), but I don�t know if there is something different between both standards regarding this registry.

Thanks in advance.

#rtfm
    This topic has been closed for replies.

    5 replies

    Andrew Neil
    Super User
    May 13, 2013
    Posted on May 13, 2013 at 14:27

    ''How should I configure the ''Interface Ctl 1'' registry of the audio codec?''

     

    You must configure it in accordance with whatever the documentation for the particular CODEC tells you.

    You haven't said what CODEC you're using - so it's impossible to be more precise!

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    Tesla DeLorean
    Guru
    May 13, 2013
    Posted on May 13, 2013 at 15:01

    Are you sure Mono is directly supported? I most case you have to map the sample to both channels.

    Philips has ONE L
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    rafael23
    rafael23Author
    Associate II
    May 14, 2013
    Posted on May 14, 2013 at 12:56

    Sorry, I forgot to say that my board uses a CS42L52 audio codec.

    Finally I got it work using the Phillips standard, but with a very low quality of the sound and a lot of background noise. I have made test with a pcm file recorded at 48KHz (and of course played it back also at 48KHz), and the results are the same. I think that this problem is because of the ''mono'' configuration of the file as you have said. Can you guide me how to map the samples to both channels? Do you mean to write each sample twice to get the same sample in both channels?

    Thanks for your help guys!

    rafael23
    rafael23Author
    Associate II
    May 14, 2013
    Posted on May 14, 2013 at 13:04

    deleted

    Tesla DeLorean
    Guru
    May 14, 2013
    Posted on May 14, 2013 at 16:33

    Can you guide me how to map the samples to both channels? Do you mean to write each sample twice to get the same sample in both channels?

    Yes, basically.

    [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Play%20mono%20on%20stereo%20channel&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=54]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FPlay%20mono%20on%20stereo%20channel&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=54
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..