dds generated square wave errors

creating sound with microcontrollers

dds generated square wave errors

Postby chris on Mon Sep 08, 2014 8:38 am

If we generte square waves with a DDS ( http://en.wikipedia.org/wiki/Direct_digital_synthesizer ) we will have some audible errors.

In this thread I will try to find some technik for audible improvements of square wave sounds.
In the zip file are 2 example sounds sampled with 8kHz.
One has a frequency with 1000Hz which fits nicely to the 8kHz sampling frequency.
The second sound has a frequency of 1100Hz which interferes with the sampling frequency and produces audible beats.
Attachments
squareWaveDdsError.png
squareWaveDdsError.png (72.67 KiB) Viewed 2484 times
squareWave.zip
(779 Bytes) Downloaded 310 times
chris
 
Posts: 289
Joined: Sun May 25, 2008 7:21 am

Re: dds generated square wave errors

Postby chris on Mon Sep 08, 2014 1:59 pm

If we sample a real square wave signal we will get more discrete values than zeros and ones.
Close to the edges of the signal we get also intermediate values. This is because real signals are band limited in opposite to artifical DDS square wave signals where the algorithm which generates them assumes they have infinite band with.
In common digital signal processing systems we have anti-aliasing-filters in front of the ADC. In such systems this filter has the main influence on the shape of the sampled wave form.
We can produce an approximation of such a square wave signal by the following signal chain:

Signal chain for a square wave sampled with 8kHz:
DDS-square wave with 64*8000Hz ==> sinc fir low pass with 4000Hz ==> subsampling to 8000Hz

If we produce such a signal, the audible noise vanishes as you can hear in the attached wav-file.
Attachments
square1100Hz_LpCorrection.wav.zip
(840 Bytes) Downloaded 295 times
squareWave_Fs8kHz_bandLimit4kHz.png
squareWave_Fs8kHz_bandLimit4kHz.png (9.37 KiB) Viewed 2406 times
chris
 
Posts: 289
Joined: Sun May 25, 2008 7:21 am

Re: dds generated square wave errors

Postby chris on Thu Sep 11, 2014 12:38 pm

With microcontrollers a square wave may be easily produced by a timer with high resolution.
For some problems this may be a better solution than generating the signal with a DDS-system.

But much more difficult it is to produce a sawtooth signal.
Attached you will find two sawtooth sweeps from 100Hz to 1kHz with a sampling rate of 8kHz.
The first is created with a common DDS and you can hear a loot of noisy beats.
The second one is made the signal chain proposed in this thread and it sounds much clearer.
Attachments
sawtoothSweep.zip
(47.81 KiB) Downloaded 283 times
chris
 
Posts: 289
Joined: Sun May 25, 2008 7:21 am

Re: dds generated square wave errors

Postby chris on Mon Sep 15, 2014 7:04 am

Linksammlung:

1999 Analog Devices, Inc.:
A Technical Tutorial on Digital Signal Synthesis
http://www.analog.com/static/imported-f ... 2-2-99.pdf

DDS spur reduction techniques
http://ttcla.org/vsreinhardt/DDS%20spur ... niques.pdf
chris
 
Posts: 289
Joined: Sun May 25, 2008 7:21 am

Re: dds generated square wave errors

Postby chris on Fri Sep 26, 2014 1:16 pm

The following files contain a normal DDS square wave sweep from 440Hz to 1200Hz and a special synthesized square wave sweep called "synth16".

In the normal DDS square wave sweep the artifact noises can be heart quite good.
Attachments
squareSweep.zip
(38.13 KiB) Downloaded 271 times
chris
 
Posts: 289
Joined: Sun May 25, 2008 7:21 am


Return to sound

Who is online

Users browsing this forum: No registered users and 1 guest

cron