3 Options for Playing Audio on Arduino

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 พ.ค. 2022
  • 00:14 Option 1
    Songs that work with arduino Tone() function:
    dragaosemchama.com/en/2019/02...
    01:17 Option 2
    Audio card module:
    www.amazon.com/dp/B01M35VHY5?...
    03:01 Option 3
    Audio to wav converter:
    audio.online-convert.com/conve...
    "The zip file" includes SD card formatter, library and arduino code:
    content.instructables.com/ORI...
    (download at own risk, this is not my creation however I have not encountered any problems with it)
    Inspired by:
    • Audio Player using Ard...
    Music by:
    A Brand New Start by TrackTribe
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 118

  • @BadPracticeAutomation
    @BadPracticeAutomation ปีที่แล้ว +24

    Fantastic video, fantastic instruction, fantastic presentation, plus you included a pro/con list and timestamps. Instantly subscribed.

  • @pruthvirajhm
    @pruthvirajhm ปีที่แล้ว

    OMG I loved it like anything 😍 💕
    its awesome dude.

  • @djsans3
    @djsans3 ปีที่แล้ว +41

    I'm pretty sure that wav files don't have bad quality. Compared to mp3 files they have a constant bit rate so they should be better quality. Besides that I really enjoy your videos, thank you for your amazing work!

    • @lowlink534
      @lowlink534 ปีที่แล้ว +4

      I think the problem is downsampling, he's using less than 20kHz, so it's gonna be noticeable. I didn't play around with it so I'm not sure if you need to do that so the Arduino can play (I think the max frequency of the CPU itself is lower than 20k or something), also not sure why the mp3 solution doesn't have this problem

    • @soheil5710
      @soheil5710 ปีที่แล้ว +1

      @@lowlink534 Slight correction, the Arduino clock speed is 16MHz. That's mega as in millions, so plenty for this kind of project.

    • @lowlink534
      @lowlink534 ปีที่แล้ว

      @@soheil5710 Lmao did you ever actually try to play audio on Arduino?
      No offence meant, but playing audio is way harder than just using one instruction per cycle. You have to read the samples from memory and write them to the audio out (generally port 9 using the PMW in mysterious ways with Mozzi, for example), plus all the processing you might do to the audio. To change volume, for example, you have to multiply the value, many cycles already going down the drain for every sample. If you have multiple samples, you have to sum them all, if you're using effects, you have process everything they do. Plus any project that actually do anything will have user input that will have to be processed as well. I talked about the less than 20kHz because Mozzi, the only Arduino lib I know that have a decent audio output, doesn't support much more than 16kHz samples (plus the memory on the Arduino itself is the biggest limitation, using only samples at 10kHz max, I was barely able to fit a drumkit of samples on the memory, and the hihat/crash samples are very short, like if you want to sustain, you have to replay them at lower volume while the original is playing. Plus I needed to save the patterns for the drum machine and other stuff on memory, and my Arduino Uno only has 20kb left, after the basic Arduino firmware and the basis of Mozzi running for audio out, so that's all I had to work with. Also Arduino doesn't have proper audio outs, you could do a DAC and output from like 8 digital ports, but that's madness (I saw some projects like that and assumed it was the only way it could be done, totally wrong). Mozzi somehow allows to output decent audio from a single PMW output, but the audio itself can become quite noisy and unstable, since you're kinda "cheating" to output audio and always outputting at 5V, which is way more than let's say an electric guitar or bass, and at the limits of a line in/out, I believe. That, along with the low samplerates often employed because of the low Arduino memory, make the audio quality very lofi

    • @lowlink534
      @lowlink534 ปีที่แล้ว +2

      @@soheil5710 Lol now I see what you mean, I have no idea why in my original comment I said the CPU runs at less than 20k, no CPU probably ever ran at that low of a clock lol
      Back then I also didn't have as much experience with Arduino and Mozzi, but that still is no excuse lmao

    • @soheil5710
      @soheil5710 ปีที่แล้ว +2

      @@lowlink534 No worries I've been confused myself before

  • @admali2142
    @admali2142 10 หลายเดือนก่อน +2

    Thanks, its very good demonstration. I tried to access the files Zip and the sketch but without success?

  • @spencerharrisonx3700
    @spencerharrisonx3700 8 หลายเดือนก่อน +4

    Why does option 3 need amplifying? Is it because they are .wav files? Can you not set the volume higher with the tmrpcm.setVolume(x); or is it because of the speaker you are using?

  • @Anonymous-hd7en
    @Anonymous-hd7en 11 หลายเดือนก่อน +3

    I have one question , in the second method (sd card) is the output digital audio (pwm) ?

  • @nusior
    @nusior ปีที่แล้ว +4

    Cool! I'm about to build something like no. 3 with the file on repeat. But I'm a total arduino noob so I hope I'll be able to find some code to do the trick painlessly 😁. Bought it 8 years ago, never even take it out of the box. Finally I have an opportunity to make a little project and start my arduino adventure 😆

    • @JustBaselmansYT
      @JustBaselmansYT  ปีที่แล้ว +2

      Sounds great! Good luck with the project and the start of hopefully a long arduino journey ;)

  • @otrocanalsincreatividad9640
    @otrocanalsincreatividad9640 ปีที่แล้ว

    Thanks man, You saved me!

  • @LightningGoldStudio
    @LightningGoldStudio 2 หลายเดือนก่อน

    Hey, what kind of speaker did you use on option number three?

  • @leo935_6
    @leo935_6 9 หลายเดือนก่อน

    In option 2 can you put more than one audio?;Can it be made to play only a random track every time it receives power?

  • @As7ik.Mo7amm3d
    @As7ik.Mo7amm3d 9 หลายเดือนก่อน

    @justbaselmans is There any options to put 2 audio from sd card?

  • @BeeKeyPro
    @BeeKeyPro 7 หลายเดือนก่อน

    Thanks for that amazing video! i subscribe!

  • @nutelhere
    @nutelhere ปีที่แล้ว +6

    cool video, but would be better if you muted bgm while arduino was playing sounds...

  • @nickc7039
    @nickc7039 2 หลายเดือนก่อน

    can you do multiple sounds with option one? Different tone for every bin?

  • @samir3216-bs1lv
    @samir3216-bs1lv 7 วันที่ผ่านมา

    Btw the 3rd way to a amplifier is optional because you can just change the wav file volume then save to the sd card it will sound loud.

  • @filipegaspar3572
    @filipegaspar3572 26 วันที่ผ่านมา

    The 2nd option seems to be the best one in terms of quality sound but the fact it can only run 1 audio is a pain. How much different audios can you store to play in the 3rd?

  • @michaelkim3930
    @michaelkim3930 11 หลายเดือนก่อน +3

    how do you play multiple files with option 3 in the code? do you just separate each file that you want to play by a comma in the .play line?

  • @sanjana2186
    @sanjana2186 ปีที่แล้ว

    thank you it worked👍

  • @bricktimelapsebuilds
    @bricktimelapsebuilds ปีที่แล้ว +1

    Hey I have a question i have some functions running in the background and i want to play different sounds when i press different buttons.
    if i press a button and the arduino plays the sound file will my other code in the loop function also be executed or will the arduino stall until the file has been played?

    • @user-dj1kw1nj2u
      @user-dj1kw1nj2u 3 หลายเดือนก่อน

      Depend on your code. Just use interrupt function to make it easy

  • @koenkloosterhuis1710
    @koenkloosterhuis1710 2 ปีที่แล้ว

    Hallo, would it be possible to create the second option with a PIR sensor, instead of a button? Also would it be possible to create the third option with a YX5300 mp3 module? Have been struggeling to get a project to work for a while now...

    • @JustBaselmansYT
      @JustBaselmansYT  2 ปีที่แล้ว

      Yes ofcourse you can use this code: create.arduino.cc/projecthub/electropeak/pir-motion-sensor-how-to-use-pirs-w-arduino-raspberry-pi-18d7fa and only change the LOW and HIGH arround that should work.I do not know much about the YX5300 mp3 module so no idea, you should do some more googling ;) good luck!

  • @soloman3140
    @soloman3140 5 หลายเดือนก่อน

    Amazing sir solved all problems i was facing 😁

    • @JustBaselmansYT
      @JustBaselmansYT  5 หลายเดือนก่อน +1

      That is amazing to hear! Good luck with your project👍

  • @spicyshotz
    @spicyshotz 2 ปีที่แล้ว +2

    Hi, How would you reccomend to amplify the sound in example 3? thanks.

    • @lowlink534
      @lowlink534 ปีที่แล้ว

      You can easily do that witha transistor, search for a simple transistor amp, basically you power it and put the sound cord on the other port, you just gonna know which port is which of the transistor

  • @nickst2797
    @nickst2797 2 ปีที่แล้ว

    Such a great video! I was using tone() but i wanted to perform volume control. I found toneAC, but unfortunately, the quality is not as good as the original tone(). Do you know if it is possible to perform volume control? Even with external Hardware. Thanks!

    • @JustBaselmansYT
      @JustBaselmansYT  2 ปีที่แล้ว +1

      I am actually not sure, unfortunately I have no experience with this sorry

    • @nickst2797
      @nickst2797 2 ปีที่แล้ว

      @@JustBaselmansYT Thank you!!

    • @deodeo803
      @deodeo803 11 หลายเดือนก่อน +2

      if you want volume control, u could get a potentiometer and connect it between the output speaker and the arduino.

  • @ultralaggerREV1
    @ultralaggerREV1 11 หลายเดือนก่อน

    For option three I want to add the little button that comes with the Arduino starter kits, how would I change the wiring so that every time I hit the button, it plays the audio

    • @JustBaselmansYT
      @JustBaselmansYT  10 หลายเดือนก่อน

      I would connect the button separately to the arduino and in the code only play the audio when the button is pressed. take a look at Arduino's own button examples in order to do this👍

  • @oscarbriones8580
    @oscarbriones8580 8 หลายเดือนก่อน

    Quick question! For option 2 I'm trying to do a similar scenario, but with a IR sensor. When I try to use the code you provided with the IR sensor, my Arduino goes crazy and connects and disconnects from my computer. Would you know the solution for this?

    • @JustBaselmansYT
      @JustBaselmansYT  8 หลายเดือนก่อน

      I would recommend to make sure that all parts behave like you intended without connecting them together. 1.Are you able to detect the infrared signal and writing it to your serial monitor. 2. Are you able to play a sound using a digitalWrite? If you can do both I am not sure where the problem is? Maybe someone elke can coming across your command can help you out or you can ask on an arduino forum.

  • @matteodoveri5170
    @matteodoveri5170 ปีที่แล้ว +2

    Hi! I follow every step of your tutorial but the program doesn't work successfully. I think the problem is the convertion of the file in wav. I tried to use the website that you reccommended but (I'm italian) in italy it is down. I'm very sad and frustrated because of this issue. I wish you can help me and my project. Thanks

    • @gavinwilson8554
      @gavinwilson8554 5 หลายเดือนก่อน

      could you get the website to work with a VPN?

  • @thomascastelluccio
    @thomascastelluccio 10 หลายเดือนก่อน

    For the second option how would i connect the 2 wires without a button and have it be something like everytime a servo reaches a certain position?

    • @JustBaselmansYT
      @JustBaselmansYT  10 หลายเดือนก่อน

      You do not need the button, you can just execute the code when a servo hits a certain angle, if you are able to detect this

  • @jakubbukaj4133
    @jakubbukaj4133 7 หลายเดือนก่อน

    Can i use piezo in first option ?

  • @derguutebabobauer
    @derguutebabobauer 10 หลายเดือนก่อน

    I tried third Option and it works but it's really quiet. I have a 0.2W speaker and connected it directly to VCC. Do you know if there is any way to make it louder. If I use an amplifier I overload the speaker, don't I?

    • @kylorens9537
      @kylorens9537 9 หลายเดือนก่อน

      Get a bigger speaker with more W, but then u also need amplifier

  • @hal47
    @hal47 ปีที่แล้ว

    How can tft 2.8 display video

  • @minckvantuijl8126
    @minckvantuijl8126 7 หลายเดือนก่อน

    Is it possible to use the speakers of example 2 for the configuration of example 3? or does it need some sort of amplifier?

    • @JustBaselmansYT
      @JustBaselmansYT  7 หลายเดือนก่อน

      Yes you can use both speakers for the different examples, soon there will also be a video online with a 4th example of how to play audio on an arduino. And this is in my opinion the best way, so keep on the lookout for that ;)

  • @user-cj7re6cn8o
    @user-cj7re6cn8o 7 หลายเดือนก่อน

    Hey does anyone know which module is used in the greeting card sample? Can't get the greeting card one from where I live, is it an mp3 module?

    • @JustBaselmansYT
      @JustBaselmansYT  5 หลายเดือนก่อน

      If you Google "greeting card module DIY" you should definitely find it, good luck!

  • @tillytony
    @tillytony ปีที่แล้ว

    What is the name of the third one please?

  • @subvtk
    @subvtk 4 หลายเดือนก่อน +2

    Thank you! But next time wihout the piano in background, please!

  • @gold-fox
    @gold-fox 4 หลายเดือนก่อน

    Hello!
    I'm trying to make some sort of detector that can play sounds upon a certain distance, and it'll play a different sound depending on the distance of the object and the detector.
    Do you have any idea where I could find an arduino card that could allow such a thing to happen?

    • @JustBaselmansYT
      @JustBaselmansYT  4 หลายเดือนก่อน +1

      You need an ultrasonic sensor (to measure distance), an arduino (does not matter which one) and something to play sound. Any of these 3 options can do and I also have a few other videos on ways to play audio using arduino.

    • @gold-fox
      @gold-fox 4 หลายเดือนก่อน

      @@JustBaselmansYT Oh ok. I'll see it later!
      And thanks by the way!

  • @tariareese9546
    @tariareese9546 8 หลายเดือนก่อน

    can you please tell me what you needed to solder in option 2?

    • @JustBaselmansYT
      @JustBaselmansYT  8 หลายเดือนก่อน

      Remove the button that comes with it and solder two wires to it so you interact with it using a breadboard/arduino

  • @rkjayakrishnan3997
    @rkjayakrishnan3997 5 หลายเดือนก่อน

    how to directly play sound instantly received from an Arduino mic to speaker as the response to be flashy with no delay

  • @nithitechexperimentsdiy9613
    @nithitechexperimentsdiy9613 8 หลายเดือนก่อน

    How to make it more sounder

  • @ThaMentalGod2003
    @ThaMentalGod2003 2 หลายเดือนก่อน

    but aint .wav higher quality than .mp3??

  • @paramtrx9558
    @paramtrx9558 11 หลายเดือนก่อน

    Cool Thx!

  • @mahdikhs4611
    @mahdikhs4611 11 หลายเดือนก่อน

    I just want to use my speaker as an AUX for my pc, how I can do that

    • @tbf79alexis
      @tbf79alexis 5 หลายเดือนก่อน +1

      buy a mono aux port and an amplifier for arduino speakers, wire them together and there you go

  • @shu_5d
    @shu_5d 2 หลายเดือนก่อน

    great video, but when i try to use option 2 with a 9V battery instead of usb the speaker just makes clicks and plays no music... do you have an idea how to fix it?
    edit: my 9v battery wasnt gully charged…

    • @JustBaselmansYT
      @JustBaselmansYT  2 หลายเดือนก่อน

      Hey, hope it is now working! Enjoy the project

    • @shu_5d
      @shu_5d 2 หลายเดือนก่อน

      yeah it’s working now thnaks for the video

  • @annamariakiki
    @annamariakiki 5 หลายเดือนก่อน

    hello, what speaker did you use for the first option?

    • @JustBaselmansYT
      @JustBaselmansYT  5 หลายเดือนก่อน

      It's from an old pc but every 3 watt speaker should work.

  • @user-dw2ul4kl4o
    @user-dw2ul4kl4o 9 หลายเดือนก่อน

    32 gb support fat 32?

  • @capnac3
    @capnac3 ปีที่แล้ว

    I dont know what im doing wrong but cant activate the module with the button (I'm doing method number 2)

    • @lawrencevaldez7052
      @lawrencevaldez7052 ปีที่แล้ว

      Yeah same here, the other wire connected to the button that was shipped off wasn’t connected

  • @taile-kv3ek
    @taile-kv3ek ปีที่แล้ว

    Rat dang mat tien mua va nghien cuu cac nuoc dang phat trien con nuoc ngheo thi mat thoi gian mot hai the ki nua tu ho moi lam thanh cong ok

  • @voldemortvanhellxing5898
    @voldemortvanhellxing5898 9 หลายเดือนก่อน

    What speaker was used on the 3rd option?

    • @JustBaselmansYT
      @JustBaselmansYT  9 หลายเดือนก่อน +1

      It is a 3watt speaker I think, got it from an old laptop.

  • @lasanza1438
    @lasanza1438 ปีที่แล้ว

    hey it is not working for me all i changed was i put 2 wires that i would touch together instead of a button and i am using an arduino uno R3 please help if u can

  • @JuggernautICBM
    @JuggernautICBM 10 วันที่ผ่านมา

    Nice

  • @sahiltamboli7371
    @sahiltamboli7371 ปีที่แล้ว

    what if i want to play live(current) audio (for example: from youtube) instead of playing mp3 file

    • @ishen4430
      @ishen4430 4 หลายเดือนก่อน

      you would have to use an esp8266 module

    • @sahiltamboli7371
      @sahiltamboli7371 4 หลายเดือนก่อน

      @@ishen4430 my god. So many things happened in 11 months.

    • @sahiltamboli7371
      @sahiltamboli7371 4 หลายเดือนก่อน

      @@ishen4430 I stopped working on it because a certain someone used to disturb my peace. Now that person is gone. It feels hollow from inside where I dont have anything else to do other than work to feed myself and pay rent. Dont even go to gym anymore..

  • @KabbyRobloxGamer
    @KabbyRobloxGamer 2 หลายเดือนก่อน

    I have a question, I made my humanoid Arduino, so how do I join it to my humanoid?

    • @JustBaselmansYT
      @JustBaselmansYT  2 หลายเดือนก่อน

      Can you maybe further explain the problem? These functionalities should be able to be added to most arduino projects

    • @KabbyRobloxGamer
      @KabbyRobloxGamer 2 หลายเดือนก่อน

      @@JustBaselmansYT I got it figured out now, btw I was meaning like only use arduino uno and not the bread board, now no need I got it figured out, thx btw, thx cuz I learned how to put the wires

  • @user-ix9ux3hb3o
    @user-ix9ux3hb3o ปีที่แล้ว

    Thenxs

  • @tleonard410
    @tleonard410 ปีที่แล้ว

    Where can I buy the greeting card module in @1:20

    • @JustBaselmansYT
      @JustBaselmansYT  ปีที่แล้ว

      I found mine on amazone but there are also on AliExpress

    • @tleonard410
      @tleonard410 ปีที่แล้ว

      @@JustBaselmansYT link?

    • @Chaldaean
      @Chaldaean ปีที่แล้ว

      @@tleonard410 the link is in the video description

  • @user-dw6ur6si7p
    @user-dw6ur6si7p 8 หลายเดือนก่อน +1

    YASSSSSS

  • @baldervinje1020
    @baldervinje1020 5 หลายเดือนก่อน

    i love you

  • @rokljhui864
    @rokljhui864 5 หลายเดือนก่อน

    Option 1 has the lowest latency, and can play complex sounds with dynamic volume range and reasonable quality , via 20kHz PWM.

  • @acousvnt
    @acousvnt 10 หลายเดือนก่อน +2

    I don't think background music is ideal on a video where you are demonstrating audio. I'd rather hear the thing by itself, especially in a case like this where the arduino is very quiet.

    • @JustBaselmansYT
      @JustBaselmansYT  10 หลายเดือนก่อน +1

      Thanks for the feedback, in the future I will do this differently

  • @MrMat4552
    @MrMat4552 3 หลายเดือนก่อน +5

    No need for background music as it made it worst

  • @Mokkers_stuff
    @Mokkers_stuff หลายเดือนก่อน +1

    Re:background music. Just because you can, doesn't mean you should. It detracted so much from your video, especially one that involves audio.......

  • @Yrekcaz7
    @Yrekcaz7 หลายเดือนก่อน

    4:49 ANKI VECTOR SDK EXAMPLES!?!

    • @Yrekcaz7
      @Yrekcaz7 หลายเดือนก่อน

      Oh, I'm so dumb, I had no clue this channel had much to do with those robots, but vector is literally in his pfp

    • @JustBaselmansYT
      @JustBaselmansYT  หลายเดือนก่อน +1

      Haha insane you noticed and yes, love working with the little guy and am very sad he is currently not really supported anymore :'(

    • @Yrekcaz7
      @Yrekcaz7 หลายเดือนก่อน

      ​@@JustBaselmansYTyeah, I found that out the hard way :(
      The solution is WirePod. It's a free alternative to the servers (which are down). You'll have to Google to find it since my comment with the link got held for review or something, but it's on GitHub.
      I hope that helps!

  • @nealmucklow1933
    @nealmucklow1933 2 หลายเดือนก่อน

    TURN OFF BACKGROUND NOISE WHEN RUNNING SOUND FILRS>>>GEEZE

  • @abramotolani9479
    @abramotolani9479 2 หลายเดือนก่อน

    Video is a bit good but the background music spoilt it all

  • @TheUnofficialMaker
    @TheUnofficialMaker หลายเดือนก่อน

    cut the music

  • @digimaks
    @digimaks 7 หลายเดือนก่อน +7

    I wish you bothered turning off your BACKGROUND PIANO MUSIC when playing back sounds... It interferes very badly.

  • @pkikon6983
    @pkikon6983 9 หลายเดือนก่อน

    Video is good but the background piano is annoying

  • @Gallardo6669
    @Gallardo6669 ปีที่แล้ว

    Thx for the video. But your background musik is absolutely horrible.

  • @joejimmathew7204
    @joejimmathew7204 8 หลายเดือนก่อน

    absolute bullshit
    the Option 3 did not work

  • @robertrobert5583
    @robertrobert5583 ปีที่แล้ว +119

    That piano is so irritating.

    • @ElfilinSupporter
      @ElfilinSupporter 11 หลายเดือนก่อน +8

      i don’t mind it :o

    • @acousvnt
      @acousvnt 10 หลายเดือนก่อน +19

      Especially when the demonstrations involve audio; just let us listen to the actual thing.

    • @mlemery69
      @mlemery69 8 หลายเดือนก่อน +3

      i hate to tell u theres a whole music genre around it

    • @acousvnt
      @acousvnt 8 หลายเดือนก่อน +12

      @@mlemery69 it's not the genre, it's the fact that we're trying to listen to something else at the same time.

    • @user-yb8jx2ik5m
      @user-yb8jx2ik5m 4 หลายเดือนก่อน

      It's not a fact

  • @user-um3ui1gu9t
    @user-um3ui1gu9t หลายเดือนก่อน

    Your musical taste is of no interest !
    Stop these awfull background noise !!!