Go Down

Topic: New library for PWM playback from SD cards: SimpleSDAudio (Read 45 times) previous topic - next topic


Hi Tuttut,

Great work, many thanks for this!!!

As for audio filtering, I've tested with a "Passive, first order low-pass RC filter", which seems to clean out most of the noise with just a resistor and a capacitor, see http://en.wikipedia.org/wiki/Low-pass_filter.
I found a  1kohm resistor and a 2.2qf capacitor work out for me, but to be honest, I used a trial and error approach...
Not sure if this even comes in the neighborhood of your buffer approach, but I found the improvement more than adequate for my project.

Once again, many thanks!!!

Regards Dennis


@cobra18t: I like your attempt of porting my library. I included your header-file-stuff for earlier Arduino versions but I never tried the lib on older Arduino IDEs. For SD access you can use my reduced SD library - you have to adapt the sd_l0-files, but the other layers should work quickly on any architecture after that.

@PWBarret: The servo-library (re)initializes the servos after detaching and re-attaching all servos. So try this order: 1. SimpleSDAudio: init -> Play... -> deInit, then Servo: Attach -> control -> detach, then continue with SimpleSDAudio. Both libraries can not work the same time because they share the same timers.

@gateway: You are right, a RC filter might often be an easy way to improve the sound quality on PWM outputs. It works better the higher the PWM frequency is -> SimpleSDAudio uses the highest possible frequency and therefore a RC filter should work pretty well.



Oct 27, 2012, 01:15 am Last Edit: Oct 27, 2012, 03:20 am by cobra18t Reason: 1
@Tuttut: I saw my changes in the newest version, I will have to try it out in 0023. Thank you for abstracting the SD card library so that I only had to change the "0" level. That made it much easier.

I have a video of a basic 8-bit 78.125kHz stereo sample running on my ChipKit Uno32 using a minimal setup. Check it out:



Thanks for the suggestion...
Maybe it's the servo library that's not properly honoring the detach method then...
If I never attach the servos at all, the sound is good.
But if in my PlaySD function, if I detach both servos upon entry, then init, play, deinit, the sound is garbled.


Dec 14, 2012, 10:55 pm Last Edit: Dec 14, 2012, 10:57 pm by xl97 Reason: 1
Hi Tuttut-

I havent kept up with things since you first posted the initial library.. (I see its come very far)..  great job!.. and a HUGE benefit to the community IMHO! (thanks)

I am going to re-read the posts.. and go to your site and download the latest..etc..

1.) Does the Arduino board/version matter to use this library? Can the board be a 3.3v @8Mhz board and still be able to utilize this lib?

2.) how much space/resources do we have to 'do' other things WHILE playing audio back?

3.) I saw mention of it being able to be used with IDE v23?  IS this added/supported now? or must I use the 1.x+ IDE's?

I have a project in mind that I intend to use this lib for...  but the board/pcb is a 'VERY' minimal Arduino circuit running at 3.3v and internal clock @ 8Mhz and SD socket...

(actually.. Im trying to run it off a coin cell.. think thre will be enough voltage (3.0v I believe most coin cells).. if there is enough current for the SD card?

I remember there needs to be a cap in-line with the speaker out line...  so I'll probably look at adding that 'on-board' to the pcb itself.....so end result is just solder speaker wires to pcb pads.  (or reading up on the low pass filter to put on board)

off to look over the public methods available to us.. and check for any examples on how to utilize each one.


Go Up