Output of the decoder are pcm samples. if your input is 16-bit stereo 44100Hz, then each frame is 16 bit*2 channels = 4 bytes, each second is 44100 * 4 bytes. Skip as many output bytes as you need until start of the desired part, then dump 44100 * 4 * 40 bytes for 40 your seconds. You can even do mixing to mono and then cutting to 8-bit as you go.
Audacity can produce a stereo mp3 with a sample rate of 44100Hz and a bit rate of 64Kbps*, without forcing a downgrade in the sample rate to 24000Hz, e.g. attached with it’s media info, (note no mention of “bit depth” in media info, only “bit rate”). Media Info on 'Test 44100Hz 64Kbps stereo mp3.mp3'.png 544×629 11.1 KB.
Step 6. Click on the list menu adjacent to the heading "Attributes." Select either 8-bit stereo or 8-bit mono. Click the "Save" button, and your WAV file will be saved at a sampling rate of 8,000 hertz (8kHz). Advertisement. 8-bit mono 16-bit mono 24-bit mono 32-bit mono (or something completely different). You will need to make your code look at the file's header bytes, in order to determine what kind of format it is. If, for example, the file is a 16-bit stereo, and you find the data in the file, you should be able to read them and directly feed them to the I2S pliGAw. 755 19 471 798 45 199 974 312

convert mp3 to wav mono 16 bit