cancel
Showing results for 
Search instead for 
Did you mean: 

Play mono on stereo channel

mailmail9116
Associate II
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
1 REPLY 1
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
Up vote any posts that you find helpful, it shows what's working..