Quickie: Playing MP3's (and other types) on your ESP32 from an SD Card

Поделиться
HTML-код
  • Опубликовано: 19 ноя 2024

Комментарии • 79

  • @ramrubicon1014
    @ramrubicon1014 8 месяцев назад +1

    Thanks for the sample. Has anyone been able to play more than one audio file with this? What other code would have to be added to have it play multiple files?

  • @mrzcs
    @mrzcs 2 года назад

    Thanks a lot for your great tutorial. One point to add, i.e. as far as I tested, connecting the SD card vcc to vin pin of ESP32 board makes it work normally. I used the same SD card reader as the video demostrated.

  • @kijngs2584
    @kijngs2584 Год назад

    Im looking at using a rotary encoder to play an audio file. Is there a way i can stop the audiofile when i stop turning the encoder

  • @chrisgallagher85
    @chrisgallagher85 Год назад

    Nice tutorial... and thanks. Love the William Turner quote.

  • @dennissea.viverosgonzalez3177
    @dennissea.viverosgonzalez3177 Год назад +1

    Hi I getting Error compiling this code, Audio audio was not name a type, I used the library that you put in the video. I also use a ESP32. Do you know what's happen? And Thanks for your tutorial, it is great.

    • @XTronical
      @XTronical  Год назад

      I'd check library version just in case something has changed. It may be you are on latest version and I'm using older one due to age of video.

    • @dennissea.viverosgonzalez3177
      @dennissea.viverosgonzalez3177 Год назад +1

      @@XTronical The error continues. It says: the Audio library is intended to run on sam architecture(s) and may be incompatible with your current card which runs on esp32 architecture(s). I changed the library for an older one. :((

  • @embeddedjunction9204
    @embeddedjunction9204 Год назад +1

    hey can u please help. I want to play 2 different music at same time on both internal DAC in esp32 (1st one is played on pin25 on1st DAC & 2nd music is played on 2nd DAC at same time in esp32).

    • @XTronical
      @XTronical  Год назад +1

      My DACAudio can do this, mixing both sounds onto to one channel. It will only work with sounds stored in esp32 memory though.

    • @embeddedjunction9204
      @embeddedjunction9204 Год назад +1

      ​@@XTronical there are 2 mp3 in the SD card & also set the different audio on different channel to play but only one audio play on both channel but i want to play different mp3 on different channel at same time. have u the code related with mine question.

    • @XTronical
      @XTronical  Год назад

      I don't, sorry.

  • @12_fahrulabdulaziz91
    @12_fahrulabdulaziz91 8 месяцев назад

    Hi friends, my problem is that the SD card is not initialized. Can combining two pins in SD module like the one in the video work? need help :)

  • @ilkeraykut7064
    @ilkeraykut7064 3 года назад

    Sir,I use esp32sim800l(ttgo tcall) and I get error talking to sd card!. What could it be the problem?I tried 3.3 and 5v vcc.I use micro sd module.

  • @HeikkiHietala
    @HeikkiHietala 2 года назад +2

    Hi! Great video! I am trying to figure out a way of playing multiple sounds, as in a talking clock. I can play single sounds, but getting the system to have a function to which an MP3 file name can be passed, played, and then returned to wait for the next one is a little tough. Do you have any
    pointers?

    • @XTronical
      @XTronical  2 года назад

      Can't remember at moment and only on my phone but does the code not wait till the sound completes. If not then there should be some properties that state length of time the sample takes. Least I would have thought saw. You then as you worked out need to just pass the filename to the function.

    • @HeikkiHietala
      @HeikkiHietala 2 года назад

      @@XTronical I tried to add two sounds but it actually doesn't play either sound. In the current system, the file is attached to the audio object in the Setup() and the Loop() has only audio.loop(). The audio library not really well documented.

    • @XTronical
      @XTronical  2 года назад +1

      I try looking through the header file of the library. I can't be much more help at the moment as I don't have access to a computer.

    • @HeikkiHietala
      @HeikkiHietala 2 года назад

      @@XTronical thank you for this.

  • @3phasetinkerer
    @3phasetinkerer Год назад

    Thank you for this very simple tutorial.

  • @TlTAN
    @TlTAN 2 года назад

    is there any way to conect thos pins of i2s to and auxiliar jack cable?

    • @XTronical
      @XTronical  2 года назад

      Yes, other i2s decoders are available that have a jack built in. Or you can just wire up a socket to the output and it'll work fine. The impedence of earphones is much greater than the speakers being used. Just ensure you connect correctly.

  • @rodrigo_dm
    @rodrigo_dm 4 года назад +2

    Hi there, nice project. What would be the sampling rate of your output DAC?

    • @XTronical
      @XTronical  4 года назад

      Upto 50000 samples per second max

  • @bennguyen1313
    @bennguyen1313 4 года назад +2

    Do you think the ESP8266 (Single 80Mhz Core) could do this, or do you need the power of the ESP32 (160Mhz Dual Core)? BTW, any thoughts on using Visual Studio Code with the Espressif IDF extension instead of the Arduino environment?

    • @XTronical
      @XTronical  4 года назад

      Yes, it should be able to, I think the libraries github page (link in description) may confirm. I've got plans to move over to VS, I use it as a simple editor but not properly.

  • @zakofrx
    @zakofrx Год назад

    Are their libraries /Boards that will support 128g etc.. Sd Cards and long filenames/different file systems or are such things above the ability of the esp32??

    • @XTronical
      @XTronical  Год назад

      Not to my knowledge but I've never had the need for one that big. I imagine there is a technical problem with above 32gb and the 32bit addressing. I would think not insurmountable but I've never looked into it.

  • @junhaozhang533
    @junhaozhang533 2 года назад

    at 1:16 in text box you wrote GAIN ->GND but on your board it is connect to VCC?

    • @XTronical
      @XTronical  2 года назад

      You can connect to either. Different connection gives a different gain. I think I list these on the project page linked in the description.

  • @GuillaumeCorgnet
    @GuillaumeCorgnet 2 года назад

    Hi, thanks for the video, it was useful content. Do you have a video where you explain how to get the code on the ESP32 chip?
    You seem to be skimming through this very quickly

    • @XTronical
      @XTronical  2 года назад +1

      Getting the esp32 to work with the Arduino ide is beyond the scope of that video. I have done a seperate video on this but it is quite old and probably out dated. I would type in "esp32 on arduino" ide" on RUclips for an up to date guide on how to set up and upload code to esp32. Then this guide should be easier.

  • @skorakora
    @skorakora 4 года назад +1

    I did everything like in video but sd card won't initialize.

    • @XTronical
      @XTronical  4 года назад

      Did you do the mod to the SD card? It's at 1:33 in the video. On some SD card boards you need to disconnect the regulator and solder a quick by-pass to get them to work with ESP32.

    • @skorakora
      @skorakora 4 года назад +1

      @@XTronical I found the isue, I added filtering capacitor to power line, and everything works fine

    • @XTronical
      @XTronical  4 года назад

      Brilliant, thanks for adding this info. The current draw can cause issues.

  • @dragoshujunior4909
    @dragoshujunior4909 2 года назад

    Very useful video, ty buddy!

  • @bunnatang2081
    @bunnatang2081 4 года назад +1

    what if the Amp or DAC requires MCK, what should I do?

    • @XTronical
      @XTronical  4 года назад +1

      Trying to remember, it can be done but it's a faff, when I was researching the previous episode I read solutions, just can't remember where I read the info off top of my head. I think the extra complexity is why I selected DACS that did not need it.

  • @michaelpxd6325
    @michaelpxd6325 3 года назад

    Hello is it possible to regulate the volume digital with this library? Great video btw!

  • @farisa.f3095
    @farisa.f3095 3 года назад

    Can you make it controllable with piezoelectric input? Like octapad?

    • @XTronical
      @XTronical  3 года назад

      Depends what level of control you'd want I guess. You can read the input from sensor and control basic play back but I don't think the library offers a lot of control over the output.

  • @yoseph6456
    @yoseph6456 2 года назад

    Why is the gain in the video connected alongside the vcc?

    • @XTronical
      @XTronical  2 года назад +1

      It's from the datasheet, you can attach the gain to gnd, vcc, or to some resistors for various gain settings. I think this gives 9 dB if I remember correctly.

    • @yoseph6456
      @yoseph6456 2 года назад

      @@XTronical so the best choice would be to connect it to the vcc?

    • @XTronical
      @XTronical  2 года назад

      For my speaker it gave good volume without distortion. Larger or smaller speakers may be OK with different setting.

  • @Darkipod
    @Darkipod 3 года назад

    I see the speakers themselves are listed, but what about those printed cases?

    • @XTronical
      @XTronical  3 года назад +1

      Sorry, any 4 to 8 ohm speakers will do. Those ones on screen are out of an old laptop. The ones listed are just ones that are suitable.

  • @jaysunx1
    @jaysunx1 3 года назад

    if my mp3 file on the sd card is named "music" does the string in the code need to be "music.mp3" or "/music.mp3" ??

    • @XTronical
      @XTronical  3 года назад

      As it originally is "/amaze. mp3" it would be "/music. mp3"

    • @jaysunx1
      @jaysunx1 3 года назад

      @@XTronical thanks

    • @jaysunx1
      @jaysunx1 3 года назад

      ​@@XTronical hey again, so is the library supposed to only work with 8 or 16 bit pcm? And if so why are all the test sounds in the library folder 32bit?

    • @XTronical
      @XTronical  3 года назад

      It should work with a variety of bit rates etc. As long as they are mp3. It will then convert to i2s/pcm for transmission to the decoder chip.

  • @iceberg789
    @iceberg789 Год назад

    does it sound better than regular phone mp3 ?

    • @XTronical
      @XTronical  Год назад +1

      Yes and no. The tech is basically the same. The factors that matter would be the bit rate of your sample and the quality of the speaker and it's housing. Probably the speaker and enclosure being quite important as bit rate is easy to change. For there speaker size most reasonable phones do a good job. So some effort has gone into that area.

    • @iceberg789
      @iceberg789 Год назад

      @@XTronical oke

  • @RDCST
    @RDCST 4 года назад

    Would you please keep in silence a bit more to appreciate the audio quality? Thanks!

    • @XTronical
      @XTronical  4 года назад

      Sorry,

    • @RDCST
      @RDCST 4 года назад

      @@XTronical Thanks for understand.

  • @phillipneal8194
    @phillipneal8194 4 года назад +2

    Bravo !!! But alas, my talents lie elsewhere....1:10

  • @wei48221
    @wei48221 4 года назад +1

    Thank you.

  • @electronash
    @electronash 4 года назад

    lol
    You were corpsing for ages after that balls-up.

  • @InterplainMusic
    @InterplainMusic 4 года назад +1

    How many Rum and Coke did you have lol

    • @XTronical
      @XTronical  4 года назад

      Ha ha, not enough! You must have been a sub for quite a while, not mentioned rum and coke in ages!

    • @InterplainMusic
      @InterplainMusic 4 года назад

      @@XTronical yes, I have been programming for a few years. Made my own 3d printer with a laser cut frame. And programmed Marlin. And made a few Arduino projects. Like to watch and learn things like what you do. Been programming a ESP2866 WiFi module to control my 3d printer. I upgraded the memory chip on it to 4mb from 1.

    • @XTronical
      @XTronical  4 года назад +1

      Hey, wow, the stuff you've done is fantastic. I really like that music too. I have very little talent for music unfortunately, wish I had some! Do you want me to use your stuff in a future (probably next) video and give you a shout out?

    • @InterplainMusic
      @InterplainMusic 4 года назад

      Thanks for taking the time to pop over to my page much appreciated. I would be very happy for you to use some of my tracks. Not sure which is best suited. But I do record most days. I have many tracks you could use. My email is interplain1@gmail.com I will remove this when you have read it. And replied to this. Not sure if you can personal message within RUclips. Not found it if you can.

    • @XTronical
      @XTronical  4 года назад

      I've read it (sorry for taking so long), will contact you. You tube used to do a messaging sort of thing, but not anymore

  • @MannyCaruana
    @MannyCaruana 5 месяцев назад

    Second MAX98357A and speaker are a waste of time and money in this configuration. No difference between left and right channels.

    • @XTronical
      @XTronical  5 месяцев назад

      I've tested with a known stereo test track, it shows it works. How are you testing?

    • @MannyCaruana
      @MannyCaruana 4 месяца назад

      @@XTronical I have not tested. I'm just basing my statement on you leaving the SD pin of both MAX98357A boards unconnected. This will put the boards into mono mode and output (L+R)/2 from both. Yes, you will hear sound from both speakers, but it will be the same sound. You have to configure the voltage on the SD pins to specifically select Left or Right channel.

    • @XTronical
      @XTronical  4 месяца назад

      You've misunderstood the use of the SD pin, check the data sheet but in brief. The SD is not the pin that selects stereo channel. It either shuts the device down if low or if high (and unconnected floats high) it specifies that the LRCLK pin should be used to determine which data is left or right channel. The timing diagrams are in the datasheet for LRCLK etc. As I said I tested with special stereo testing tracks for Mp3 as well. Basically if high it is saying "OK work normally in stereo I2S" which then uses the LRCLK pin for left and right channels. So you can see all is correct. The clue is in the pin names, SD for Shut Down, LRCLK for Left Right Clock. Look up my video explaining I2S, that may help

    • @MannyCaruana
      @MannyCaruana 4 месяца назад

      @@XTronical I agree hat LRCLK determines the channel of the current data stream, but there also needs to be something that tells each individual chip which channel to output. One chip has to output data while LRCLK is high and the other while LRCLK is low. This is the function of the SD_MODE pin to give it its full and proper name. As you say, grounding this pin shuts things down. Different voltages on this pin (via pullup resistors) define the mode which can be Left or Right or Mono. No connection gives Left channel only.
      As you have tested with stereo tracks and everything works, I can only think that one of the chips must be a MAX98357B which defaults to right channel if left unconnected. Otherwise I fail to see how two identical chips, wired the same way and fed the same data can output different sounds.

    • @XTronical
      @XTronical  4 месяца назад

      Right, some apologies but also I'm not sure you've listened to the video closely. Firstly yes, you have to do something to the boards to get stereo but it's nothing to do with the SD pin. I forgot about that bit in my replies, but it's been a while since I did this video but sorry for forgetting that.
      But at just 50 seconds in it tells you to watch my earlier video on setting these boards up for stereo as I won't be covering that again in this one, I even emphasise how important it is to do this. You must have missed this information or forgot I'd mentioned it. So that should clear that up.
      Once again, sorry for any confusion caused.

  • @Brian_Of_Melbourne
    @Brian_Of_Melbourne 4 года назад

    Perhaps a few more "Take Two!" calls would be better rather just mucking about? We all make mistakes, but not everyone want to watch them.

    • @XTronical
      @XTronical  4 года назад +5

      And some prefer this style, ever heard the phrase "you can't please all of the people all of the time". From your recent comments you don't like my style, you don't like my hobby approach, why the heck do you keep watching? I avoid things that I don't like and don't have to do. Bizarre! Vote with your eyes and don't watch.

  • @Elnasir
    @Elnasir 2 года назад

    Stop trying to be funny, it is distracting

    • @XTronical
      @XTronical  2 года назад +2

      Just don't watch then, loads of other channels.