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!
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 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
@@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
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?
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 😆
Hi, fantastic video. I'm interested in option number 1 but you haven't said the name of the speaker in the video so I don't know how to buy it. ope you can still give me the name o the speaker, thank you
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?
look,this video is pretty old but i will explain it Yes,because audio needs the pwm output so it can level up or level down voltage intensity meaning that you really need that pwm,like there is no way you would play a audio only using HIGH,LOW
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.
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
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
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?
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.
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
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👍
@@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
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 ;)
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?
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?
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.
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!
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…
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...
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!
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
@@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..
@@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!
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!
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
@@lowlink534 Slight correction, the Arduino clock speed is 16MHz. That's mega as in millions, so plenty for this kind of project.
@@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
@@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
@@lowlink534 No worries I've been confused myself before
Fantastic video, fantastic instruction, fantastic presentation, plus you included a pro/con list and timestamps. Instantly subscribed.
cool video, but would be better if you muted bgm while arduino was playing sounds...
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?
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 😆
Sounds great! Good luck with the project and the start of hopefully a long arduino journey ;)
No need for background music as it made it worst
Hi, fantastic video. I'm interested in option number 1 but you haven't said the name of the speaker in the video so I don't know how to buy it. ope you can still give me the name o the speaker, thank you
First of all thank you so much :) It's from an old pc but every 3 watt speaker should work.
@@JustBaselmansYT Thanks
Re:background music. Just because you can, doesn't mean you should. It detracted so much from your video, especially one that involves audio.......
Option 1 has the lowest latency, and can play complex sounds with dynamic volume range and reasonable quality , via 20kHz PWM.
Thanks, its very good demonstration. I tried to access the files Zip and the sketch but without success?
Amazing sir solved all problems i was facing 😁
That is amazing to hear! Good luck with your project👍
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?
almost infinite. like how much fits on the sc card
May I ask how can I add more bigger speaker.
I have one question , in the second method (sd card) is the output digital audio (pwm) ?
look,this video is pretty old but i will explain it
Yes,because audio needs the pwm output so it can level up or level down voltage intensity
meaning that you really need that pwm,like there is no way you would play a audio only using HIGH,LOW
Is there a line of code for method 1 to increase or decrease volume?
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.
Thanks for the feedback, in the future I will do this differently
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
could you get the website to work with a VPN?
Hi, How would you reccomend to amplify the sound in example 3? thanks.
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
but aint .wav higher quality than .mp3??
Yeah, .wav is uncompressed so it can go from audioPotato quality to top notch 192khz/24 bit and such
How do i put a timer in #2,its for a automatic bell with speaker for our school project ,PLEASE HELP ME😢😢😢😢😢😢😢😢
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?
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.
@@JustBaselmansYT Oh ok. I'll see it later!
And thanks by the way!
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?
Make a new one
can you do multiple sounds with option one? Different tone for every bin?
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
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👍
I have a question, I made my humanoid Arduino, so how do I join it to my humanoid?
Can you maybe further explain the problem? These functionalities should be able to be added to most arduino projects
@@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
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?
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
I wish you bothered turning off your BACKGROUND PIANO MUSIC when playing back sounds... It interferes very badly.
good video but please stop background music when testing audio
Is it possible to use the speakers of example 2 for the configuration of example 3? or does it need some sort of amplifier?
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 ;)
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
how to directly play sound instantly received from an Arduino mic to speaker as the response to be flashy with no delay
@justbaselmans is There any options to put 2 audio from sd card?
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?
If you Google "greeting card module DIY" you should definitely find it, good luck!
hello, what speaker did you use for the first option?
It's from an old pc but every 3 watt speaker should work.
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?
can you please tell me what you needed to solder in option 2?
Remove the button that comes with it and solder two wires to it so you interact with it using a breadboard/arduino
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?
Get a bigger speaker with more W, but then u also need amplifier
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?
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.
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!
I am actually not sure, unfortunately I have no experience with this sorry
@@JustBaselmansYT Thank you!!
if you want volume control, u could get a potentiometer and connect it between the output speaker and the arduino.
I just want to use my speaker as an AUX for my pc, how I can do that
buy a mono aux port and an amplifier for arduino speakers, wire them together and there you go
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…
Hey, hope it is now working! Enjoy the project
yeah it’s working now thnaks for the video
OMG I loved it like anything 😍 💕
its awesome dude.
What speaker was used on the 3rd option?
It is a 3watt speaker I think, got it from an old laptop.
How to make it more sounder
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...
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!
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
im doing option 2
I dont know what im doing wrong but cant activate the module with the button (I'm doing method number 2)
Yeah same here, the other wire connected to the button that was shipped off wasn’t connected
What is the name of the third one please?
woww thanks for the video 👍
TURN OFF BACKGROUND NOISE WHEN RUNNING SOUND FILRS>>>GEEZE
Thank you! But next time wihout the piano in background, please!
How can tft 2.8 display video
what if i want to play live(current) audio (for example: from youtube) instead of playing mp3 file
you would have to use an esp8266 module
@@ishen4430 my god. So many things happened in 11 months.
@@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..
Thanks for that amazing video! i subscribe!
Where can I buy the greeting card module in @1:20
I found mine on amazone but there are also on AliExpress
@@JustBaselmansYT link?
@@tleonard410 the link is in the video description
DFPlayer mini by Dfrobot $6 US for original, cheaper for clones. Way better than all those
32 gb support fat 32?
Can i use piezo in first option ?
yes
Thanks man, You saved me!
4:49 ANKI VECTOR SDK EXAMPLES!?!
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
Haha insane you noticed and yes, love working with the little guy and am very sad he is currently not really supported anymore :'(
@@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!
Video is a bit good but the background music spoilt it all
thank you it worked👍
That piano is so irritating.
i don’t mind it :o
Especially when the demonstrations involve audio; just let us listen to the actual thing.
i hate to tell u theres a whole music genre around it
@@mlemery69 it's not the genre, it's the fact that we're trying to listen to something else at the same time.
It's not a fact
Thenxs
Cool Thx!
Video is good but the background piano is annoying
YASSSSSS
Nice
cut the music
Thx for the video. But your background musik is absolutely horrible.
i love you
absolute bullshit
the Option 3 did not work
Your musical taste is of no interest !
Stop these awfull background noise !!!
Hey, what kind of speaker did you use on option number three?
i used some old 4 ohm speaker