Re: ESP32 I2S audio recording is incomplete

2023-10-26 Thread Simona Toaca
Yes, ESP32_PSRAM_8M is enabled.

Regards,
Simona

În joi, 26 oct. 2023 la 16:55, Alan C. Assis  a scris:

> Hi Simona,
>
> On 10/26/23, Simona Toaca  wrote:
> > Hello,
> >
> > I want to make sure that I understood this correctly, you're saying that
> > the I2S audio saved to an SDCard (via SPI) on Lyra T is working ok?
> >
>
> I think that is true. Maybe Lucas can confirm if he was saving in the
> SDCard.
>
> > Also, I tried creating a ramdisk of 1mb+ for testing, but I did not find
> a
> > way do to so.
> > For example,
> > mkrd 1024 lends the error: mkrd: boardctl(BOARDIOC_MKRD) failed: 1
> > but
> > mkrd -s 1024 128 or mkrd 64 work fine
> >
> > The max I succeeded in allocating is 128kb.
> >
>
> Hmm, did you enable PSRAM to get more available RAM?
>
> BR,
>
> Alan
>


Re: ESP32 I2S audio recording is incomplete

2023-10-26 Thread Simona Toaca
Hello,

I want to make sure that I understood this correctly, you're saying that
the I2S audio saved to an SDCard (via SPI) on Lyra T is working ok?

Also, I tried creating a ramdisk of 1mb+ for testing, but I did not find a
way do to so.
For example,
mkrd 1024 lends the error: mkrd: boardctl(BOARDIOC_MKRD) failed: 1
but
mkrd -s 1024 128 or mkrd 64 work fine

The max I succeeded in allocating is 128kb.

Regards,
Simona


În vin., 20 oct. 2023 la 16:35, Alan C. Assis  a scris:

> Hi Simon,
>
> Lucas just confirmed that it was working fine on Lyra T with ES8388 Audio
> Codec.
>
> I think she is using SDCard over SPI (even slower).
>
> There is not SDCard interface support for ESP32 on NuttX yet (the
> SDCard uses/shares I2S interface).
>
> The ESP32 MCU has 2 I2S interfaces, so in theory one can be used for
> Audio and other for SDCard.
>
> The ESP32-S2 has only 1 I2S interface, so I don't know if it will work
> well.
>
> Hopefully ESP32-S3 has 2 I2S as ESP32.
>
> BR,
>
> Alan
>
> On 10/20/23, Simon Filgis  wrote:
> > Hi Simona,
> >
> > SD Cards have busy time times of 500ms max (per spec) for saving data
> > internally. I saw SD Cards taking over a second of busy time.
> >
> > You can check with the Oszilloskop. I think data0 is the pin that
> signalize
> > busy...
> >
> > Per design, you need a stream buffer that can handle your audio stream up
> > to 500ms...
> >
> > Regards,
> >
> > Simon
> >
> > --
> > Ingenieurbüro-Filgis
> > USt-IdNr.: DE305343278
> > --
> > sent by mobile phone
> >
> > Alan C. Assis  schrieb am Do., 19. Okt. 2023, 23:36:
> >
> >> Hi Simona,
> >>
> >> On 10/19/23, Simona Toaca  wrote:
> >> > Hello,
> >> > I am trying to record audio using a MEMS microphone, but the final
> >> > recording is missing parts periodically (for example, with a sample
> >> > rate
> >> of
> >> > 8kHz, there are parts ~1s long missing once every ~10-11s. Using a
> >> > sample
> >> > rate of 48kHz, the period is ~1s long). This is my first time working
> >> with
> >> > I2S and I can't figure out what causes this behaviour.
> >> >
> >> > My setup is as follows:
> >> > - the microphone has 24-bit depth in a 32-bit word (MSB first) when
> >> > transmitting data
> >> > - i am using nxrecorder to record the pcm audio onto an SD card
> (device
> >> > pcm_in0)
> >> > - to listen to the recording i import the file into Audacity (24-bit,
> >> > Big
> >> > Endian)
> >> >
> >> > Defconfig regarding audio:
> >> > CONFIG_AUDIO=y
> >> > CONFIG_AUDIO_BUFFER_NUMBYTES=6144 (from the i2s buffer which is 8192
> >> bytes,
> >> > 3/4 of it is "useful" info, 6144 bytes in total)
> >> > CONFIG_AUDIO_DMA=y
> >> > CONFIG_AUDIO_FORMAT_RAW=y
> >> > CONFIG_AUDIO_I2S=y
> >> > CONFIG_DMA=y
> >> > CONFIG_DMA_LINK=y
> >> > CONFIG_DRIVERS_AUDIO=y
> >> > CONFIG_ESP32_I2S0=y
> >> > CONFIG_ESP32_I2S0_BCLKPIN=25
> >> > CONFIG_ESP32_I2S0_DATA_BIT_WIDTH_24BIT=y
> >> > CONFIG_ESP32_I2S0_DINPIN=26
> >> > CONFIG_ESP32_I2S0_SAMPLE_RATE=8000
> >> > CONFIG_ESP32_I2S0_WSPIN=27
> >> > CONFIG_ESP32_I2S=y
> >> > CONFIG_I2S_DMADESC_NUM=4
> >> >
> >> > I tried modifying the number of audio buffers and also making them
> >> bigger,
> >> > but that did not solve the problem.
> >> > Any ideas on what could cause this?
> >> >
> >>
> >> Could it be something related to SDCard storage? Maybe it needs some
> >> optimization!
> >>
> >> Please try using a RAMDISK of 1MB+ and save the file to it.
> >>
> >> If it works we will know the SDCard could be the limitation of this
> >> configuration.
> >>
> >> BR,
> >>
> >> Alan
> >>
> >
>


ESP32 I2S audio recording is incomplete

2023-10-19 Thread Simona Toaca
Hello,
I am trying to record audio using a MEMS microphone, but the final
recording is missing parts periodically (for example, with a sample rate of
8kHz, there are parts ~1s long missing once every ~10-11s. Using a sample
rate of 48kHz, the period is ~1s long). This is my first time working with
I2S and I can't figure out what causes this behaviour.

My setup is as follows:
- the microphone has 24-bit depth in a 32-bit word (MSB first) when
transmitting data
- i am using nxrecorder to record the pcm audio onto an SD card (device
pcm_in0)
- to listen to the recording i import the file into Audacity (24-bit, Big
Endian)

Defconfig regarding audio:
CONFIG_AUDIO=y
CONFIG_AUDIO_BUFFER_NUMBYTES=6144 (from the i2s buffer which is 8192 bytes,
3/4 of it is "useful" info, 6144 bytes in total)
CONFIG_AUDIO_DMA=y
CONFIG_AUDIO_FORMAT_RAW=y
CONFIG_AUDIO_I2S=y
CONFIG_DMA=y
CONFIG_DMA_LINK=y
CONFIG_DRIVERS_AUDIO=y
CONFIG_ESP32_I2S0=y
CONFIG_ESP32_I2S0_BCLKPIN=25
CONFIG_ESP32_I2S0_DATA_BIT_WIDTH_24BIT=y
CONFIG_ESP32_I2S0_DINPIN=26
CONFIG_ESP32_I2S0_SAMPLE_RATE=8000
CONFIG_ESP32_I2S0_WSPIN=27
CONFIG_ESP32_I2S=y
CONFIG_I2S_DMADESC_NUM=4

I tried modifying the number of audio buffers and also making them bigger,
but that did not solve the problem.
Any ideas on what could cause this?

Regards,
Simona