Show Posts
Pages: [1] 2 3 ... 5
1  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: February 14, 2014, 04:48:39 am
Gap-less playback from SD is always a challenge. Even the .play() function might be fast enough, at least the .setFile() function will always do a lot of searching through the FAT filesystem. First try to play the same file again and again using a loop like:

Code:
while(1) {
   if(SdPlay.isStopped()) SdPlay.play();
}

If this works ok for you, you might youself patch the library in a way that the information that is retrieved by setFile is stored somewhere in RAM and used for quicker change of the file to playback. But this might be not the right starting-project for beginners...
2  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: November 11, 2013, 07:18:55 pm
Hm, *looking into crystal ball*, try starting with the examples provided by the library. Use Arduino IDE V1.0.x instead of beta versions in case of build trouble.
3  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: October 14, 2013, 06:39:12 pm
Hi,
your flags seem to be correct as well as the file format. Of course you need good quality audio material if you want good results. Maybe you have to swap the pwm pins, try playing in 16 bit mode and test what you hear on each of both channels by connecting only one of them to the input of the circuit where the resistor with the lower value is.
On one channel you should hear the sound in good but 8 bit quality and on the other one you should hear loud noise when the 16-bit file is playing. this goes later to the input with the higher value resitor. With both outputs combined you have to adjust the poti the lowest noise. The quality should be then less noisy than 8 bit mode.
4  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: October 10, 2013, 12:03:25 pm
Hi,
sorry that I have to say that, but I think both IC's are not the best choice.

Your CMOS inverter is pretty slow - remember that the PWM is operating with full 16 MHz resolution, so 1 bit change means a length of 62ns, whereas your inverter is way slower than that! Even if that might not be the source of your issues this could make the audio quality worse. I recommend fast ones like SN74HC14 or even SN74AC14. The last one is so powerfull that it is often enough to connect the speaker just to a bunch of paralleled inverters. But for 16-Bit you will need a little modification then (the resistors are then too big).

Second: You are using a class-D amplifier. Have you tried it before using some other active speakers or line-in from other amplifier? The issue is that my circuit is lacking a low pass filter and in combination with Class-D amp this might not be a good idea. So just try to add a capacitor between ground and the point where the 1k and 220k are connected together. Experiment with different values e.g. 1nF, 100nF up to 1uF.
5  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: October 09, 2013, 04:57:50 pm
Hi, want to add something:

Please also beware of one common made mistake:

If you want to use the 16-Bit feature of the library, you have to set the correct configuration flags: If you want 1 channel mono output but with 16-Bit you have to choose SSDA_MODE_STEREO and not SSDA_MODE_MONO to enable that "magic additional pin that makes audio better".
6  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: October 09, 2013, 04:48:24 pm
Hi, I see no reason why there should be an audible tone because the PWM frequency is ~62kHz for 16 MHz and ~31kHz for 8 MHz controllers. I have this circuit here in use and if playback stops there is not such a tone. Of course you can try to override the output pin to input when not in use, but I don't think that it will help. BUT: If you really use a 74HC14 or something like that please ensure that all inputs of unused buffers are connected to GND. If there is still noise also try to improve the supply of the buffer by placing a small 100nF capacitor in parallel to the bigger one. Please let us know here if anything of that I've written helps.
7  Using Arduino / Audio / Re: SimpleSDAudio 16-Bit Playback Mono on: July 22, 2013, 04:42:38 am
Hi, for 16-Bit playback you have to set it to something that does 2 channel output, so try SSDA_MODE_STEREO. On both PWM outputs there should be 'something', one sounds only quite noisy - that goes to the part where the 1k-pot is.
8  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: May 10, 2013, 11:55:03 am
Hi, usually this lib does not do loud clicks, maybe a little after init, but not when playing files. So maybe your file is not good - add a fade-in to the wav file (e.g. using Audacity) before converting it.

