Go Down

Topic: PWM -> Line Out (Read 2498 times) previous topic - next topic

bnzlovesyou

hi,

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.

jremington

#1
Jan 25, 2014, 05:25 pm Last Edit: Jan 25, 2014, 05:27 pm by jremington Reason: 1
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: http://elm-chan.org/he_a_e.html

bnzlovesyou

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?

CrossRoads

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.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

CrossRoads

#4
Jan 28, 2014, 09:50 pm Last Edit: Jan 28, 2014, 09:51 pm by CrossRoads Reason: 1
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.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

DVDdoug

Quote
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 Digital Audio Tutorial.   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.


Go Up