Hi, Sorry, that patch did not work. Result : Audio file not played.Instead, there were lot of glitches-only glitches.I have noticed that the glitches came out as a stream (loudest at the start and diminished along the time line and died in few seconds).But that was from "Bare minimum" sketch. When I tried the " Bare minimum with Debug", it gave a continuous tone of 125 hz approx.(No audio file content played).But, sketch examples with worker (bare minimum with worker,bare minimum with worker with debug),worked normally,of course with the glitch. Could you please explain what exactly the patch modifies. Anyway, thank you for trying to help me.

manmachine.

Tuttut

Hi,sorry, I did the patch using a too old local copy of the library on my smartphone on-the-go and got an too old lib file. Now I edited my former post, please try to apply the patch again on SimpleSDAudio-Lib V1.03 (the current one). This time I tested it a little. Unfortunately actually there is no flag that tells you if the file played at least once...Please try again and tell me if it is working for you.

BTW: The patch catches the moment when the worker function puts the last sector (or part of it) of the audio file in the playback buffer. In this case, it waits endless (and therefore precise) until the buffer is completely empty (_Buflen == 0). In this moment it triggers the play() function, which starts the playback again. This is how the play() function works - if playback is still playing it restarts playing from start again (done by calling internally the stop() function). The stop() function resets all the pointer and the buffer for the playback.

Tuttut

Hi@manmachine: Hm, I thought about my quick solution and it is wrong - the issue is that the buffer is completely empty when issuing play and that play first reads a whole sector of 512 bytes from card before it starts playback again. This should lead to a fast but not gapless start. I think it will need a bigger overwork to get around this. I could think about modifying the lib to read the sectors byte-wise which will make the lib slower but more flexible. Audio processing will then become possible like gapless playback, fine-tuned playback tempo and mixing. But the lib might be then not as simple to use as now.

@meow...: Please provide more info what is working and what not. Error code of lib or just no sound? Or just no sound in bigger software project?

I'd like to see/learn more about making this Awesome library better sounding with the use of filter/amp?

Small? (all SMD?)

Is there a schematic posted for it?

I am VERY happy Tuttut released this lib.. it was a HUGE missing part of the Arduino community (easy audio)..but as 'stock' the volume is just 'meh'... so it needs some filters and an amp for sure for more sound hungry projects..

Tuttut

The lib use only the timer that is bound to the output port. It might be possible to even use analogWrite on neighbor ports that use thevsame timer but I never tested it, so please do so. But in this case the PWM is fixed to 8-Bit and the sampling rate of audio-playback, which should be no issue for LED dimming.

Tuttut

Hi,the thing is that people often don't understand where the noise in such systems come from and try to build filters to try to filter out 8-bit noise. This is just stupid, as the noise of having too less bits is usually even distributed over the audible spectrum and not only at the high frequencies. With very good algorithms that do dithering you can try to buy better noise performance at the cost of spectrum - in such a case the noise is not longer evenly distributed over the spectrum (this is called noise-shaping, SOX can do this under special conditions, see http://sox.sourceforge.net/SoX/NoiseShaping. But this only makes sense if you have a high sampling rate AND you are using an external filter. You can do a simple experiment to understand 8-bit noise: Convert your audio file at your PC to 8-bit and listen to it and you will hear the static noise. I tried this using Audacity and the result is pretty much what I get with the Arduino 8-Bit output.

But: If you want an easy way to get rid of the noise go for double-PWM-Ouput aka 16-bit mode. Often you only need one additional output port and one resistor to get a much better sound with so less noise that you don't even think about filtering (which is often useless anyway!). If you want it cheap try my circuit from this entry (2nd post circuit for 16-bit): http://arduino.cc/forum/index.php/topic,158024.0.html. Just build one half of it if you stick with Mono-Output. The nice thing is: It is much louder on a speaker than a port-pin, so no need for additional amplifier and much less noise and still cheap. I tested it several times, I'll try if I can do it a little smaller using transistors.

1.) can 'dual' output be done on an UNO/Duemilanove? (I though I had read only on Mega's? could be wrong of course.. I thought i had 'tried' it originally and dont recall seeing (hearing) a difference.. however that could also have been user/set-up error.. LOL

also.. as to the noise I guess I was referring to.. I mean more specifically wen you run/do PWM actions 'while' playing audio.. you can hear the hum/buzz..etc..etc playing over the audio or interfering...etc..

unfortunately.. I dont have any 74AC14 chip.. (never even heard of them before now) ..

but I do have a LM386 amp laying around..?

form the schematic though.. looks like only a:

coupling cap on the power rails2 x resistors..and the DC blocking cap on the PIN9 output?

actually looking again.. is that two caps for the decoupling? hard to see in the fritzing image)

Are you saying that just using the DUAL PWM output will (not only help eliminate the noise) but increase the volume.. to where you say/think/believe no amp is even needed to boost volume?

I currently only have things set-up for single (pin9) output.. and actually used pin10 as the CS pin for my SD card..