Skip to main content
mailmail9116
Associate III
February 4, 2013
Question

Play mono on stereo channel

  • February 4, 2013
  • 1 reply
  • 666 views
Posted on February 04, 2013 at 16:29

Hi , as quoted from the audio implemination of stm32f4 eval :

Mono audio streaming is not supported (in order to play mono audio streams, each data should be sent twice <
br
>on the I2S or should be duplicated on the source buffer. Or convert the stream in stereo before playing).

I cannot find any example or explanation on how to do it,does anyone have any clue how can i implement it? I have mono files with frequency of 44100 ,and i want to play them with the same frequncey on stereo channel. Thanks Michael
    This topic has been closed for replies.

    1 reply

    Tesla DeLorean
    Guru
    February 4, 2013
    Posted on February 04, 2013 at 16:39

    // Duplicate the mono sample in both left and right channels
    int16_t m[100]; // 100 mono samples
    int16_t s[100 * 2]; // 100 stereo samples left/right channels interleaved
    int i;
    for(i=0; i<100; i++)
    s[(i << 1) + 0] = s[(i << 1) + 1] = m[i]; // left[i] = right[i] = mono[i]

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..