Тёмный

ESP32 Audio DMA Settings Explained - dma_buf_len and dma_buf_count 

atomic14
Подписаться 47 тыс.
Просмотров 41 тыс.
50% 1

Опубликовано:

 

22 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 81   
@atomic14
@atomic14 3 года назад
Interested in ESP32 Audio: ru-vid.com/group/PL5vDt5AALlRfGVUv2x7riDMIOX34udtKD Looking for all my ESP32 projects: ru-vid.com/group/PL5vDt5AALlRdN2KyL30l8j7kLCxhDUrNw
@OMNI_INFINITY
@OMNI_INFINITY 25 дней назад
So CPU writes the buffer to RAM and then the DMA controller sends it to the DAC? Seems so.
@jse-shack825
@jse-shack825 Год назад
Your ESP32 I2S audio series is the best of its kind on RU-vid, thanks for all the knowledge! A quick note on the I2S config struct: The way it is set up on some of your github repos causes the DMA-buffer pointer to be reset after the buffer has been read completely. This effectively causes the I2S peripheral to always send the last buffer worth of audio even when no call to "i2s_write()" is being made. You effectively can't turn it off. To fix this, set the ".tx_desc_auto_clear" in the config struct to "true". I hope this helps some people who also got confused on why the I2S peripheral seems to have "a life of its own".
@dominikwinkler2718
@dominikwinkler2718 3 года назад
Thank you so much for this explanation! So happy! This was exactly what I was looking for! Also nice to see that you react on the my and others demand on this topic. This video will become a fundamential for every ESP32 user who wants to process audio data! Thank you!!!!!!!
@atomic14
@atomic14 3 года назад
I was getting a lot of questions around it. The problem is, it is really complicated. There's a lot of interaction going on with buffers in your own application. This video barely scratches the surface!
@andrewkieran8942
@andrewkieran8942 3 года назад
I expect that those graphic effects showing data flowing to and from devices and buffers took a lot of time to produce, and I thank you for all of that effort. They really helped to clarify your explanation.
@miketony2069
@miketony2069 3 года назад
Why can't education be this clear, concise, and approachable. Another wonderful tutorial.
@atomic14
@atomic14 3 года назад
Thanks
@mrmf4712
@mrmf4712 Год назад
I fell asleep twice, but that does not make video less informative. Brilliant!
@kamran_aghlami
@kamran_aghlami 3 года назад
I'm thankful that you decided to share your knowledge with us, amazing content, best of luck!
@atomic14
@atomic14 3 года назад
Thanks! And thanks for watching :)
@bhupiistersingh4097
@bhupiistersingh4097 2 года назад
After looking at your M5Core2 audio visualizer, i was like not i need to find a good tutorial explaining configuration of I2S peripheral configs. Guess what, i was glad that i found video on this topic made by you itself. Thanks a ton for the efforts!!!
@viniciusqueiroz2713
@viniciusqueiroz2713 11 месяцев назад
This video is simply awesome. Your didactics is amazing, and the visualizations you provided are really, really helpful to understand the concepts. Thank you very much!
@rodrigo_dm
@rodrigo_dm 3 года назад
ooooooh yes. I'm so glad you posted this. I'm gonna tackle the ESP32 I2S in a month and already watched your other videos. Thank you so much for sharing.
@atomic14
@atomic14 3 года назад
It was really useful for me to actually sit down and think about this subject - I've hadn't really applied any thought to what the values should be up until now.
@NielsNL68
@NielsNL68 3 года назад
@@atomic14 i thank you for that, although this was very useful already, somehow i would have loved it much more when you ended with a walkytalky moment with much better audio because of the better settings of the DMA settings.
@NielsNL68
@NielsNL68 3 года назад
One thing i was wondering about the DMA settings in relation of the walky talky using esp-now because of the package size of 200 bytes per message would you agree that setting the DMA size to 200 and the number of buffers higher?
@atomic14
@atomic14 3 года назад
@@NielsNL68 That's a really interesting question, the code in the walkie-talkie is a little bit more complicated (maybe it can be simplified) as the I2S reading is decoupled from the sending, so there is an application buffer that is filled up with samples as well. We could make the DMA buffer quite small and have a buffer count high enough to allow for the sending time of the esp-now packet. There are a lot of leavers we can play with :)
@atomic14
@atomic14 3 года назад
@@NielsNL68 That would have been a great demo - I'm kicking myself now for not showing an example of the buffers overflowing and what the audio sounds like when that happens.
@lopes33
@lopes33 2 года назад
A really good explanation and impresive animations. You should make more of this type of videos. Ty
@jimsnodgrass8454
@jimsnodgrass8454 Год назад
Yes , it was useful in confirming these DMA optimizations are WAY too complex for me to work with. I'm going to look over your project links .. For Now I really want to HEAR what typical receptions sound like across a pair of WalkiTaklies, and how pricy the h/w needed is.. .. Thank you. jimS
@AdityaMehendale
@AdityaMehendale 3 года назад
Great animation/visualization at 6:58 :) If I may: the "k" in "kilo" (kBPS, kHz, km, kg, etc) should not be capitalized, as per SI/IUPAC rules. The uppercase K us reserved for absolute temperature (longform unit: kelvin*, with a lowercase k*), named after Lord Kelvin^ (with an uppercase K^).
@atomic14
@atomic14 3 года назад
That is a very good point. I need to be more careful as it's very easy to get confused with units and cause all sorts of problems!
@ytubeleo
@ytubeleo 3 года назад
Did you come across anything saying why they limited the buffer length to 1024 samples? It's no problem since we can simply increase the buffer number, but perhaps there are times when it would have been better to use longer buffers and interrupt the CPU less. Also, does dma_buf_count have a limit? I mean, could I use 1000 buffers that are just 8 samples long for example? Perhaps for some real-time control application or the like. Thanks for this very useful video - RU-vid has been lacking a video on this!
@atomic14
@atomic14 3 года назад
There's nothing I could find on why there's an upper limit. And it feels slightly arbitrary as it's measured in samples - so if you're doing 8-bit samples it's 1K, 32-bit samples it 4K. I think there is probably a max limit of 4K on each DMA descriptor. The only limit you have on the buf count is the physical memory available - there is overhead for each DMA buffer that is allocated to maintain the linked list but I don' think it is that much.
@pascallongpre7797
@pascallongpre7797 3 года назад
Thanks a lot for this! This information was really lacking in the "documentation" I found on the internet! Great visuals also!
@atomic14
@atomic14 3 года назад
Thanks :)
@DustinWatts
@DustinWatts 3 года назад
Very interesting! Thanks for an in depth explanation!
@avejst
@avejst 3 года назад
Great video as always 👍 Thanks for sharing your experience with all of us 👍😀
@atomic14
@atomic14 3 года назад
Thank you!
@davidgardener1152
@davidgardener1152 Год назад
super helpful video! thanks so much for these esp audio videos.
@MicroMasjien
@MicroMasjien 8 месяцев назад
Thanks for the very clear explanation and recommendations. If I could have given two thumbs up, I would have!
@NaturalbornOfTheVoid804
@NaturalbornOfTheVoid804 8 месяцев назад
Very nice video! Is there a way to know which dma buffer is used every time if we have 2 buffers for example?
@TheEmbeddedHobbyist
@TheEmbeddedHobbyist 3 года назад
Nice video, not tried audio on a ESP32 yet. But now it looks like i should give it ago.
@Gauthamphongalkar
@Gauthamphongalkar 3 года назад
Thanks for in-depth explanation.
@ahmedahmed-yg5fl
@ahmedahmed-yg5fl 2 года назад
thank you 💖💖💖 . i was want to understand the dma count
@chall3ng3r
@chall3ng3r 3 года назад
Very well explained 👍
@atomic14
@atomic14 3 года назад
Thanks!
@10e999
@10e999 3 года назад
This is sooo good. Thanks for your great examples.
@rklauco
@rklauco 3 года назад
Very informative, thanks!
@atomic14
@atomic14 3 года назад
Thanks - I'm glad it was helpful.
@GoatZilla
@GoatZilla 3 года назад
I think it would be neat to cover single ADC multichannel DMA sampling on the ESP32.
@franciscogaray2129
@franciscogaray2129 3 года назад
Good video, I have a question? I2S is only for audio application or it's possible other uses. Sorry for my bad English
@atomic14
@atomic14 3 года назад
No need to apologise, it's a really good question. I2S generally always used for audio, but it's quite a simple protocol so you could hijack it for other uses. The ESP32 supports a weird parallel mode which can be used to drive LCD displays! github.com/TobleMiner/esp_i2s_parallel
@franciscogaray2129
@franciscogaray2129 3 года назад
@@atomic14 Thank you very much for your resply, Greetings from Peru South America
@ytubeleo
@ytubeleo 3 года назад
I2S (Inter-IC Sound) is a serial, synchronous communication protocol that is usually used for transmitting audio data between two digital audio devices. With the ESP32, I2S is commonly used for reading from the internal ADC via DMA buffers without having to interrupt the CPU for every sample. The ADC signal may or may not be audio, but the faster you want to read (up to around 150 kHz for the ADC, I believe), the more useful I2S and DMA is. I believe they could have used just about any protocol to connect to the DMA but I2S presumably seemed like the best option. (FYI, the internal ADC is noisy and only really achieves about 7-Bit precision and 6 kHz bandwidth (3 dB cut-off). You can improve the precision by averaging many samples and by adding a capacitor. It also reads zero until the signal is above 0.1-0.2 V.) ESP32 contains two I2S peripherals. These peripherals can be configured to input and output sample data via the I2S driver. I2S0 can also be used for transmitting PDM (Pulse-density modulation) signals. The I2S peripherals also support LCD mode for communicating data over a parallel bus, as used by some LCD displays and camera modules. docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/i2s.html
@sushrutthakur8836
@sushrutthakur8836 3 года назад
What are the total no of dma buffers in esp32 ?? What's the maximum value we can use?
@atomic14
@atomic14 3 года назад
You're limited to the internal SRAM - which is shared between your running application and anything else that is needed. In my tests I managed to allocate a total of around 100K before the application started to crash. I assume that there is some internal upper limit on the actual value for the number of buffers, but I did not hit that before running out of RAM.
@gmuraly1876
@gmuraly1876 2 года назад
Hi, can DMA transfer be used for receiving UART data in ESP32WROOM? If yes, can you share its sample code? I want to receive the OTA update bin through UART from GSM modem connected to UART
@gmuraly1876
@gmuraly1876 2 года назад
Can you pls reply to my query?
@atomic14
@atomic14 2 года назад
I'm afraid I don't know the answer to your question, do you need to use DMA? The docs for the UART are here. I think you may just need to use interrupts and read the data as required. docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html
@bhupiistersingh4097
@bhupiistersingh4097 2 года назад
What would be the correct way of converting the values obtained from micro controller into -db values?
@dulcegarcia1757
@dulcegarcia1757 2 года назад
Hi! It's a good video!! I have a question about the dma buffer. Is possible to use an I2S microphone and I2S DAC in the same time? I know that the ESP32 contains two I2S peripherals, but you said in the video "we can only start processing the buffer once the DMA controller has finished transferring data to it", and I am somewhat confused. I will really appreciate your answer.
@atomic14
@atomic14 2 года назад
The two peripherals work independently from each other and have their own DMA buffers so you'll be fine using them both at the same time.
@dulcegarcia1757
@dulcegarcia1757 2 года назад
@@atomic14 Many thanks for the prompt reply!
@oliverbertel824
@oliverbertel824 3 года назад
Nice video. What program do you use for animation?
@atomic14
@atomic14 3 года назад
I use a combination of manim - github.com/3b1b/manim and my own homegrown animation library (which is definitely not ready for public consumption).
@zoyamchuang2806
@zoyamchuang2806 3 года назад
Thanks a lot. Can this kind of project modify to real-time voice modulator with INMP441 and SPK.
@medb2322
@medb2322 3 года назад
have u ever worked on a decibel meter project if it is I want to know which sound sensor is the best one to use thank you
@jackflash6377
@jackflash6377 Год назад
Suppose I wanted to take the I2S data from a microphone (INMP441) and feed it to a I2S DAC without processing. Just in and out, mono sound signal. How would you set up the buffers? Can the ESP32 fill one buffer from the Mic while feeding another buffer to the DAC? I suppose it would need 2 DMA controllers?
@noweare1
@noweare1 3 месяца назад
Question about the math. A sample is 2 bytes so if we change 176k Bytes/sec to samples/sec we get 88200 samples/sec so 8 sample buffer would be 8/88200=91 usec per sample . I guess you figured the time for both left and right channels which would double my time then we are the same?
@noweare1
@noweare1 3 месяца назад
I went over this again and yes a sample would include both channels.
@tryssss
@tryssss 3 года назад
nice video
@aarriikknn33ll
@aarriikknn33ll 3 года назад
Hi i got some questions regarding bluetooth audio using esp32, where can i get into contact with you? Thanks!
@atomic14
@atomic14 3 года назад
I can be contacted via the channel page. I don't know much about Bluetooth audio yet though!
@aarriikknn33ll
@aarriikknn33ll 3 года назад
@@atomic14 Oh okay sure! No problem, I don't know much yet aswell. Currently I am just sitting with an issue, I have flashed my esp32 with the default espressif example code found under Bluetooth / bluedroid / a2dp sink / classic_bt but the volume bar is randomly going up and down on my phone, and when pressing volume buttons it doesn't change the volume. Do you know a better way by any chance on how to make a Bluetooth receiver using the esp32? I used a pcm5102 dac. (Oh yeah and thanks for the article you linked in one of my previous questions on your channel about the Bluetooth audio volume controller for in the shower, I (kinda) got the basics down and got it (kinda) working :) kind regards, Arik.
@aarriikknn33ll
@aarriikknn33ll 3 года назад
@@atomic14 Sorry for interrupting maybe, but is this the channel page that you said you can be contacted trough? Or did I get it wrong? Have a good day!
@atomic14
@atomic14 3 года назад
@@aarriikknn33ll On the About tab there's a button to view my email address.
@aarriikknn33ll
@aarriikknn33ll 3 года назад
@@atomic14 Ohhh okey thanks, i did not know what you meant exactly.
@zoomingh
@zoomingh 3 года назад
Thank you soo match for this. I was looking for something like it Plz Can you give link to download the complete project? I am a student, and I need it to complete my work, I have 2 months Plzzz Ths
@arduinoanalogico9042
@arduinoanalogico9042 3 года назад
HELLO, IS IT HOW TO GET AUDIO FROM ADC PROCESS AND PLAY IN DAC? FOR EXAMPLE A GUITAR CHORUS?
@atomic14
@atomic14 3 года назад
Have a look at the videos in this playlist: ru-vid.com/group/PL5vDt5AALlRfGVUv2x7riDMIOX34udtKD
@TheTurmanDreams
@TheTurmanDreams 3 года назад
Great !!!!
@atomic14
@atomic14 3 года назад
Thanks
@LittlePetieWheat
@LittlePetieWheat 3 года назад
How do you create your animations please?
@atomic14
@atomic14 3 года назад
Some of them (the text and the equations) are created using Manim - github.com/3b1b/manim (from the guy who runs www.3blue1brown.com/). The of them I've made in Apple Motion (which I'm trying to learn). And some of them I have a very simple animation framework that I've written in JavaScript. I'm still trying to find a tool that I really enjoy using...
@EdGull
@EdGull 3 года назад
Огромное спасибо за Ваши видео! Отдельная благодарность за качественные субтитры. Субтитры идеально переводятся на русский язык.
@atomic14
@atomic14 3 года назад
Переводчик Google потрясающий.
@miguelq.l.9757
@miguelq.l.9757 3 года назад
Genial
Далее
ESP32 Sound - Working with I2S
46:04
Просмотров 341 тыс.
ESP32 Walkie-Talkie: DIY Audio Magic
8:50
Просмотров 115 тыс.
How to get skins for FREE? #standoff #skins #coins
00:34
Fake Referee Whistle Moments 😅
00:38
Просмотров 9 млн
ESP32 Audio Input Using I2S and Internal ADC
10:43
Просмотров 130 тыс.
Broadcasting Your Voice with ESP32-S3 & INMP441
8:13
Most Interesting Addressable LEDs that I've Ever Seen
10:50
#363 Which ESP32 pins are safe to use?
11:53
Просмотров 131 тыс.
Using the ESP32 DAC - Voltages, Waveforms & Sounds
34:46
How to get skins for FREE? #standoff #skins #coins
00:34