Skip to content
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

Documentation, example(s), maybe a Discussion tab? #1

Open
Andy2No opened this issue Feb 22, 2022 · 2 comments
Open

Documentation, example(s), maybe a Discussion tab? #1

Andy2No opened this issue Feb 22, 2022 · 2 comments

Comments

@Andy2No
Copy link

Andy2No commented Feb 22, 2022

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?

@giampiero7
Copy link
Member

giampiero7 commented Feb 22, 2022

Hi Andy,
This repo is, hopefully, only a temporary solution for a more integrated one. I'm discussing about it here:
earlephilhower/arduino-pico#99

Actually this version too needs WS and SCK to be subsequent, it is enforced here:
https://github.com/sfera-labs/arduino-pico-i2s-audio/blob/master/src/machine_i2s.c#L678

Anyway, if you want to try it, here is some hints:

#include <I2S.h>

#define APP_BUFFER_SIZE 10000

I2SClass I2S;
uint8_t buff[APP_BUFFER_SIZE];

void setup() {
    I2S.setSCK(PIN_I2S_SCK);
    I2S.setWS(PIN_I2S_WS);
    I2S.setSD(PIN_I2S_SD);
    I2S.setBufferSize(40000);
    I2S.begin(I2S_MODE_MONO, 44100, 32);
}

void loop() {
    int ret = I2S.read(buff, APP_BUFFER_SIZE);
    if (ret < 0) {
      Serial.print("Microphone read error: ");
      Serial.println(ret);
      delay(1000);
      return;
    }
    Serial.print("Read ");
    Serial.print(ret);
    Serial.println(" bytes");
}

@Andy2No
Copy link
Author

Andy2No commented Feb 22, 2022

Thanks. I'll have a go at that soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants