-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Bidirectional I2S #9909
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
base: main
Are you sure you want to change the base?
Bidirectional I2S #9909
Conversation
…load when bidirectional.
I've located a new bug. When using a buffer size on import board
import audiobusio
import audiomixer
codec = audiobusio.I2S(
bit_clock=board.GP0,
word_select=board.GP1,
data_in=board.GP2,
data_out=board.GP3,
sample_rate=22050,
buffer_size=1024,
)
mixer = audiomixer.Mixer(
voice_count=1,
sample_rate=22050,
buffer_size=512,
)
codec.play(mixer)
mixer.play(codec) |
Was this the PR you were looking at some help to get past some technical hurdles? I think I may have time to help if you wanted me to poke at this as well. I will have to get some hardware that can do I2S input still. |
There have been a couple of changes to audio dma recently. I likely need to revise a lot of this before pushing for a review. I also think the recent changes to garbage collection may improve this feature and was likely why the performance was unacceptable in the first place. As for compatible hardware, there are a few options:
|
New class,
audiobusio.I2S
, which can be used to both record and playback audio over a unified I2S bus (single pair of bit clock and word select pins).Notes:
audiobusio.I2SOut
except that data pin direction needs to be specified in keyword, ie:data_out=..., data_in=...
.Comments:
audiobusio_i2s_get_buffer
.RUN_BACKGROUND_TASKS
when using the bus as an input only while waiting for the incoming buffer. When the bus is operating bidirectionally, it waits with a sample-length sleep loop. There is likely a better solution out there.audiobusio.I2SIn
that I was testing with initially. I plan on removing this class before marking the PR as ready.Todo:
record
method (or similar) to get current input buffer. Could be useful for monitoring input level.