Skip to content

Automatic silence generation when I2S input clock/ws stops #1324

Closed Answered by pschatzmann
jamesbaber asked this question in Q&A
Discussion options

You must be logged in to vote

To keep things simple, I am using blocking reads and writes for I2S and just provide a fixed value as result for available() and availableForWrite(). The ESP32 API does not provide any functionality to read the available bytes in the buffer.

I don't see any easy, portable way to resolve this: But you can try to use the following approach:

  • I have added the methods setWaitTimeReadMs and setWaitTimeWriteMs to the I2S driver. So you can e.g. call i2s.driver()->setWaitTimeReadMs(value) to limit the wait time for the read or write methods (so they will not be blocking any more).
  • Implement you own input stream wrapper class, e.g. based on the CallbackStream where you just return silence when th…

Replies: 4 comments 13 replies

Comment options

You must be logged in to vote
3 replies
@pschatzmann
Comment options

@jamesbaber
Comment options

@pschatzmann
Comment options

Answer selected by pschatzmann
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
9 replies
@pschatzmann
Comment options

@jamesbaber
Comment options

@pschatzmann
Comment options

@jamesbaber
Comment options

@pschatzmann
Comment options

Comment options

You must be logged in to vote
1 reply
@jamesbaber
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants