- #define I2S_READLEN 200
- float i2s_buffer_read[I2S_READLEN];
- float i2s_buffer_write[I2S_READLEN];
- while (true) {
- i2s_bytes_read = I2S_READLEN;
- i2s_read(I2S_NUM, i2s_buffer_read, I2S_READLEN, &i2s_bytes_read, 100);
- /* left channel filter */
- for (uint32_t i = 0; i < i2s_bytes_read / 2; i += 2)
- {
- printf("L: %f\n", i2s_buffer_read[i]);
- }
- }
打印的内容如下:
- L: -nan
L: -nan
L: -nan
L: -nan
L: -nan
L: -nan
L: -nan
L: -nan
L: 0.000000
L: 0.000000
L: -0.000000
L: 1.965756
L: 1.960534
L: 0.000000
L: -0.000000
L: 1.965756
L: 0.000000
L: 0.000000
L: -0.000000
L: 1.965756
L: 1.960534
L: 0.753641
L: -0.000000