Clarification on I2S library #1450
-
Hi, 1. get bytes/Samples/words available for write
But from looking at the code it looks to me like it returns the amount of 32-bit chunks that can be written. 2. Transfer buffer to I2S
It looks like it only transfers the lower [bitsPerSample]-Bits per 32-bit chunk. For example, if I'm using 16 bits per sample and my buffer looks like this, it would do this:
Is that correct? To properly write my buffer to I2S I could: 3. Return values for write methods return size_t but they actually only return 1 on success, 0 on fail.
Thank you so much for this making this library and the entire arduino-pico core. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Yes, this is a known bug. It's a little more complicated than "multiply by 4 and then divide by 2*samplewidth" because you could read out the L but not R sample so you need to look at the leftover bits. It's a lot of housekeeping, but not really complicated. Most users have
This should be sending 32 bit chunks (including L and R samples when at 16b, for example). If not, that's obviously something that needs to be fixed: arduino-pico/libraries/I2S/src/I2S.cpp Lines 383 to 393 in a851a92
Yes, kind of like
This was intended to be like other |
Beta Was this translation helpful? Give feedback.
Yes, this is a known bug. It's a little more complicated than "multiply by 4 and then divide by 2*samplewidth" because you could read out the L but not R sample so you need to look at the leftover bits. It's a lot of h…