9  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: April 13, 2013, 12:22:38 pm
Timer2 is usually not used in Arduino, so if you do your PWM stuff with that timer instead of timer0 it should work. For the other way: The patch is in the "patches" folder of SimpleSDAudio. It provides a patched wiring.c file which replaces the wiring.c in the Arduino folder.
10  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: April 13, 2013, 03:44:38 am
Hi,
the reason is that SimpleSDAudio uses millis() in sd_l0.h for timeout and timing purposes. Unfortunately, timer0 is heavily used by the Arduino library for all kinds of Timings, like millis, delay etc., so it is a good idea not to figure with it. But: two interesting OCR-Outputs are only availible at this timer, that might be used even for 4-channel output with my lib even on ATmega328. On the other hand, timer2 is not as interesting, so I build a patch that moves all internal Arduino timing functions from timer0 to timer2. This patch can help you too. You find it already in the deepths of SimpleSDAudio library. Try it, if you got stuck ask again.
11  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: April 11, 2013, 04:03:49 pm
Hi,
with standard Arduino (with ATmega328) two PWM outputs for SimpleSDAudio are availible, either for stereo 8-bit or mono 16-bit. For mono 16-bit you have to set it up like it would be stereo mode and you have to use the 16-bit SOX batch-files for processing. You end up with 2 PWM outputs, one playing the 8-bit sound and one playing loud "noise". But when you add this noise-channel to the other using those pots, the result will be much less noise.

For start you can also use a 74HC14 chip. Often in catalogs these chips have numbers starting with SN, so SN74AC14 is also the right one.

If you want to use your LM386 amp do the 16-bit combining before routing it to the amp. Use this circuit: http://hackerspace-ffm.de/wiki/index.php?title=Datei:SSDA_Simple16bit.png. But without the 74HC14 or 74AC14 it is hard to get rid of the noise coming from PWM-LED-Dimming.

Good power deblocking is essential for audio quality. Try to add some caps, 100nF but also one much bigger electrolytic cap in the 10uF to 100uF region. This is also done in my Fritzing schematic, so you got it right.

Dual-PWM output does not increase the volume itself (only if you use bridge-mode without any additional amplifiers). I use two PWM outputs with stereo-setting (SSDA_MODE_STEREO) and combine those to 16-bit mono for better audio quality. The 74AC14 will then increase volume and decrease noise if decoupled correctly by filtering the uC-noise out on the PWM outputs.
12  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: April 11, 2013, 02:45:28 pm
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.
13  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: April 11, 2013, 03:12:04 am
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.
14  Using Arduino / Audio / Re: Cheap PWM amplifier for loudspeakers based on 74AC14 on: April 02, 2013, 05:44:36 pm
Hi,
here the same for stereo output with 16-bit, therefore much less audible noise when use with SimpleSDAudio in 16-Bit mode (need Mega-Arduino for stereo!). Works pretty well, albeit a little bit less volume than the mono version, but still loud enough for many applications. Trim poti to lowest noise (somewhere around 1k for 8 Ohm speakers).
You can use the SimpleSDAudio test file cali16b.bhs that contains a special tone that should be vanish if the poti is trimmed correctly.

Have fun,
Tut
15  Using Arduino / Audio / Cheap PWM amplifier for loudspeakers based on 74AC14 on: April 02, 2013, 05:39:35 pm
Hi,
I developed a cheap class-D amplifier for PWM outputs to direct drive a speaker of 4 ohms or more. It is based on a 74AC14 which contains 6 inverting schmitt-triggers. The AC variant allows very high output currents, more than most other families. It is available at around ~0,30 EUR here in Germany. The amp give good volume, much more than what is possible from the Arduino ports directly. A bipolar electrolyte capacitor should be used to protect speakers from DC, I used a unipolar one, but that is not recommended. The coils are optional and just needed for RF reject on longer speaker cables that act as radio at such high slew rates. Any coil with about 100┬ÁH that can handle about 0.2A will do.

The circuit does not contain a low-pass filter and is therefore for PWM rates in the non-hearable region. Some noise on low volume parts of music can be noticed due 8-bit output. This circuit can also be used with SimpleSDAudio library.

Enjoy,
Tut
Pages: [1] 2 3 ... 5