-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What's the 24bit audio data structure read through "i2s_channel_read"? (IDFGH-15033) #15721
Comments
According to the INMP441's datasheet, it outputs 24-bit, 'left-aligned' data in big-endian order. (Delayed by 1 SCK clock.)
|
It doesn't work, real data is always 0 (I print buff[i], it always 0, so it must be the LSB because of left aligned, then only buff[i+1] buff[i+2] buff[i+3] can be used), but I try another way seems work, the wave looks normal and can detect voice, I couldn't explain:
Although it seems well, but when I send buff to MAX98357A to play, there's only noice, can't play my voice... |
If the data is already in little-endian format in the buffer, this should be a lot faster:
(Your last code mixes up read_data_buff[i + 2] and read_data_buff[i + 3] (MSB).) |
Answers checklist.
General issue report
BOARD:
esp32-wroom-32
SDK-VERSION:
v5.2
QUESTION:
I use ESP32 to read audio data of INMP441 mono, which data is 24bit, but when I draw the results by SerialPlot, it's weird. So I'd like to know what the 24bit audio data structure is?
This is how I restored the data:
// according to esp32 document, data left aligned by 32bit, so I dropped buff[0], and reverse buffer[1][2][3] to get correct 24bit data
int32_t real_data = (read_data_buff[i + 1]) | (read_data_buff[i + 2] << 8) | (read_data_buff[i + 3] << 16);
CODE:
SerialPlot:
The text was updated successfully, but these errors were encountered: