Page 6 of 6

Re: Megaphone example for ESP32-LYRATD-MSC

Posted: Tue Mar 12, 2019 7:48 am
by theronic
Hi BuddyCasino, I'm trying to get your megaphone example working on the ESP32-LYRATD-MSC, but I'm only getting silence. I've spent a few days trying to cross-correlate what's different in the get-started/player examples and the newer esp-avs-sdk, but I'm only getting silence. Do you perhaps have some pointers or code lying around for the LYRATD?
BuddyCasino wrote:
Thu Jul 13, 2017 11:25 am
You might want to take a look at my megaphone example.

Re: I2S microphone (RX)

Posted: Tue Mar 12, 2019 8:56 am
by BuddyCasino
Sorry no, I don't have a Lyra.

Re: I2S microphone (RX)

Posted: Tue Mar 12, 2019 4:14 pm
by fly135
felipeduque wrote:
Fri Feb 01, 2019 2:27 pm
Now, I've only managed to get perfect I2S sound for sampling rate 8 kHz. From my experience with other I2S drivers (for H3 boards), it's a matter of proper clock handling. Probably some I2S master clock is too slow - maybe it didn't expect any sampling faster than 8 kHz? Anyway, I did not delve into it.
Just for reference I've had no problems capturing at 16Khz. However, If you try to capture and send in the same thread I would expect to have performance issues.

I just ordered a LyraT from China. Expect to get it in a couple weeks.

John A

Re: I2S microphone (RX)

Posted: Fri Nov 15, 2019 7:25 am
by pataga

Just in case you guys didn't see this already ... microphone

It seems the SPH0645 timing is incompatible with the ESP32 i2s peripheral. The data transitions on the rising edge of BCK, just when the ESP32 is sampling the data.

They ended the post by saying the INMP441 mems mic is compatible with the ESP32, showing a captured data sample, here the BCK rising edge is safely in the middle of the sample data.

I just got an INMP441 breakout board from aliexpress, and can confirm BuddyCasino's megaphone code example in this thread works without any modification. INMP441 LRCK grounded for left channel only. I used a MAX98357a breakout board for output with default board settings : SD and gain pins floating, (L+R)/2 output.

But I need to record mic samples myself to see what sort of dynamic range I am getting.

Re: I2S microphone (RX)

Posted: Wed Jan 01, 2020 1:15 pm
by Tnarain5
Thanks all for your support!

Re: I2S microphone (RX)

Posted: Mon Feb 10, 2020 7:24 am
by Tnarain5
Hi guys,
i tried reading and writing at the same time using two different i2s_config, (using as an amplifier) for output im having real_rate 502 and required rate 8000 causing echo and noise, can you help !!

Re: I2S microphone (RX)

Posted: Thu Dec 31, 2020 4:25 am
by sapparatus
I follow this instruction and I can record the sound and write as WAV file to SD and put it on another machine to playback (sort of), except one problem - that I think it may have nothing to do with ESP32 and just general question.

sph0645 is connected with i2s initialization. so I read buf with:

i2s_read(I2S_NUM_0, buf, buf_len, &bytes_read, portMAX_DELAY);

since the data in buf is int32_t, and the 18 bit precise, I thought I can just do:
  1.                         for (int i = 0; i < buf_len ; i++)
  2.                         {
  3.                       [Codebox=text file=Untitled.txt]
int32_t tmpdata = buf;
tmpdata >>= 14;
((int16_t*) buf) = tmpdata;
Then I thought the result buf[buf_len] would be 16bit after shifting 14bit and lost 2bit, with total of buf_len (same data size as original). It turns out this is only half is right, meaning if
(1) I write buf[ buf_len / 2 ], the data is good, except it is only half size - so every sound is faster (or drop off half).
(2) if I write entire buf[buf_len], then half of them is still correct as in (1), but the other half, is the same data repeat buf_len/2 times:
[good] [bad] [good] [bad]....

In addition, the data seems to be offset on the negative side even though it seems have no affect on the results.

I am reading google but have hard time to understand this - one thing particularly bothers me is why 1, 2, 3, ....buf_len/2, which does not match [good][bad][good][bad]..., not 1, 3, 5, ...buf_len