I2S microphone (RX)

meetri
Posts: 4
Joined: Tue May 30, 2017 8:10 am

Re: I2S microphone (RX)

Postby meetri » Mon Jun 05, 2017 11:18 pm

i'm ordering a couple ICS-43434 now, thanks for the tip BuddyCasino,

As for I2S_COMM_FORMAT_RAW_I2S flag, ??? sorry about that, I blame it on blurry vision and lack of sleep. I intended to write "I2S_COMM_FORMAT_I2S"

onehorse
Posts: 70
Joined: Mon Feb 15, 2016 1:35 am

Re: I2S microphone (RX)

Postby onehorse » Wed Jun 07, 2017 3:48 am

Just FYI, I am having a production run of ICS43434 microphones made and these will be available on Tindie in a few weeks. In the meantime I have a supply of about a dozen hand-assembled ones.

Is there some way to make use of the ICS43434 and this I2S audio coding in the Arduino IDE?

BuddyCasino
Posts: 263
Joined: Sun Jun 19, 2016 12:00 am

Re: I2S microphone (RX)

Postby BuddyCasino » Wed Jun 07, 2017 5:48 am

Looks like someone has got his Google Alerts setup properly.
Is there some way to make use of the ICS43434 and this I2S audio coding in the Arduino IDE?
I don't use Arduino, so I have no idea. Using the ESP-IDF is not hard though.

onehorse
Posts: 70
Joined: Mon Feb 15, 2016 1:35 am

Re: I2S microphone (RX)

Postby onehorse » Thu Jun 08, 2017 1:56 am

It is for dummy users like me!

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: I2S microphone (RX)

Postby rudi ;-) » Thu Jun 08, 2017 2:32 am

onehorse wrote:It is for dummy users like me!
i miss your smilie :)



other language - other need :)
sometimes very complex - sometime very easy

no there is nothing wrong with arduino -
only some guys have no contact to arduino - ( i am too )

i am self prog not directly in arduino
but prog for arduino libs ...
and sure - you can use the code from buddy_casino in arduino too - ( I2S )

how you develop arduino?
do you use ESP32-Arduino IDE ?
then it is very easy to do this.

use arduino ide?
then you need smal steps to run buddy_casino's code
but this is, cause the hardware must be update in the IDE to esp32...

tell how you do your programming.
and your code runs on weekend for you

;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: I2S microphone (RX)

Postby rudi ;-) » Thu Jun 08, 2017 2:38 am

onehorse wrote:Just FYI, I am having a production run of ICS43434 microphones made and these will be available on Tindie in a few weeks. In the meantime I have a supply of about a dozen hand-assembled ones.

Is there some way to make use of the ICS43434 and this I2S audio coding in the Arduino IDE?
ah ;-) how is the commission :)
fun :)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
andriy
Posts: 11
Joined: Mon Dec 07, 2015 9:14 pm

Re: I2S microphone (RX)

Postby andriy » Thu Jul 13, 2017 3:46 am

Guys,

Anyone made it to create a simple recording functionality with discussed I2S mics?
Tried to store the bytes read from the mic and store as they are, apparently I can not do playback well. The result playback somehow is too fast.

Thanks for any ideas and directions.

BuddyCasino
Posts: 263
Joined: Sun Jun 19, 2016 12:00 am

Re: I2S microphone (RX)

Postby BuddyCasino » Thu Jul 13, 2017 11:25 am

andriy wrote:The result playback somehow is too fast.
If you used the same sample rate and bit depth for recording and playback, it may be because of mono / stereo issues. You might want to take a look at my megaphone example.

nic_ru
Posts: 2
Joined: Tue Aug 29, 2017 3:58 pm

Re: I2S microphone (RX)

Postby nic_ru » Tue Aug 29, 2017 4:32 pm

Hi all!
I'm trying to store in a buffer array (with no luck) the voice captured from my I2S mic (https://www.adafruit.com/product/3421) in order to execute a speech to text recognition on my server. I wrote some code (after reading your comments) but I'm probably missing something because the audio file stored on the cloud is basically "empty".

This is my code (I'm a super beginner in this world):

Code: Select all

#include "driver/i2s.h"
#define SAMPLES 128 // make it a power of two for best DMA performance
#define SPEECH_BUFFER_SIZE 40960
uint32_t speech_buffer[SPEECH_BUFFER_SIZE];
int last_position_written = 0;

void i2s_config() {
  // input
  i2s_config_t i2s_in_config = {
mode: (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX),
    sample_rate: 16000,
bits_per_sample: (i2s_bits_per_sample_t)32,
channel_format: I2S_CHANNEL_FMT_RIGHT_LEFT,
communication_format: (i2s_comm_format_t)(I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB),
intr_alloc_flags: ESP_INTR_FLAG_LEVEL1,
    dma_buf_count: 14,
    dma_buf_len: 64
  };
  i2s_pin_config_t i2s_in_pin_config = {
    bck_io_num: 16,
    ws_io_num: 4,
data_out_num: -1, //Not used
    data_in_num: 17
  };

  pinMode(17, INPUT);
  pinMode(16, OUTPUT);
  pinMode(4, OUTPUT);

  i2s_driver_install((i2s_port_t)0, &i2s_in_config, 0, NULL);
  i2s_set_pin((i2s_port_t)0, &i2s_in_pin_config);
}

void setup()
{
  Serial.begin(115200);
  delay(4000);

  i2s_config();
}

void loop()
{
//get sample from mic
  for (int i = 0; i < SAMPLES; i++) {
    int sample = 0;
    uint32_t sample_val[2] = {0, 0};
    bytes_read += i2s_pop_sample((i2s_port_t)0, (char *)sample_val, portMAX_DELAY);
    samples_for_buffer[i] = (sample_val[0] << 5);
  }
  merge_buffer(samples_for_buffer);
}

void merge_buffer(uint32_t samples_for_buffer[]) {
//if the buffer reach the max size send it to the cloud
....
//else merge buffer
  for (int j = 0; j < SAMPLES; j++) {
    speech_buffer[last_position_written] = samples_for_buffer[j];
    last_position_written++;
  }
}
Any ideas?

Thank you!

mgleason_3
Posts: 44
Joined: Mon Nov 07, 2016 5:04 pm

Re: I2S microphone (RX)

Postby mgleason_3 » Thu Aug 31, 2017 12:10 am

BuddyCasino wrote:... You might want to take a look at my megaphone example.
Where can we find your megaphone example?

*** EDIT - Found it on page two of this discussion here: https://esp32.com/viewtopic.php?f=13&t= ... t=10#p9283

Who is online

Users browsing this forum: fallafenflufen and 139 guests