PWM -> Line Out


i am new to audio and all this stuff.

I built a sample player using PWM audio output and added some buttons to trigger the samples.

Now, the quality of the output signal is not good - as expected and i would like to add a proper line signal. Whats the best way to go for it?

(I am a bit confused about all the different techniques - DDS, PWM, DAC, ....)

Pls. point me in the right direction. Thank you in advance.

If you use high frequency PWM and some filtering, you should be able to get fairly good audio quality. There are lots of ideas on audio at the ELM-Chan site here:

Thank you.
There are a bunch of interesting projects and i learned a lot.

So thats where i am:

I have a PWM output on PIN11, as you can see on the picture.
But i would like to add an amp + filters.

May be an optocoupler, if it makes sense?
Can anybody help me build a circuit that would fit?

Amp to get what signal level? Line level is around +/-1V.
PWM output is 0-5V.
Start with a resistor divider to bring the level down to 0-2V, then pass it thru a 1uF cap to get it to a 0V +/- 1V level into your current receiver of the signal.

Search for "piano tones micros" that I posted, I think in reply #4 I have a schematic showing that. Youtube video posted in that topic also.

I am a bit confused about all the different techniques - DDS, PWM, DAC, ....

Just for reference... most real DACs use PCM. WAV files are PCM, and if you play an MP3 or AAC on your computer or iPod, it get's decompressed to PCM before being sent to the DAC. Your soundcard, CD player, and iPod all have a DAC.

If you capture analog audio with the Arduino's ADC, you are getting PCM data.

The Audacity website has a [u]Digital Audio Tutorial[/u]. It shows how digitized audio (PCM) is a series of samples (CD audio has 44,100 samples per second) where each sample represents the height/amplitude of the "wave" at one point in time. You "connect the dots" (and filter) to reconstruct the analog waveform.