A Better MP3 ESP32 Music Player! Play many MP3's from SD card with volume control.

  Рет қаралды 17,224

XTronical

XTronical

Күн бұрын

Пікірлер: 66
@N00T0N
@N00T0N 3 жыл бұрын
I actually amazed by how you explained everything in just short time ! Very interesting, might try it soon
@alfredopreciadomolina1576
@alfredopreciadomolina1576 4 жыл бұрын
I tried it with the ic pcm5102 and it sounds great, thanks for the info!
@XTronical
@XTronical 4 жыл бұрын
Brilliant. Glad it worked
@bunnatang2081
@bunnatang2081 4 жыл бұрын
how about control DSP, EQ or volume control which are built in inside digital amp like TAS5707?
@XTronical
@XTronical 4 жыл бұрын
I'll have to have a look at one of those
@KehNguangPng
@KehNguangPng 9 ай бұрын
Hi, i cannot compile the code as it says no connecttoSD. i have downloaded and included the lib from github
@PeterGriffiths-u9b
@PeterGriffiths-u9b 2 ай бұрын
The reason is that there are more than one SD library, the sintax is slightly different hence the compile error.
@roberthoemann979
@roberthoemann979 2 жыл бұрын
I have "cloned" this project (as a mono player) and I get very puzzling results. Playing an 8GB micro SD card containing 2 short mp3 selections, and tracing execution with strategic "Serial.println" statements, the program appears to properly cycle thru both songs, always "rewinding" after the end of the 2nd song, but after the 2nd cycle, no sound is heard (so I get song1, song2, song1, song2, but then no sound - in spite of the apparent execution of the "audio.connecttoSD(entry.name()); ". How can this be?
@XTronical
@XTronical 2 жыл бұрын
I'm not sure off top of my head, would need a debug of the source.
@rodo19724
@rodo19724 2 жыл бұрын
I get the error "Audio does not name a type "
@XTronical
@XTronical 2 жыл бұрын
Check you are using the exact same library version as shown in the video
@kanui3618
@kanui3618 4 жыл бұрын
Can you make the Bluetooth speaker, please?🙏
@XTronical
@XTronical 4 жыл бұрын
It is on a list of things to do
@kanui3618
@kanui3618 4 жыл бұрын
@@XTronical waiting for it
@brayanstiveennarevalolucua4646
@brayanstiveennarevalolucua4646 Жыл бұрын
Can you play 2 or more sounds at the same time? Or should one sound first and then the other?
@XTronical
@XTronical Жыл бұрын
I did a video on playing more than one at once, some time after this one.
@KJ7JHN
@KJ7JHN Жыл бұрын
This is great! Thank you.
@imperiosheriff
@imperiosheriff 4 жыл бұрын
Hi, in the code i only find a PlayNextSong(); i need a code for play preview song.
@XTronical
@XTronical 4 жыл бұрын
I can't remember if the library has that, have looked. Look on the projects github page
@imperiosheriff
@imperiosheriff 4 жыл бұрын
​@@XTronical thank you.. in the library I have not found it, I am studying another sketch that uses Music file count https: how2electronics.com/esp32-music-audio-mp3-player/ I'm going to try it file_num = get_music_list(SD, "/", 0, file_list); Serial.print("Music file count:"); Serial.println(file_num); Serial.println("All music:"); for (int i = 0; i < file_num; i++) { Serial.println(file_list[i]); }
@imperiosheriff
@imperiosheriff 4 жыл бұрын
with this I have succeeded but I had to modify many things
@XTronical
@XTronical 4 жыл бұрын
Well done
@mgmix6596
@mgmix6596 3 жыл бұрын
compile error 'Audio' does not name a type please help
@XTronical
@XTronical 3 жыл бұрын
Have you downloaded /installed the required libraries.
@Mr.Engine993
@Mr.Engine993 3 жыл бұрын
Can I use this setup to play songs over bluetooth from my phone? My goal is to have an SD card mp3 player amd switch to bluetooth with the press of a button. Is it possible with this modules?
@XTronical
@XTronical 3 жыл бұрын
It's possible with more code, yes. But would require a fair bit of effort.
@dr_frost_dk
@dr_frost_dk 4 жыл бұрын
nice, looking forward to tempo/speed adjustment for the mini car project, for now the laser rifle can get a big upgrade sound wise :)
@abymohanan9403
@abymohanan9403 3 жыл бұрын
Thank you so much for this video
@MrBobWareham
@MrBobWareham 2 жыл бұрын
Very nice you just need a display to show the songs list and what is playing, loved the video, thanks
@jenseng8977
@jenseng8977 4 жыл бұрын
What's the delay like between the end of one clip and the start of the next? I'm thinking of making an infinite looper with some 40 second .wav clips I've got and need to figure out how to make a smooth transition between playbacks
@XTronical
@XTronical 4 жыл бұрын
There is no noticeable delay.
@jonahjonah000
@jonahjonah000 Жыл бұрын
Bless you, bless you
@ahmedsaad6944
@ahmedsaad6944 4 жыл бұрын
How can make it with Bluetooth speaker?
@XTronical
@XTronical 4 жыл бұрын
Possible but I've not yet looked into this. I'm fairly sure you should find a Bluetooth speaker project on either you tube or perhaps instructables.
@Kuraito596
@Kuraito596 2 жыл бұрын
I got a problem with the board, can you tell me what board you used in this video like ESP32 Dev module or ESP32 Wrover Module or else?
@XTronical
@XTronical 2 жыл бұрын
It was the dev kit 2
@Kuraito596
@Kuraito596 2 жыл бұрын
sorry, I still don't get it. I mean the board you used in tools menu because I got a problem like this "Error compiling for board ESP32 Dev Module. " and Audio library make it fail to upload the code and showed warning like this "library Audio claims to run on sam architecture(s) and may be incompatible with your current board which runs on esp32 architecture(s). " I think the problem is i use the wrong board in tools menu to run this code so which board is the correct one?
@neilbarnett3046
@neilbarnett3046 3 жыл бұрын
It's not entirely accurate that the little amplifiers "are not being stressed any more than they were before." You have made a hasty assumption, that "resistance is resistance". A loudspeaker of any size is a reactive load, because it contains a coil and has a magnetic field and has a moving part connected to the coil. This complicates things tremendously. You have three effects which change the current in the output stage of the amplifier from that which you might expect from resistance values alone: One is just the effect of driving a coil, any coil. Attempting fast changes in current results in a back EMF. This has the oddly opposing effects of increasing the resistance, but out of phase with the exciting current, so the effect is often to draw more current, depending on the frequency. Then there is the physical inertia of the speaker cone, moving a heavier coil and cone (compared to your first speakers) does require more current. T Then there are sources of back EMF, from the generator effect, which means that there is electricity being generated, because you are moving a wire in a magnetic field as the speaker tries to "keep going" because you pushed it. It will also always try to fall back to its centre (rest) position. The effect is that your amplifier asks the speaker to go one way, but it's still going the other way, so the current increases a LOT. These three were the main reasons that early transistor amplifiers failed quite often when driven hard, especially in comparison with valve amplifiers,. Valves gave less power, in general, but had a big transformer to damp down the transients and a high back-resistance, since you can't make electrons go backwards through a vacuum tube. A Zobel network reduces the transients somewhat, supposedly, but a well-designed output stage also helps, as does using much bigger transistors than you think necessary. I learnt most of this the hard way in the 1970s, building high power transistor amplifiers (some even worked!). Feel free to say "but it works fine". Yes, indeed it does, for the volume that you used, and for a short while, these are not big problems, but when you take it higher, you get distortion, warm ICs and then a sudden permanent loss of sound.
@XTronical
@XTronical 3 жыл бұрын
Thank you very much for your detailed post. I'm sure people will find it very useful. I will have to stress test this set up in the future.
@ziyuetong
@ziyuetong 2 жыл бұрын
Does this code work with 32GB SanDisk SD card?
@XTronical
@XTronical 2 жыл бұрын
Yes, but no bigger than 32gb as the sd library cannot manage bigger than that.
@ziyuetong
@ziyuetong 2 жыл бұрын
@@XTronical Thanks! I love this project and have been trying to make it work on the ESP32 I have for days now. I now know my I2S is working since your other I2S project that generates a tone works. For this MP3 player, my 8 ohm speaker is still putting out noise, but the strange thing is if I unplug the MISO connection, I will here the music fine for a second, which made me think maybe the data from the SD card is too fast?
@XTronical
@XTronical 2 жыл бұрын
Don't think so. The reading speed of the sd will be dictated by the speed of data over the i2s. One thing I would check is that you have no floating inputs on the board. I've had a problem with this in the early days Make sure all inputs are tied to something so are not floating.
@ziyuetong
@ziyuetong 2 жыл бұрын
@@XTronical Thank you for the suggestion! I've tried to tie all my inputs so they are not floating, but it didn't work for me. I've watched your previous video on the hardware connections for this project and verified a number of times the connections I made on my board is correct; I also took everything apart and put them back together again a few times and still didn't work. Then I re-watched your explanation on the codes and realized I may not be using the correct version of the FS.h file. Sure enough, I actually cannot find the FS.h file in my Arduino IDE directory or libraries or anywhere I can think of on my PC, although for some reason it is included in my sketch when I checked what libraries were included. So I downloaded the latest version of the FS library and did #include with the absolute path to the FS.h file in the library so that I don't use the old one, and now it works perfectly! Love the volume control!😄
@XTronical
@XTronical 2 жыл бұрын
Fantastic detective work. Bet that was satisfying when it sprung into life.
@MPElectronique
@MPElectronique 4 жыл бұрын
Hey Xtronical! I would like to know what's the difference between VS1053 and I2S DAC from ESP32 ? thank you Marc. :)
@XTronical
@XTronical 4 жыл бұрын
I was unfamiliar with the vs1053, had a quick look at the data sheet. Very interesting chip. It is far more capable in some ways, for example it has built in decoding for several audio formats. However it has a slow clock speed and less IO and it can't mix sounds. It all depends what your want to do I suppose. Esp32 is faster and more versatile but would need additional libraries to play some of the formats that the 1053 can
@simonchereau7531
@simonchereau7531 4 жыл бұрын
Hello, do you have an email to send us for a collaboration on a project?
@billglass5160
@billglass5160 Жыл бұрын
Hello I tried your code with no success. I put 2 mp3 files on my sd card in the root directory and I got "No MP3 files found to play". It was the exact code with exception of slight modifications to the wiring and I don't care about your hard/soft volume control. Below is my code that works fine. I just want to play the files with infinite rewinds. Any ideas what went wrong with your code? Thanx Here's my code: #include "Arduino.h" #include "Audio.h" #include "SD.h" #include "FS.h" // Digital I/O used #define SD_CS 5 #define SPI_MOSI 23 // SD Card #define SPI_MISO 19 #define SPI_SCK 18 #define NUMFILES 2 const char *file_name[NUMFILES]={ "/LAYLA.MP3", "/WARSAW.MP3" }; int fnum=0; #define I2S_DOUT 22 #define I2S_BCLK 26 // I2S #define I2S_LRC 25 Audio audio; //File RootDir; void setup() { pinMode(SD_CS, OUTPUT); digitalWrite(SD_CS, HIGH); SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI); Serial.begin(115200); if(!SD.begin(SD_CS)) { Serial.println("Error talking to SD card!"); while(true); // end program } audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT); // Set Volume audio.setVolume(100); // get first mp3 on the list NEXT(); } void loop() { audio.loop(); } void audio_eof_mp3(const char *info){ //end of file NEXT(); } //get next file on list or rewind void NEXT() { audio.connecttoFS(SD,file_name[fnum]); if (fnum
@mfratus2001
@mfratus2001 3 жыл бұрын
You really should put your web site address on here. I watch your videos, but I need code I can download/copy and try out. I've been working on a problem for a week - playing multiple songs - but all the examples I find won't compile. Of course, if they don't compile they are no good to me, and I've tried to track the problems down to not much progress. I found your web site and will try your code out. Thanks!
@XTronical
@XTronical 3 жыл бұрын
The website is linked in the description 🙂
@mfratus2001
@mfratus2001 3 жыл бұрын
@@XTronical Page not found (404) on that link. But I worked around it. Thanks!
@XTronical
@XTronical 3 жыл бұрын
I'll check it out, cheers
@XTronical
@XTronical 3 жыл бұрын
Link updated, there were underscores instead of hyphens, not sure how they got in there! Thanks for spotting it.
@InterplainMusic
@InterplainMusic 4 жыл бұрын
What's the difference between the ESP2866 and the ESP32
@XTronical
@XTronical 4 жыл бұрын
Main things, 8266 is slower and has much less i/O pins, no built in dac either.
@InterplainMusic
@InterplainMusic 4 жыл бұрын
@@XTronical Thanks for that, I have two on order, i have a collection going here. Uno, Mini Pro, ESP01, ESP8266, an have a ESP32con its way..
@RDCST
@RDCST 4 жыл бұрын
@@InterplainMusic Also I read that have more modules inside and dual core!
@billglass5160
@billglass5160 Жыл бұрын
Found the problem. Your code audio.connecttoFS(SD,xbuf) is executed before entry.close(). Your code only works for small files. Below is my version of PlayNextSong(). Note that I want to rewind infinitely. void PlayNextSong() { char xbuf[50]; boolean ok=false; while (ok==false) { File entry = RootDir.openNextFile(); if (! entry) { RootDir.rewindDirectory(); // reset back to beginning } else if (!entry.isDirectory()) { if(MusicFile(entry.name())) // Only enter if one of the acceptable music files { sprintf(xbuf,"/%s",entry.name()); Serial.println(xbuf); ok=true; } } //else if (!entry.isDirectory()) entry.close(); }//while (ok==false) audio.connecttoFS(SD,xbuf); }
@XTronical
@XTronical Жыл бұрын
Nice work !
@billglass5160
@billglass5160 Жыл бұрын
@@XTronical Thanks. I'm using your tutorials to give me information for making a bedroom clock using the ESP32, LCD display, a PCM5102 with an external speaker, and an SD card reader to play various songs as an alarm . Your videos are quite useful but sometimes lacking in complete information for making a quality DIY project. I hope my commnts help you to refine them. I am your beta tester of sorts.
@Futschikatores
@Futschikatores 2 жыл бұрын
Hello, I am pretty new to this, but I read somewhere that while using WiFi no ADC2 pins (as is pin13) can be used. Also I am confused when you said we should not use potentiometer greater than 10k as it would take too much current -- isnt it the other way around, higher pot (100k) equals lesser current? And thirdly, esp has 3.3v and 5v, so shouldnt the pot be wired to the 3.3v instead?
@XTronical
@XTronical 2 жыл бұрын
Yes, Wifi and ADC2 do not go well together but you could choose an ADC1 pin, there are around 6 available (from memory). In the video, if you re-watch it (around 2mins in) it says don't use LESS than 10K not greater as you say. This is for the reasons you describe, maybe you are miss-remembering/mis-heard? The Pot is wired to 3.3v. If you look at the circuit the power rails on the breadboard are fed from the ESP32's 3.3v output.
@Futschikatores
@Futschikatores 2 жыл бұрын
@@XTronical Ah yes you are correct, I misheard :( On a side note: funnily the automatic captions also transcribed it as "more" (~ 2:24) xD My ESP32 WROOM has a different layout so I also assumed the 5v/3.3v pin wrongly in your video, hehe this was not my day. Anyway thanks for the video.
@XTronical
@XTronical 2 жыл бұрын
Your welcome, I think the captions sometimes struggle with my accent. Thank you for the feedback
Play MP3 Files on ESP32 Without Codec Chip: Easy Guide
8:51
atomic14
Рет қаралды 96 М.
Жездуха 41-серия
36:26
Million Show
Рет қаралды 5 МЛН
I'VE MADE A CUTE FLYING LOLLIPOP FOR MY KID #SHORTS
0:48
A Plus School
Рет қаралды 20 МЛН
Audio modules for electronics project
37:54
Playful Technology
Рет қаралды 73 М.
Connect Your ESP32 to Alexa with FauxmoESP
28:28
Bytes N Bits
Рет қаралды 4,3 М.
The BEST Mechanical Display You've EVER Seen!!!
13:51
Tin Foil Hat
Рет қаралды 583 М.
ESP-Now Range Test: Real-World Results for ESP32 Devices!
8:01
Using the ESP32 DAC - Voltages, Waveforms & Sounds
34:46
DroneBot Workshop
Рет қаралды 87 М.
Coding a Sound Driver on the ESP32 ULP
6:46
bitluni
Рет қаралды 88 М.
Simple Way To Add Sound  & Relay Control To Your Prop or Model
26:29
The Makers Cave
Рет қаралды 59 М.
Building a Digital Music Player with I2S?! What is I2S! EB#45
10:24
Жездуха 41-серия
36:26
Million Show
Рет қаралды 5 МЛН