Interested in ESP32 Audio: ua-cam.com/play/PL5vDt5AALlRfGVUv2x7riDMIOX34udtKD.html Looking for all my ESP32 projects: ua-cam.com/play/PL5vDt5AALlRdN2KyL30l8j7kLCxhDUrNw.html
Thanks for posting the files! Researching how to get audio out through Bluetooth to a laptop for recording ESP32 based synthesizers. Basically the goal is to somehow have BLE MIDI sent from a laptop to an ESP32 and simultaneously have audio through Bluetooth from the ESP32 to the laptop. So a music sequencing app can send MIDI out from the laptop to sequence an ESP32 synthesizer and then audio out from that to the laptop. All of it through Bluetooth and BLE. Any recommendations on how to accomplish that? Thanks in advance!
Thank you so much for this series! You cover so many things that I didn't know existed, or simply couldn't understand from other people's descriptions. So yeah, thank you for going to the effort of making the videos, sharing the code, and being so concise, I really appreciate it. Happy new year and stuff, too!
Interesting. I think it should be possible to output 16 bit signals. You can use both D/A converters. By operating the least significant bit A/D converter output across a voltag divider and the most significant A/D converter directly. Then you can add both analog output signal together with an analog signal addition amplifier.
Hello! this has helped me a LOT so far in understanding how Im gonna tackle on my project. I'm tryna build a music bot that can be controlled from a web server including playing the music from there too. Is this sound quality the best I could get from the ESP32? Or is there a better board out there for it for could I change something to increase the quality. Thanks!
How did you deal with the buffer only returning data on half of it’s size? The last half only return 0... so a buffer of 1024 only has data of 512 samples .....
Thank you so much for sharing, really nice and helpful. If I may suggest a topic for future video, showing how to pipe the output sound from ESP32 using I2S mics to another ESP32 rather than a Node server. Basically tying the two projects you have presented separately together. Once again, great content explaining the different aspects of ESP32, thank you for your work.
Say I wanted to bring in I2S data from a MEMS mic and pipe it directly out to an I2S DAC. Can you read and write to the same buffer or will I need to make code to transfer from the "IN" buffer to the "OUT" buffer?
very intersting. i am trying to implement mozart dicing game on esp32 (got it already running on raspberry) however, when i opened the links, i hoped for an arduino library, but infortunately it is not. is there a library available (preferably one who plays samples from an sd card ...without delay). Much to ask, perhaps, but your expert help would be very appreciated
Hi atomic. i m interested in this application of esp32 but I' ve had a problem about the noise speaker after finished the mp3. How can i get rid of that noise ? Thank you much
Really nice video! What would be the best amplifier break out board to connect to the 8 bit dac directly? I am making a game similar to Bop it with an ESP-32 and I want to deal with as fewer components as possible.
This breakout board will do what you want quite nicely - www.adafruit.com/product/2130 There are also amplifiers that will take I2S digital signals directly - www.adafruit.com/product/3006
Is there any way of ganging the two outputs to get mono 16 bit resolution, e.g. where one channel is encoding information for a voltage controlled amplifier and the other one is the signal fed into it?
Hi Daniel, you could definitely do something like that. But it would probably be easier if you need more resolution to use the I2S digital output and a suitable external DAC - that would give you up to 24 bits - I've done a video on this here: ua-cam.com/video/At8PDQ3g7FQ/v-deo.html - there's also a break out board from Adafruit that will decode the I2S output to line level output www.adafruit.com/product/3678 I've got one on order for some experiments.
@@DanielSMatthewshow about suplying the left channel with the high byte and the right with the low byte of 16 bit mono data, then mix the ouput with 1/256 attenuation on the right channel oitput before mixing?
Hi, thanks for the Video. I am haveing trouble getting my head around the "bits per sample" part of the header. In your code you expect 16 but actually use 8 ie, reading into a uint8_t field. Am I missing somthing here?
Hi Chris - do you mean this line of code? m_file.read((uint8_t *)(&frames[i].left), sizeof(int16_t)); We need to cast the pointer to a uint8_t * as that's what m_file.read expects to receive. But we are reading sizeof(int16_t) bytes - so we still read in 16 bits of data.
@@atomic14 In the file I downloaded from github i have "m_file.read(&left, sizeof(uint8_t));" This is from WAVFileReader.cpp in the dac_i2s_output/src folder.
@@chrisswallow3734 You are right - apologies for the confusion - I just checked the sample code and the DAC version is using a WAV file with 8 bits per sample - I've pushed up a quick fix to make it consistent with the I2S example. They should now both be using a file with 16-bit samples. Hopefully, I've not broken anything!
@@atomic14 Thanks, I thought I was loosing the plot. I was pleased to come accross your video as i missed the ability to use i2s with the internal DAC when reading the documentation for the esp32. I am going to try using mono and just one channel as the lovely people at Lilygo have hard-wired IO26 to the SIM800 on the t-call board.
Nice videos I am looking for a solution for a guitar tuner with INMP441 and ESP32 based or on autocorrelation models or YIN. I tried with FFT but is very inaccurate. Any idea?
I think FFT won't work very well. There is some sample code here that I think uses autocorrelation - I'm afraid this isn't really something I've looked into - github.com/logsol/tuner/blob/master/Source/MainComponent.cpp It looks like there's some good info here - 29a.ch/2020/04/15/guitar-tuner
@@atomic14 those are examples I have tried with autocorrelation, but it looks like samplingRate (I tried from 8919 to 48000hz), nrSamples (I tried from 128 to 4048) produce not very accurate results too in the low frequencies. For 440hz I have a frequency in the range of 432 - 445 hz... Many examples around are for Arduino analogRead which is 8bit. ESP32 reads in 32bit... I dunno if there are some operation to perform to read just the MSB... this is the reading ( i2s_pop_sample((i2s_port_t)i2s_num, (char*)&sampleIn, portMAX_DELAY); vReal[count] = sampleIn; thank you!
@@emabelloni There's some interesting code here - it's a bit over my head - but might do what you want github.com/performous/performous have a look in game/pitch.cpp - that seems to be doing tone detection. "Performous does pitch detection with fast fourier transform (FFT) combined with a sophisticated post-processing algorithm. This system is able to operate well in extremely noisy environments, even when using very cheap microphones."
Thank you for taking your time to make the explanation so clear! Curious if you have tried using the internal ADC to read audio signal with I2S, then stream to the internal DAC concurrently also via I2S?
Hi Pithawat - this is definitely possible, but I have not done it yet. You should be able to take the code from the audio input video and feed the samples into the output code. It's probably also possible to do this using audio pipelines. The documentation is very focussed on using codecs, but you should be able to use it do what you want. docs.espressif.com/projects/esp-adf/en/latest/api-reference/framework/audio_pipeline.html.
Interested in ESP32 Audio: ua-cam.com/play/PL5vDt5AALlRfGVUv2x7riDMIOX34udtKD.html
Looking for all my ESP32 projects: ua-cam.com/play/PL5vDt5AALlRdN2KyL30l8j7kLCxhDUrNw.html
Thanks for posting the files! Researching how to get audio out through Bluetooth to a laptop for recording ESP32 based synthesizers. Basically the goal is to somehow have BLE MIDI sent from a laptop to an ESP32 and simultaneously have audio through Bluetooth from the ESP32 to the laptop. So a music sequencing app can send MIDI out from the laptop to sequence an ESP32 synthesizer and then audio out from that to the laptop. All of it through Bluetooth and BLE. Any recommendations on how to accomplish that? Thanks in advance!
Thank you so much for this series! You cover so many things that I didn't know existed, or simply couldn't understand from other people's descriptions.
So yeah, thank you for going to the effort of making the videos, sharing the code, and being so concise, I really appreciate it.
Happy new year and stuff, too!
Thanks! Happy New Year to you too - hopefully 2021 will be a bit better than 2020!
I really like and appreciate your tutorials on audio.
Great video. You presented the details in an easy to understand way. Thanks you have save me hours of searching, trial and error.
No problem! I'm glad you found it useful.
how can we use both internal DAC at same time in esp32. can we play two different music at same time on both different internal DAC. can u help me.
Interesting. I think it should be possible to output 16 bit signals. You can use both D/A converters. By operating the least significant bit A/D converter output across a voltag divider and the most significant A/D converter directly. Then you can add both analog output signal together with an analog signal addition amplifier.
By using the PDM output, you can get stereo 16-bit, all that is needed is to lowpass the output.
That direct voltage stepping method is done at predefined intervals or is that possible to specify somehow?
Hello! this has helped me a LOT so far in understanding how Im gonna tackle on my project. I'm tryna build a music bot that can be controlled from a web server including playing the music from there too.
Is this sound quality the best I could get from the ESP32? Or is there a better board out there for it for could I change something to increase the quality. Thanks!
How did you deal with the buffer only returning data on half of it’s size? The last half only return 0... so a buffer of 1024 only has data of 512 samples .....
Can you raise an issue on Github - thx
Thank you so much for sharing, really nice and helpful. If I may suggest a topic for future video, showing how to pipe the output sound from ESP32 using I2S mics to another ESP32 rather than a Node server. Basically tying the two projects you have presented separately together. Once again, great content explaining the different aspects of ESP32, thank you for your work.
That seems to be a popular topic - definitely doable. I'll add it to the queue.
@@atomic14 Thank you so much, will be looking forward to watching it and learn.
Say I wanted to bring in I2S data from a MEMS mic and pipe it directly out to an I2S DAC.
Can you read and write to the same buffer or will I need to make code to transfer from the "IN" buffer to the "OUT" buffer?
Did you get an answer or a solution for this? I need to do something similar, but I'm kind of a noob in all of this.
sir music from the file is played too fast leading to a complete different voice.How can i rectify this?
Thank you for sharing.
No problem! I hope you found it useful.
Can you please tell how to control this board using Esphome ?
very intersting. i am trying to implement mozart dicing game on esp32 (got it already running on raspberry) however, when i opened the links, i hoped for an arduino library, but infortunately it is not. is there a library available (preferably one who plays samples from an sd card ...without delay). Much to ask, perhaps, but your expert help would be very appreciated
Is there any solution to increase resolution?
Hi atomic. i m interested in this application of esp32 but I' ve had a problem about the noise speaker after finished the mp3. How can i get rid of that noise ? Thank you much
Really nice video! What would be the best amplifier break out board to connect to the 8 bit dac directly? I am making a game similar to Bop it with an ESP-32 and I want to deal with as fewer components as possible.
This breakout board will do what you want quite nicely - www.adafruit.com/product/2130 There are also amplifiers that will take I2S digital signals directly - www.adafruit.com/product/3006
Why is it called DMA if it's not direct memory access?
Does ESP32-C3 have a built-in DAC?
No - but you can use PDM output pretty easily -
ua-cam.com/video/oZ39VCUvKjw/v-deo.html
Hi, just want to know how i make the sample just play once... incredible work!!!
Or if i put more than one sample, how to choose...
Have a look at the audio toolbox here along with the examples - github.com/pschatzmann/arduino-audio-tools
Is there any way of ganging the two outputs to get mono 16 bit resolution, e.g. where one channel is encoding information for a voltage controlled amplifier and the other one is the signal fed into it?
Hi Daniel, you could definitely do something like that. But it would probably be easier if you need more resolution to use the I2S digital output and a suitable external DAC - that would give you up to 24 bits - I've done a video on this here: ua-cam.com/video/At8PDQ3g7FQ/v-deo.html - there's also a break out board from Adafruit that will decode the I2S output to line level output www.adafruit.com/product/3678 I've got one on order for some experiments.
@@atomic14 Thanks I'll take a look at that.
@@DanielSMatthewshow about suplying the left channel with the high byte and the right with the low byte of 16 bit mono data, then mix the ouput with 1/256 attenuation on the right channel oitput before mixing?
@@bimsonic Sounds good. Worth an experiment.
@@DanielSMatthews please update with the result here when you're done!
How to program sound engine rc
Hi, thanks for the Video. I am haveing trouble getting my head around the "bits per sample" part of the header. In your code you expect 16 but actually use 8 ie, reading into a uint8_t field. Am I missing somthing here?
Hi Chris - do you mean this line of code? m_file.read((uint8_t *)(&frames[i].left), sizeof(int16_t));
We need to cast the pointer to a uint8_t * as that's what m_file.read expects to receive. But we are reading sizeof(int16_t) bytes - so we still read in 16 bits of data.
@@atomic14 In the file I downloaded from github i have "m_file.read(&left, sizeof(uint8_t));" This is from WAVFileReader.cpp in the dac_i2s_output/src folder.
@@chrisswallow3734 You are right - apologies for the confusion - I just checked the sample code and the DAC version is using a WAV file with 8 bits per sample - I've pushed up a quick fix to make it consistent with the I2S example. They should now both be using a file with 16-bit samples. Hopefully, I've not broken anything!
@@atomic14 Thanks, I thought I was loosing the plot. I was pleased to come accross your video as i missed the ability to use i2s with the internal DAC when reading the documentation for the esp32. I am going to try using mono and just one channel as the lovely people at Lilygo have hard-wired IO26 to the SIM800 on the t-call board.
@@chrisswallow3734 Sorry about that :) I wonder why they had to use that GPIO pin - very annoying!
Nice videos
I am looking for a solution for a guitar tuner with INMP441 and ESP32 based or on autocorrelation models or YIN. I tried with FFT but is very inaccurate. Any idea?
I think FFT won't work very well. There is some sample code here that I think uses autocorrelation - I'm afraid this isn't really something I've looked into - github.com/logsol/tuner/blob/master/Source/MainComponent.cpp It looks like there's some good info here - 29a.ch/2020/04/15/guitar-tuner
@@atomic14 those are examples I have tried with autocorrelation, but it looks like samplingRate (I tried from 8919 to 48000hz), nrSamples (I tried from 128 to 4048) produce not very accurate results too in the low frequencies. For 440hz I have a frequency in the range of 432 - 445 hz... Many examples around are for Arduino analogRead which is 8bit. ESP32 reads in 32bit... I dunno if there are some operation to perform to read just the MSB...
this is the reading (
i2s_pop_sample((i2s_port_t)i2s_num, (char*)&sampleIn, portMAX_DELAY);
vReal[count] = sampleIn;
thank you!
@@emabelloni There's some interesting code here - it's a bit over my head - but might do what you want github.com/performous/performous have a look in game/pitch.cpp - that seems to be doing tone detection. "Performous does pitch detection with fast fourier transform (FFT) combined with a sophisticated post-processing algorithm. This system is able to operate well in extremely noisy environments, even when using very cheap microphones."
Thank you for taking your time to make the explanation so clear! Curious if you have tried using the internal ADC to read audio signal with I2S, then stream to the internal DAC concurrently also via I2S?
Hi Pithawat - this is definitely possible, but I have not done it yet. You should be able to take the code from the audio input video and feed the samples into the output code. It's probably also possible to do this using audio pipelines. The documentation is very focussed on using codecs, but you should be able to use it do what you want. docs.espressif.com/projects/esp-adf/en/latest/api-reference/framework/audio_pipeline.html.
there is 0.1 volt loss