Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
BaSkA

[ARDUINO UNO] Playing sound files

Recommended Posts

Posted · Original PosterOP

Hello everybody,

 

I have little DSP (Digital Signal Processing) project going on in college and I'd like some tips/code, if you have any.

 

I am implementing an adaptative filter using the LSM algorithm on the Arduino. However, due to the board's limitations, I can't do the real-time adaptative filter so, what I'm going to do is just do all the calculation in SimuLink/MATLab on the computer and just export the sound file to filter what I need it to filter. It's not gonna be an adaptative filter anymore, rather, it'll just be a regular filter but it will do the trick.

 

What I need help with is how to play the sound files and in which extension it should be. I've been studying for a while and google, arduino guides and tutorials kind of help but, anyway, I'm still suffering because it doesn't want to work. Maybe I have a bad speaker but, either way, if you have any experience with playing sounds with the Arduino or know a good source of information, I'd appreciate it.

 

Thanks for your time.


CPU: Intel Core i7-4790k | CPU Cooler: Noctua NH-D15 | Motherboard: ASUS Sabertooth Z97 MARK 1 | Memory: Kingston HyperX FURY 16GB 1866MHz | GPU: Gigabyte GeForce GTX 770 4GB Windforce


Storage: Samsung 840 EVO | PSU: CM Silent Pro 720W | Case: Phanteks Enthoo Luxe | Headset: Corsair Vengeance 2100 | Keyboard: Logitech G710+ | Mouse: Razer DeathAdder Chroma


"You see, one can only be angry with those he respects." - R. Nixon

Link to post
Share on other sites
Posted · Original PosterOP

Lol, I used the arduino UNO with sound files a while ago.

I used a tutorial file with a pitches.h complimenting file for it, i'll get you a link.

 

http://arduino.cc/en/Tutorial/Tone

 

you have to tinker around a bit to make it right, but it works.

 

I've been playing with tone() and tune() but those seem to need frequencies and notes... I'm trying to play a file, without having to figure out the frequency every X miliseconds...

 

By the way, did you use a speaker like this:

LXF104.tut_arduino.speaker.jpg ?

 

Thanks anyway!


CPU: Intel Core i7-4790k | CPU Cooler: Noctua NH-D15 | Motherboard: ASUS Sabertooth Z97 MARK 1 | Memory: Kingston HyperX FURY 16GB 1866MHz | GPU: Gigabyte GeForce GTX 770 4GB Windforce


Storage: Samsung 840 EVO | PSU: CM Silent Pro 720W | Case: Phanteks Enthoo Luxe | Headset: Corsair Vengeance 2100 | Keyboard: Logitech G710+ | Mouse: Razer DeathAdder Chroma


"You see, one can only be angry with those he respects." - R. Nixon

Link to post
Share on other sites

17855-dscn3894.JPGI used something like this. I did it first on a "sparkfun lilypad" which had one built in, and have done it on the uno with one like this.


Diamond 5 in League :)

Link to post
Share on other sites
Posted · Original PosterOP

-snip-

I used something like this. I did it first on a "sparkfun lilypad" which had one built in, and have done it on the uno with one like this.

 

But isn't that like a motherboard speaker that can only play those "8-bit sounds"?

 

I need a speaker that can play frequencies of 30Hz and under... I'm trying to cancel/filter/attenuate the sound of a spinning fan from a home-made power supply.


CPU: Intel Core i7-4790k | CPU Cooler: Noctua NH-D15 | Motherboard: ASUS Sabertooth Z97 MARK 1 | Memory: Kingston HyperX FURY 16GB 1866MHz | GPU: Gigabyte GeForce GTX 770 4GB Windforce


Storage: Samsung 840 EVO | PSU: CM Silent Pro 720W | Case: Phanteks Enthoo Luxe | Headset: Corsair Vengeance 2100 | Keyboard: Logitech G710+ | Mouse: Razer DeathAdder Chroma


"You see, one can only be angry with those he respects." - R. Nixon

Link to post
Share on other sites

Hello everybody,

 

I have little DSP (Digital Signal Processing) project going on in college and I'd like some tips/code, if you have any.

 

I am implementing an adaptative filter using the LSM algorithm on the Arduino. However, due to the board's limitations, I can't do the real-time adaptative filter so, what I'm going to do is just do all the calculation in SimuLink/MATLab on the computer and just export the sound file to filter what I need it to filter. It's not gonna be an adaptative filter anymore, rather, it'll just be a regular filter but it will do the trick.

 

What I need help with is how to play the sound files and in which extension it should be. I've been studying for a while and google, arduino guides and tutorials kind of help but, anyway, I'm still suffering because it doesn't want to work. Maybe I have a bad speaker but, either way, if you have any experience with playing sounds with the Arduino or know a good source of information, I'd appreciate it.

 

Thanks for your time.

While I have not personally played any music or sounds on my own Arduino (or ATMega chips, because they're the brains of the Arduino boards) I know It's possible using the built-in DAC.

However, your DAC will need an amplifier as the built-in one is very weak. Next to that you'll also want to look up some external EEPROM memory to store the files in (Unless they're small in which case you can directly embed it in your code).

 

Here's example code on playing PCM through the DAC http://playground.arduino.cc/Code/PCMAudio

And here's the datasheet on the ATMega328 http://www.atmel.com/Images/doc8161.pdf

 

It might be beneficial to program using Atmel Studio considering the overhead the Arduino IDE code brings, however that depends on how comfortable you are with messing with the ATMega's registers in C or C++. The performance gains, if you're a good programmer, will be worth it.

 

Let me know if that helps any. I'm a bit late to the topic; I never really explored the subforums that much.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×