Interested in ESP32 Audio: kzbin.info/aero/PL5vDt5AALlRfGVUv2x7riDMIOX34udtKD Looking for all my ESP32 projects: kzbin.info/aero/PL5vDt5AALlRdN2KyL30l8j7kLCxhDUrNw
@b0e2 жыл бұрын
I have not tried your code yet , but I can already say that your video is awesome ! keep them coming !!!!!!! THANK YOU :)
@1111boggy2 жыл бұрын
I wanted to do a wireless stethoscope project. But after watching your videos, it seems easier to make a wired one and classify the audio files I recorded with artificial intelligence. What I need is simultaneous sound transfer and recording this sound on the sd card. Thanks for sharing your work.
@wilbertpayamps1115 Жыл бұрын
Hi! Hope u are fine. Were you able to do what you wanted? I have the same issue.
@AzaB2C Жыл бұрын
Great stuff!
@EdGull3 жыл бұрын
Огромное спасибо за видео и github! Отдельная благодарность за субтитры.
@atomic143 жыл бұрын
Без проблем. Надеюсь, они точны. Я использую для них автоматический перевод, поэтому могут быть ошибки.
@rubiodelimon2 жыл бұрын
You have no idea how much you did help me
@YTbxg3 жыл бұрын
This info together with the walkie talkie project is the first time I am playing with sound. (and the first time I have heard of i2s :-) ) So this is all a very good introduction and its great to go through your code. I'm learning a lot. Many thanks, and do keep them coming.
@atomic143 жыл бұрын
Thanks! I'm glad it's helpful. I2S makes the audio very straightforward.
@kamigordonian2 жыл бұрын
Thankyou so much for this very nice practical video. Just need a little help/information that I have sdhc card to be interfaced with esp32. I am facing the same problem as "mount failed". As you solved this by back porting the code from IDF. I am unable to figure out this point. Where can i get this working piece of code. Pardon me as I am not very experienced in this domain. Thanks
@sharpbends3 жыл бұрын
That's really clever to just use an SD Card adapter (one of those 'that's so obvious why didn't I think of it'...moments :-) Thanks again for posting your code, it is very instructive.
@atomic143 жыл бұрын
No worries - it came as a surprise to me as well. Another handy hint is that the pitch of the connectors let you solder a standard set of header pins directly to the adaptor.
@sharpbends3 жыл бұрын
@@atomic14 Thanks, that is handy to know, I will give it a go as well.
@sharpbends3 жыл бұрын
I got it working ok with a TinyPICO using an old SD Card adapter, soldered wired header pins to the card & used your SDCard library ok. Output using a Sandisk 32GB HC micro SDCard was - 11:07:14.667 -> Type: SDHC/SDXC 11:07:14.667 -> Speed: 20 MHz 11:07:14.667 -> Size: 30436MB Many thanks :-) Now onto the rest of the project...
@atomic143 жыл бұрын
@@sharpbends Nice one! What project are you working on?
@sharpbends3 жыл бұрын
@@atomic14 A stereo i2s microphone with output via an Adafruit i2s headphone dac. It's working well with the tinyPICO at 44.1khz and 48khz using small buffer size for low latency. Currently using INMP441's which are bit noisy (SNR) so hoping ICS43434 will be a little better. I will try adding recording to wav files on SD card as well using 2nd larger size buffers.
@xrayer44122 жыл бұрын
do you have a shematic for your project? i dont se where the microphone is? and how is the speaker connected to the esp?
@latiffaghiri15009 ай бұрын
Hi This is a very nice project, but somehow i have SDcard issue and can't solve it. I have tested my SDcard and it works fine with ESP32 SD_test but somehow with the given code it get these error [ 35][I][main.cpp:90] main_task(): [WAV] Mounting SDCard on /sdcard E (189) vfs_fat_sdmmc: slot init failed (0x103). E (193) SDC: Failed to initialize the card (ESP_ERR_INVALID_STATE). Make sure SD card lines have pull-up resistors in place. I have also tried with 10k resistor but i haven't any luck any tips?
@jonathanr4242 Жыл бұрын
Hi Chris. So, I asked gptchat what is the best way to use i2s if you have both a microphone and an amplifier connected to the device and it told me to install them on different ports. I tried this and core 1 panic'd and threw an error. Then, I saw this project, where you uninstall and re-install the i2s driver when you switch between record and play. And it worked really well. Thanks.
@lorforlinux3 жыл бұрын
Great video 👍
@atomic143 жыл бұрын
Thanks!
@wjn7773 жыл бұрын
Great video, and you saved me a lot of effort as this project was something I've been wanting to do for a long time A question about your use of the SD card adapter as opposed to a breakout board - would this work for a SD card breakout board as well, as long as its also SPI?
@atomic143 жыл бұрын
Yes, as far as I know, breakout boards are pretty much pass-through from the SD Card to the pins.
@noweare1Ай бұрын
Hello Chris, Going through your awesome code. I now see why libraries are written in C++. My question the conversion from int32 to int16. when assigned to int16 a higher order bit is just truncated ? How come just not sample the audio at 16 bits ?
@noweare1Ай бұрын
Nvr mind its an internal thingy on how the microphone processes samples.
@testinventory907211 ай бұрын
nice video! I have a need to record stereo sound to the card, can you recommend something to implement stereo recording? thank you
@lumsdot3 жыл бұрын
good vid. Im using an esp32 and an ada fruit i2s audio DAC to play radio streams into my hifi, sound is excellent and far better than dodgy DAB. i would love to divert the stream to SD card and play them back at a later date.
@atomic143 жыл бұрын
Interesting project - I replied to your other comment, but I'd love to hear more about the DAB radio project.
@DayanandKushwaha-ef6oi10 ай бұрын
@atomic14 can you please share all wiring diagrams i have confused for other modules except the SD card
@user-hw1rn2iv4x10 ай бұрын
Can I record audio in 96kHz with the ESP32???
@HSNDIY2 ай бұрын
Looks like my comment just disappeared! Trying again. Have you tried to build this project recently? What version of the tools are you using? Is this supported by esp-idf 4.4, 5.1 or 5.2.2? Things change so fast these days, it is hard to keep up.
@noweare1Ай бұрын
This video is 3 years old and he used esp-idf. I compiled the code yesterday 7/8/24 using arduino core 2.0.14, which uses esp-idf 4.4 if you use the latest Arduino 3.x.x it probably will have trouble compiling without errors since there are breaking changes.
@Marc_Wolfe7 ай бұрын
Does the I2S stuff work on the S3? Any I2S sketch I've tried, compiles without error messages, but then through serial monitor, my S3 complains "E (7) I2S: i2s_set_pin(295): ws_io_num invalid". Sounds like I should just re-define LR click pin... well, I did, no change.
@KennyTrussell3 жыл бұрын
Very useful! Thanks.
@atomic143 жыл бұрын
Thanks!
@SA-oj3bo2 жыл бұрын
I always get E (150) vfs_fat_sdmmc: slot init failed (0x103). E (150) SDC: Failed to initialize the card (ESP_ERR_INVALID_STATE). Make sure SD card lines have pull-up resistors in place. Formatted with SD CARD FORMATTER, tried pull ups on some and all lines... no success! Frustrating ..... IS there a way to just forward I2S Mic to I2S amplifier?
@nicolasalvez1999 Жыл бұрын
Hello, do you know if there is any way to record the audio as a MP3 file? Thanks beforehand and great video
@NextLevelCode3 жыл бұрын
I saw on a different video not all cards support the spi standard anymore. There is also a SCSI library that is supposed to support all the cards.
@atomic143 жыл бұрын
That's interesting - I'm surprised though as that would break a lot of backwards compatibility. Can you find a link to the video?
@NextLevelCode3 жыл бұрын
@@atomic14 KZbin won't let me post links. but if you search "E-Paper Picture That Changes for My Mom" you will see him talk about his findings and the SCSI library he ended up writing.
@atomic143 жыл бұрын
@@NextLevelCode I'd be inclined to use recent SD Cards that have SPI - I don't think it's something that has been removed. It seems to be cheap cards that may not have it.
@NextLevelCode3 жыл бұрын
@@atomic14 gotcha. Cheap cards cutting corners. Makes sense
@maheshjadhav90163 жыл бұрын
Hi It would be appreciated if you also share arduino IDE version of the code. By the way you have very innovative projects on your channel they are very unique and I like the way you keep them upgrading. P.s. I am trying out a handy memo recorder with ESP32+INMP441+SD card storage + 3.5mm jack additional for attaching a earphone+ mic which will eventually push all its files over Wifi, your thoughts on this are appreciable :)
@atomic143 жыл бұрын
Hi Mahesh, I find the Arduino IDE quite difficult to use with these larger projects. It's worth trying out PlatformIO it really is quite a lot better. Your project sounds great and definitely doable with the ESP32. For the earphone you can drive these directly from the ESP32's DAC outputs - it's a bit noisy but it does work.
@martinmtawali73592 жыл бұрын
How about a micropython version
@bitman42044 ай бұрын
My SD Card works and is marked HC, I think memories larger than 16 GB fail
@waqassubhani37382 жыл бұрын
Very useful! Thanks. I just want to know, how much time Mic can record audio contniously to SD Card, What will be the max file size on SD card, If I want Continous recording.
@atomic142 жыл бұрын
The SDCards need to be formatted as FAT32 which has a maximum file size of 4GB.
@potugada3 жыл бұрын
Thanks for the video. I am new to esp32. 2:15 Where do I find this IDF file in Arduino in my PC?
@atomic143 жыл бұрын
Arduino doesn't really do IDF - if you want to use the ESP-IDF to build software then you should start off with PlatformIO and VSCode or use the Esspressif plugin for VSCode. If you are just starting out though, I'd recommend using the Arduino IDE first and try some simple examples.
@NorthernlionLP2 жыл бұрын
Hey, do you know how I can record incoming A2DP Sink data to an SD Card? Thanks in advance
@user-vr6xd1sr6s6 ай бұрын
How do I know the pin configuration?
@noweare1Ай бұрын
Look in the config.h file
@thomasgilson62062 жыл бұрын
The INMP441 outputs 24-bit samples, but your code is saving the wav file in 16-bit samples. Where did the extra bits go, and how did you "compress" it?
@latiffaghiri15009 ай бұрын
Have you done the project in Arduino IDE framework with 24-bit samples? if yeah could you share your code
@noweare1Ай бұрын
If you go through the code the mic outputs signed 32 bit samples but the code converts them to signed 16 bit before saving them to sd card as wav file data. The microphone has to internally use 32 bit samples and two channels because of the way it is clocked.
@yuuudakishibe9579 Жыл бұрын
What do you call the board underneath the esp32, amplifier and microphone
@atomic14 Жыл бұрын
Breadboard?
@yuuudakishibe9579 Жыл бұрын
@@atomic14 good day sir, i really like this video. I just want to ask if you're willing to share the circuit diagram? I'm interested in doing this kind of project. It's for school purposes. Thank you sir.
@spoor4092 Жыл бұрын
Hello! We are from Ukraine. Is it possible to make an mp3 player based on the esp 32 cam chip? It is necessary to implement access to the sd to delete and add mp3 files. It is very necessary to implement. Thanks for the tips !
@TheEmbeddedHobbyist3 жыл бұрын
This problem looks like a library issue in not telling you what it can and can’t do. (FAT32 - exFAT)? A quick look on Google shows that there is a file difference between HC and XC. HD cards use FAT32, and the newer XC use exFAT, (need to try and find what the format looks like). Also by using FAT32 you limit the card size to 32G and a file size of 4G. Also quote “Due to the max size limit of FAT32 (32GB), the Windows disk management tool, the DiskPart format command, and many third-party SD card FAT23 format tools will format cards below 32GB as FAT32, and cards that are above 32GB as exFAT or NTFS.” So not sure why formatting them to FAT32 makes them work! As HD should be FAT32 as standard and you stated that they did not work? Needs more thinking time. So now you have made my brain hurt ;-) Must limit my thinking or I might wear it out.
@atomic143 жыл бұрын
It's very confusing to me as well. I formatted all the cards with FAT32 using the command line and even used the Raspberry PI Imager app which will format as FAT32. Both the Mac utilities and the PI imager seem to support sizes bigger than 32G - I've got a 128GB card and it's given me the correct size without any problems.
@timothycarson17712 жыл бұрын
I am a little confused. is the SDCard code meant to replace the SD library or do you use it together? For example, if you want to use a button to skip to the next wav file on the sd card for playback.
@atomic142 жыл бұрын
The SDCard code replaces the SD library.
@civita612 жыл бұрын
Hi, excuse the certainly naive question, can I ask you if this project is feasible with Arduino and not necessarily with ESP32?
@atomic142 жыл бұрын
The SDCard and Audio code linked in the repo is specific to the ESP32. Arduino has libraries for talking the SD Cards - you will probably need an adaptor that can level shift from 5v to 3.3v as SD Cards are 3.3v logic (unless your Arduino board is 3.3v) - most SD Card adaptors sold for Arduinos have the the level shifting built in.
@markirwin50033 жыл бұрын
I noticed a bit of popping at the beginning of the recording. I believe this is due to the microphone starting up which can take 90ms. I have seen other implementations where the first two reads are discarded. Would this be implemented in the record function of the I2SSampler?
@atomic143 жыл бұрын
I'd be tempted to do it in the record function, just have a count/flag or something and ignore the samples if count < X
@atomic143 жыл бұрын
I've pushed a commit up to the repo to support SPIFFS. In the config.h there's a #define USE_SPIFFS that you can uncomment and then it will record and play to and from SPIFFS. I did have to decrease the sample rate to get good audio.
@bilboteabaggins1523 Жыл бұрын
I have been trying to get this working in platformIO but I'm running into issues with the FreeRTOS include. How speicifcally should the FreeRTOS library be implemented? I tried including the RTOS library from platformIO's library section for both the Kernal by LinLin and the AVR version by Richard Barry but I can't get either to work. I'm trying to use an ESP32-WROOM, and I can't even get a build to work unfortunately.
@atomic14 Жыл бұрын
Try now.
@noweare1Ай бұрын
FreeRtos in included in both esp-idf and arduino frameworks. Atomic 14 code has the includes already.
@fionnoch98672 жыл бұрын
Donno how you're able to do all this from scratch! Been giving this ago but having a lot of difficulties, I can't seem to get the esp32 to talk with the SD card when running the sketch, am I right is saying that the pins you used are MISO - GPIO pin 4 Mosi - GPIO pin 15 clk - GPIO pin 14 CS - GPIO pin 25 I'm using a breakout board that I had on hand for the SD card rather than soldering directly, but I've run a couple Arduino sketches on the SD card using the esp32 and it works fine with the built in libraries (though they do use different pins mentioned above). Any reason you are using different pins to the ones normally used for SPI? Is it just to free up the i2s pins?
@fionnoch98672 жыл бұрын
Aha! got it working, there was nothing wrong with the pins or board but in the SDCard.cpp file under the SDCard::SDCard function I had to add the line host.max_freq_khz = 4000; I think the SDSPI_HOST_DEFAULT defaults to a speed that is too fast for the SD card to register, I noticed a similar problem on the SDFat library when using an esp32 or esp8266 and you specify the speed. The SDFat library recommends using 4MHz so i gave it a go and it worked. I don't think its to do with the SD card as I used a couple different types (the same as yours). Neither do I think its an ESP32 issue as you never seemed to come across it, must be the breakout board I'm using. I'm using the standard blue Micro SD card adapter you get with most kits. Similar to this electron.lk/product/arduino/microsd-card-module-for-arduino/
@atomic142 жыл бұрын
That same thing hit me recently - I'd been trying to run it at 26MHz and it really wanted 20MHz. A lot of the Arduino breakout boards assume that you are interfacing to a 5v system so have level shifters and voltage regulators to bring the 5v down to 3.3v for the SDCard. Looking at your link I can see those on your breakout board. So it will only work with a 5v system.
@aarriikknn33ll3 жыл бұрын
Hi i would like your input on a idea i had while showering, i was listening to music via my jbl boombox, and i wanted to switch a song to the next one but that gets pretty annoying, I thought of an idea of using a esp32/8266 since i have both at home, basically a small box with next/prev song buttons on it that is waterproof. But my struggle was how will i connect it to my phone when it is already connected to boombox. I thought maybe i could connect it but then making it detect as a input device, but i have no clue on how i would do this. Hope you have an idea and thanks for your awesome videos, they really help me
@atomic143 жыл бұрын
Hmm, I wonder - this might be a bit of a mad idea, but you could make the ESP32 appear as a bluetooth keyboard hackaday.com/2020/02/13/emulating-a-bluetooth-keyboard-with-the-esp32/ and then send the keystrokes for the forward and backward arrows on a mac bluetooth keyboard.
@aarriikknn33ll3 жыл бұрын
@@atomic14 exactly what i was thinking, bluetooth keyboards! But i didn't know how.. thanks for your input on my idea, i shall check out what you have sent me :)
@tapiraiverde Жыл бұрын
Ficou muito bom! Poste o código para ser usado na arduino IDE pois não sei usar o plataformio!
@SA-oj3bo2 жыл бұрын
Can this be used to record a long time? ( until sd card is full? ) Can we also record in mp3 format?
@atomic142 жыл бұрын
Yes, it should just record until you run out of space - though there is no error checking in the sample code so you'll probably want to see how much space you have available and stop before you run out. MP3 playing is definitely possible on the ESP32 - recording might be more difficult.
@shiftyjesusfish3 жыл бұрын
Kinda late to the party on this one, but would this work with the Ai-Thinker eps 32 cam ("esp32 -s- cam" on the heat shield). I am making a toy rc car for my son, using the esp 32's "esp-now" coms protocol.....and the cam will be in the car to take pictures and emulate a video telemetry, but I was hoping to use the sd card slot and left over processing headroom to play a few simple audio files when the mic in the controller picks up a voice command (tire screaching sounds, break sounds, horn, signal lost alarm etc). Would be very convenient if I was ablt to double dip and not have to buy more hardware. Sadly I have gotten in a littel over my hear with this project and would appreciate any advice from anyone who has taken the time to read this :D Thank you
@atomic143 жыл бұрын
I think that might be possible yes - you will need to find 3 spare pins for the amplifier. It will probably work properly with the out of the box Arduino SD_MMC library randomnerdtutorials.com/esp32-cam-take-photo-save-microsd-card/
@hawaranghamada2220 Жыл бұрын
Great video thanks for share ImI :D ImI Is posible make this with only an ESP32 or ESP8266, 1 max9814? I want record sound but i want not save in the micro sd. I want send data to data base in sql or mysql and php. But i can't understand how works the conversión de sound in zeros and ones (0,1) and after in voice again. or How may i do this. I dont know what libraries i most use it. If you read my text... Please, do you will make some similar in a video? Pleaseeee Pd: Sorry my english XD i from Mexico and and i want not use traslate.
@savafp94753 жыл бұрын
Great work sir, When I tried to do this with my do-it-esp32 devKit module. I am getting an error "failed to initialize the card. Make sure SD card line have pull-up resistors in place" . Can you help me to solve this problem.
@atomic143 жыл бұрын
Can you take a look at this issue - there's a couple of people there who have has the same problem and solved it. github.com/atomic14/esp32_sdcard_audio/issues/1
@savafp94753 жыл бұрын
@@atomic14 Thankyou sir. I have gone through it but in vain. I have added a extra line in code of sd card library that "host.max_freq_khz = 10000" . This time SD card was initialized properly but now sdcard writing is not taking place properly. Can you help me please 🙏
@codetaolao9858 Жыл бұрын
How can you fix this issue?
@dbrouste2 жыл бұрын
Thanks very for putting online this nice project. I'm planning to modify it to record ultrasound (from bats). My hardware is ready (I can share if someone interested). My question is about the sd writing speed. I can see that you log your speed ("Wrote %d samples in %lld microseconds"), do you remind what speed did you get? I'll use 240kHz sampling frequency, i just want to be sure the writing speed will be enough to do real time record. Thanks in advance.
@atomic142 жыл бұрын
I don't recall the numbers I got, but there are some good numbers here: github.com/espressif/arduino-esp32/issues/1117#issuecomment-644174531 I suspect that you might be pushing the limits of write speed with the 1-bit SPI interface. If you connect it with MMC mode then you might be able to get real-time recording. Are your samples 8 or 16 bits?
@dbrouste2 жыл бұрын
@@atomic14 Thank you very much for your answer and the link. It's 16bits mono, so the writing speed have to be > 480kBps. MMC will be mandatory :) Will modify my pinout and software to use it.
@pbart9821 Жыл бұрын
I vant get sdhc to work either, very annoying. Bought an sdxc
@mecabenie20469 ай бұрын
interesting can i have a chat with you for more details?
@SPS6253 жыл бұрын
can it record a longer duration?
@atomic143 жыл бұрын
Definitely - the only limitation is the size of your SD card.
@lumsdot3 жыл бұрын
maybe if i had 2 esp32, one playing internet radio and one with your audio recorder. and replace the i2s microphone with the i2s wires which go to the adafruit i2s dac. so one esp32 is playing i2s audio and sending i2s data to the other esp32 to be recorded, but recording mp3 would be better than wav
@atomic143 жыл бұрын
I'd be really interested in the DAB radio project - do you have a link to it? Definitely interesting to be able to record mp3 I think with the ESP32 this is really only possible with a external codec chip.
@lumsdot3 жыл бұрын
@@atomic14 its not DAB, its internet radio streams using an adafruit UDA1334A, use this link github.com/schreibfaul1/ESP32-audioI2S and look at the simple radio example
@lumsdot3 жыл бұрын
i have a video of it on my channel
@wei482213 жыл бұрын
Awwsome..
@atomic143 жыл бұрын
Thanks!
@sharpbends3 жыл бұрын
Great project ! (Also could you please check your eBay account for a message about 4 of your ICS43434 boards not arriving, thanks :-)
@atomic143 жыл бұрын
Just saw it - I'll get some replacements sent out this morning.
@sharpbends3 жыл бұрын
@@atomic14 Terrific thanks so much :-)
@atomic143 жыл бұрын
@@sharpbends No worries - I'm sending them tracked this time so if they go AWOL again we'll know what's happened.