sfera-labs / arduino-pico-i2s-audio Goto Github PK
View Code? Open in Web Editor NEWI2S digital audio input Arduino library for the Raspberry Pi Pico RP2040
I2S digital audio input Arduino library for the Raspberry Pi Pico RP2040
Will you be adding a readme to the code page, and ideally an example or two, as with other Arduino libraries? I'm not entirely clear how to try this out, without them.
This probably should have been on a Discussion thread, rather than in an issue, but there currently isn't a Discussion page. Maybe worth adding one?
I'm intrigued to see that you can set the three I2S pins separately, as opposed to the standard arduino-pico I2S (16 bit out only), where two of them have to be adjacent, so you only get to set two. Can all three be on any GPIO pin, in this version? Does that place any limitations on the use of PIO functions on other pins, e.g. adjacent ones?
Hello,
I bought a WM8782 module on audiophonics.
I would like to use it to make an USB dual guitar recorder thanks to the rp pico, but I don't realy understand how to use the i2s lib with the master clock. Is it possible to do ? do you have some advice ?
Hi,
I'm also working on the I2S of RP2040. But I can not find suitable Arduino library until find yours. Do you have any plan to add TX for full duplex? And if possible, I advise to use interrupt to detect the data transformation with callback register api for upper layer. Thanks.
This one's a doozy.
I use your (great!) machine_i2s.c
with the C-SDK like this:
#include "pico/stdlib.h"
#include "machine_i2s.c"
#define SCK 3
#define WS 4 // needs to be SCK +1
#define SD 29
#define BPS 32 // 24 is not valid in this implementation, but INMP441 outputs 24 bits samples
#define RATE 16000
int main() {
stdio_init_all();
machine_i2s_obj_t* i2s0 = machine_i2s_make_new(0, SCK, WS, SD, RX, BPS, STEREO, /*ringbuf_len*/SIZEOF_DMA_BUFFER_IN_BYTES, RATE);
int32_t buffer[I2S_RX_FRAME_SIZE_IN_BYTES /4];
while (true) {
machine_i2s_stream_read(i2s0, (void*)&buffer[0], I2S_RX_FRAME_SIZE_IN_BYTES);
printf("%.6x %.6x\n", buffer[0], buffer[1]);
}
}
but I don't get any samples out without the most peculiar change:
if I add on https://github.com/sfera-labs/arduino-pico-i2s-audio/blob/master/src/machine_i2s.c#L232 the following:
printf("%d %d\n", rbuf->head,rbuf->tail);
it suddenly starts spewing out correct frames! So it seems to me that the printf
statement somehow materializes the head
and tail
values, but my knowledge of the pico and or C is not nearly enough to start to understand this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.