How to sample Audio on ESP32 with I2S - Tutorial

Поділитися
Вставка
  • Опубліковано 19 жов 2024

КОМЕНТАРІ • 43

  • @atomic14
    @atomic14 3 роки тому +5

    Great work - nicely explained.

  • @kleindavid9416
    @kleindavid9416 10 місяців тому

    Absolutely great knowledge and presentation! Thanks!

  • @imjustger
    @imjustger Рік тому

    Thank you so much for the tutorial, it was really usefull.

  • @EJEuth
    @EJEuth 2 роки тому

    Nicely presented, thanks for sharing! I also liked the platform/environment you did this video-like presentation. This is very useful way of going in-depth specific parts in an interactive way and I would like to learn and use it. What is it? Thanks!

  • @InsiderIntelligence-ww6cn
    @InsiderIntelligence-ww6cn 3 місяці тому

    amazing!

  • @ibendiben
    @ibendiben Рік тому

    Thanks for the great info! Was the bug in the i2s driver solved that you know? Or do we still need workarounds?

    • @TheElectronicEngineer
      @TheElectronicEngineer  Рік тому

      Yes it was. If you take a look at my spectrum analyzer with hub display 64/128 channel…. Look at the code bug is fixed there

    • @ibendiben
      @ibendiben Рік тому

      @@TheElectronicEngineer I thought I read you used a workaround &bytesread?

    • @TheElectronicEngineer
      @TheElectronicEngineer  Рік тому

      Correct, but i discovered a better one. We all learn along the way

    • @ibendiben
      @ibendiben Рік тому

      @@TheElectronicEngineer Okay. Got a link to the project you fixed it? I'm a little confused now.

    • @ibendiben
      @ibendiben Рік тому

      @@TheElectronicEngineer btw I think the use of adc_gpio_init was also depricated meanwhile? Won't compile otherwise. #include driver/adc_depricated seems to fix.

  • @EnvoyOfFabulousness
    @EnvoyOfFabulousness 2 роки тому

    I was using Sequential Sampling initially while trying to build a spectrum analyzer project with an ESP32 and have switched the code to use the I2S sampling you were describing. I can't tell exactly what sampling frequency I'm getting from the I2S sampling, but it appears to be way below the 44100 I am trying to do it at. Playing a frequency sweep video from 0-20kHz only the first 1-4 of the 16 vertical LED bars I have respond to the sweep, and it's mostly just the first one.
    Not sure why my ESP32 seems to be sampling much slower than I want, but even doing Sequential Sampling it seemed to be slower than what people in the tutorials and guides I've found online have been demonstrating. Strange, will have to just play around with it more tomorrow.

    • @TheElectronicEngineer
      @TheElectronicEngineer  2 роки тому

      Send me the code you r using and ill see what i can do. Mark.donners@judoles.nl

  • @noweare1
    @noweare1 3 місяці тому

    Hello, and thank you for the video. Question: In loop you start reading the buffer but did not check to make sure it was full. Also did not read the 2nd buffer. I would thing there would be some synchronizing of the dma buffers and your code. Like dma buffer 1 full, read buffer1 to mybuffer1, do whatever to data, dma buffer 2 full, read dma buffer 2 to mybuffer2, do whatevver. I think I am having this problem because a lot of examples just reading writing and not checking status. Is this a legitimate question ?

  • @JaygeLP
    @JaygeLP Рік тому

    What about the ESP32-S3? It seems like the I2S Method doesn't work on it anymore due to different architecture of the chip?

  • @TomLeg
    @TomLeg 2 роки тому

    In the interrupt-driven system, since you have to have two buffers, anyway, instead of copying the buffers, why not use the BufferFullFlag as an index to select which buffer serves as the ReadADC buffer, and which as the WorkingBuffer? edit: Ah, you do that with the I2S example.

  • @Evavlogkita
    @Evavlogkita 2 роки тому

    wow more than 6 thousand views, a big achievement for a " not yet" monetised vlogger

  • @HoXDipannew
    @HoXDipannew 3 роки тому

    Loved it

  • @ignacioescribano6701
    @ignacioescribano6701 11 місяців тому

    Hi ,thank you for you explanation. I have a fundamental problem, just starting with the first method if I just make a simple program with a loop that reads values and increase a counter , after 1 second (1.000.000 micro) my count is only 10.000 times. That means that I am taking samples at maximum speed of 100 micros por sample. You see? with this numbers your example shouldn't work! (you are taking at 20 micros per sample, I don't know how) . I am using an esp32, first I used an arduino nano and the maximum count gave me samples times in a second, that is why I changed to esp32, imagine my surprise when I run the same program and I only got a 10% increase in the count.

    • @TheElectronicEngineer
      @TheElectronicEngineer  11 місяців тому

      Maybe you made a error in coding? share your code AndI'll check it out. The ESP32 WROOM runes at 200Mhz. so that;s 5nSec per tick. Maybe you used a integer that is overflowing...try using long variables

    • @ignacioescribano6701
      @ignacioescribano6701 11 місяців тому

      Thank you for answering. This is mi code
      void takingSample(int data[],unsigned long &tiempoI,unsigned long &tiempoF,unsigned long &contador)
      {
      display.clearDisplay();
      display.drawString(0,2,"TAKING SAMPLE");
      char contadorf[21];
      tiempoI= micros();
      while (tiempoF < 1000000)
      {
      val = analogRead(32);
      contador= contador+1;
      tiempoF=micros()-tiempoI;
      }

      sprintf(contadorf,"%ld",contador);
      display.drawString(0,3,contadorf);
      delay(8000);
      showMenu();
      }
      My esp32 is ESP-WROOM-32S Wifi + Bluetooth 4.2 IoT USB-C
      @@TheElectronicEngineer

    • @TheElectronicEngineer
      @TheElectronicEngineer  11 місяців тому

      You are assuming that your count to 1000000 is equal to 1 second but it is not...those are ticks not seconds. 1 tick is 50 nano seconds.. so your math is off... :-) @@ignacioescribano6701

    • @ignacioescribano6701
      @ignacioescribano6701 11 місяців тому

      Why? the function micros() returns the number of microseconds since the Arduino board began. My line
      tiempoF=micros()-tiempoI;
      will returns in microseconds not in ticks , therefore when it has 1.000.000 it should by 1 second, at that point counter will have the value of how many times the loop happens in that interval. What am missing?
      @@TheElectronicEngineer

  • @pauloshikoy5068
    @pauloshikoy5068 2 роки тому

    When I compile the code I get the following error: Compilation error: 'i2s_read_bytes' was not declared in this scope, how can i fix? thanks..

    • @TheElectronicEngineer
      @TheElectronicEngineer  2 роки тому +1

      Jij have to install the same libraries as i did. Some newer version have error

    • @pauloshikoy5068
      @pauloshikoy5068 2 роки тому

      @@TheElectronicEngineer
      Where can I find the libraries? is it possible to share the link?

    • @TheElectronicEngineer
      @TheElectronicEngineer  2 роки тому

      @@pauloshikoy5068 sure its on my github. Will get a link for you when i get home.

    • @pauloshikoy5068
      @pauloshikoy5068 2 роки тому

      @@TheElectronicEngineer Thanks!!

    • @ibrahimalfatih6059
      @ibrahimalfatih6059 2 роки тому

      @@pauloshikoy5068 hi paulo, have you gotten the library yet?

  • @dijitalhobim
    @dijitalhobim 2 роки тому

    Merhabalar.
    Esp32 ide bu melodiler çalmıyor.
    Bunun için nasıl bir yol izlemem gerekir?

  • @curtisnewton895
    @curtisnewton895 Рік тому

    404 on your link
    why dont you use github btw?

  • @manmeetjammu
    @manmeetjammu 2 роки тому

    You take too much pauses.. my buffer gets full.. please attend communication classes and be with people .. try talking classes please. . You spent your initial phase alone I think.. not much talking happened. .

    • @remy-
      @remy- 2 роки тому +5

      Strange comment

    • @TomLeg
      @TomLeg 2 роки тому +2

      When I view a video where the person talks too slowly for my taste, I use the Settings link to increase the playback speed.

  • @SA-oj3bo
    @SA-oj3bo 3 роки тому

    Very interesting!
    Is it correct to say that it would not give any benefit to add I2S driven audiochips/boards externally like www.tinytronics.nl/shop/nl/audio/es9023-dac-audio-decoder-i2s if you just want to sample an analog signal and do FFT on it?
    I use simple microphone amplifier:
    www.conrad.be/p/adafruit-1713-uitbreidingsboard-1516571?t=1&
    and want to record and analyze in real time which frequencies are involved in the audio captured by that microphone..
    I also wonder if you could handle the 1024 sampels before the next 1024 are recorded by dma in the buffer.
    Thanks!

    • @TheElectronicEngineer
      @TheElectronicEngineer  2 роки тому

      Not really, I am using I2s with the internal dac. The internal dac is only 12 Bit. So with an external i2s mic board, you might increase that to 16 bit