This is only a preview of the May 2010 issue of Silicon Chip. You can view 29 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "A Solar-Powered Lighting System":
Items relevant to "Build A Compact 12V 20W Stereo Amplifier":
Items relevant to "Low-Power Car/Bike USB Charger":
Items relevant to "Digital Audio Signal Generator, Pt.3":
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
In the March and
April 2010 issues, we
described the design
and construction of
our new Digital Audio
Signal Generator.
The final article this
month has the driving
instructions.
By NICHOLAS VINEN
A High-Quality Digital Audio
Signal Generator; Pt.3
D
RIVING THE Digital Audio Signal
Generator is straightforward. In
operation, it delivers an output signal (analog and/or digital, depending
on the configuration) as soon as it is
switched on and the LCD initially
shows the current signal generation
mode. There are five such read-outs,
one for each mode: locked, independent, mixed, pulsed and sweep.
In each case, the Up and Down
buttons change the current mode
and the display adjusts to show the
corresponding reading. Pressing the
Select button (in the centre of the main
cluster) switches the LCD from the
signal generation mode read-out to the
setting read-outs. When this is done,
signal generation continues according
74 Silicon Chip
to the last mode selected.
Changing the setting read-out (done
using the Up and Down buttons) has no
affect on the current signal generation
mode. There are seven different setting
read-outs. Pressing the Select button
again returns the unit to the signal
generation mode read-out.
In other words, the Select button
toggles between the current signal
generation mode read-out and the
setting read-out. The active generation
mode is always the mode which was
last selected.
Left & right buttons
On most read-outs, the left and right
buttons allow you to move a cursor
across the display. The only excep-
tion is the Status read-out where these
two buttons have other effects (more
on this later). In practice, the cursor
can only move to locations which
show values that can be adjusted or
activated.
When the cursor is visible, pressing the Up and Down buttons will
modify the indicated setting rather
than changing the current read-out.
Pressing the Select button or moving the cursor past the first or last
setting hides the cursor and the Up
and Down buttons can once again be
used to change the current mode and/
or read-out.
This system may sound complicated
but once you try it, it will quickly
start to make sense. In other words, it
siliconchip.com.au
sounds more complicated that it really
is and the process is quite intuitive
once you understand the basics.
Table 1: Signal Generation Mode Readouts
Locked Mode Readout: top line = signal frequency
(both channels) and left channel amplitude; bottom
line = channel phase difference and right channel
amplitude.
The mute buttons
There are two additional buttons on
the unit – Left Mute and Right Mute.
Pressing them toggles the mute status
of the corresponding channel at any
time. For example, if you press the
Left Mute button and the left channel
is currently enabled, it will be disabled
and vice versa.
The mute status is shown on the
status read-out and also on each mode
read-out. For sweep mode, if a channel
is muted, an “l” (indicating the left
channel) and/or an “r” (indicating the
right channel) is shown at the top of
the display. For the other four modes,
a muted channel is shown by changing
the minus sign in front of each amplitude setting to an underscore.
If you press the two Mute buttons
simultaneously, the left and right
channel settings will be swapped.
This includes frequency, amplitude
and phase (when applicable), as well
as the mute status.
Table 1 shows what each generation
mode read-out looks like by default
and highlights all the settings that can
be changed. There is also a description
of the function for each setting.
More mode information
As stated in the original article, the
output frequency can be set at up to
half the sample rate (ie, 48kHz) in steps
of 1Hz. Depending on which frequency
digit you select with the cursor, pressing the Up and Down buttons will add
or subtract 1Hz, 10Hz, 100Hz, 1000Hz
or 10,000Hz.
The amplitude is set in similar
fashion and the range is from 0dB to
-98dB in 1dB steps.
If you increase the attenuation past
-98dB, the read-out changes to “off”
and the signal is muted.
Note that as you get close to -98dB,
the actual signal amplitudes become
so small that the error increases and
some values have an identical result.
In fact -96dB, -97dB and -98dB generate the same amplitude due to the
16-bit precision of the scaling factor.
However, for attenuation down to
-60dB, the scaling is basically perfect.
Beyond that, the measured values are
as shown in Table 2.
Note that these measurements also
include scaling errors from the DAC
siliconchip.com.au
Independent Mode Readout: top line = left channel
frequency and amplitude; bottom line = right
channel frequency and amplitude.
Mixed Mode Readout: top line = frequency and
amplitude of wave 1; bottom line = frequency and
amplitude of wave 2.
Pulsed Mode Readout: top line = frequency (both
channels) and pulse-on amplitude; bottom line =
pulse-on time (0-9999ms), pulse-off time (0-999ms)
and pulse-off amplitude.
Sweep Mode Readout: top line = start frequency
and amplitude (both channels); bottom line = finish
frequency (both channels), sweep time (0.1 - 99.9s)
and off-time (0-98s & manual).
Note: values inside green boxes can be selected and varied using the front panel pushbuttons.
itself, so they are only a guide as to the
unit’s actual precision.
Keep in mind that when adjusting
the attenuation, pressing the Up button increases the attenuation and thus
decreases the signal amplitude.
The only other mode settings (aside
from frequencies and amplitudes) are
time periods. In the case of pulsed
mode, they are specified in milliseconds and have a range of 0-9999 (just
under 10 seconds) or 0-999 (just under
one second). In sweep mode, they are
specified in tenths of a second and
seconds, with a range of 0-99.9 seconds
and 0-99 seconds respectively.
If you switch away from a mode and
then back again later, the previous settings are typically retained. However,
some are shared between the modes.
For example independent and mixed
mode share all their settings, differing
only in how they output the signal
(independently to each channel or
mixed on both). As a result, changing
a setting in one changes both.
The left/right channel amplitudes
are shared between all modes except
pulse and sweep. Most other settings
are independent.
Configuration details
Table 3 shows each setting read-out
and describes each field. Some require
more explanation, as follows:
Status readout: the Status readout is
very useful in sweep mode. Not only
Table 2: Attenuation Accuracy
Setting
Measured Value
-60dB
-59.92dB
-70dB
-69.80dB
-80dB
-79.16dB
-90dB
-89.35dB
does it show the frequency as the
sweep occurs (it’s updated four times a
second) but you can pause and restart
the sweep. Pressing the Left button in
this readout mode pauses or resumes
the sweep, while pressing the Right
button starts/restarts it.
This is especially useful when you
are optimising crossover networks or
matching a subwoofer to other drivers. If you hear a peak in the output
amplitude, you can pause the sweep
and read off the frequency.
There may be times when you want
a manual sweep, ie, rather than having it loop repeatedly, you can trigger
it manually. To do this, set the sweep
off time to maximum via the sweep
mode read-out – it will show “man”
(manual).
It will then only start when you
trigger it manually from the status
read-out using the Right button.
Sweep setting readout: this simply
allows you to choose between Exponential or Linear sweep. Exponential
sweep is the default and is usually
May 2010 75
Table 3: Setting Readouts
Output/wave type setting read-out: top line = output
type (44100Hz, 48000Hz [default], 96000Hz, Analog);
bottom line = signal type (Sine, Square, Triangle,
SawtoothUp, SawtoothDn).
Status read-out: indicates the current generation
mode and mute status. In pulsed and sweep mode,
it shows the current frequency and amplitude. “LR”
becomes “lr” when both channels are muted.
Sweep setting read-out: first line = setting; second
line = sweep type (Exponential [default] or Linear).
S/PDIF setting read-out: line 1 = encoding type
(Consumer [default] or AES/EBU) plus pre-emphasis
setting (Normal [default] or PreEmph); line 2 =
battery voltage display.
Battery setting read-out: Line 1 = 3.3V regulator
output voltage calibration; line 2 = low battery
warning voltage setting.
LCD setting read-out: line 1 = LCD backlight brightness (0-100%); line 2 = LCD contrast (0-100%).
EEPROM setting read-out: line 1 = Select EEPROM
bank (0-9); line 2 = Load all settings from specified
bank and Save all settings to specified bank.
Note: values inside green boxes can be selected and varied using the front panel pushbuttons.
what you want. In this mode, the frequency doubles or halves at a fixed
rate.
Linear sweep simply increases the
frequency by a set amount over time.
As a result it spends less time at low
frequencies and more time at higher
frequencies. This mode could be
useful if you are using a computer to
capture and analyse the output, as it
may make analysis simpler.
Keep in mind that while the generator attempts to reach your programmed
finish frequency after the specified
time has elapsed, in practice this is
very difficult to achieve. As a result,
with long sweep times, it may be off
by a few milliseconds and occasionally
the final frequency may actually be a
few Hz below that specified.
S/PDIF setting read-out: this lets you
configure the S/PDIF output format
as well as view the current battery
voltage.
The first setting, “Consumer” or
“AES/EBU”, determines the format
of the Channel Status data sent with
the S/PDIF stream. “Consumer” is
the typical format that most CD and
76 Silicon Chip
DVD players use. On some equipment, this format is limited to 20 bits
of precision in the audio data, so you
may get slightly higher distortion and
worse amplitude control on this setting. However, it is the most widely
supported.
“AES/EBU” is the professional
standard used by DATs, mixers and
high-end sound cards. It allows the full
24-bit precision in the audio samples
as well as sending more complete
meta-data. In general, AES/EBU mode
is better provided the equipment that’s
receiving the signal can handle it.
The second setting allows you to
enable the pre-emphasis bit in the
S/PDIF stream. This has the effect of
enabling the de-emphasis hardware in
the receiver (if it has any) and is mainly
useful for testing. For example, you
can run a 20Hz-20kHz sweep with and
without this bit set and check that the
higher frequencies are properly attenuated (ie, de-emphasised) when it is set.
The battery voltage readout lets you
keep track of the charge state. Note,
however, that the reading is actually
a little lower than the real battery
voltage (by about 0.3V) due to the
Schottky diode (D2) in series with it.
This means that if you consider your
cells flat when the battery reaches 4.0V
(for example), you’ll actually want
to switch the device off or attach the
plugpack as soon as it reads near 4.3V.
Battery setting readout: this lets you calibrate the battery voltage monitor – see
the “Calibration” section in Pt.2 in the
April 2010 issue. It also lets you set the
low-battery warning voltage threshold.
Once the battery has dropped below
this level, the backlight will dim and
flash, warning you to charge the battery
or switch it off.
During this time, you can continue
using the generator. The recommended
settings are 3.9V for alkaline cells (actually 3.6V) and 4.3V for NiMH cells
(actually 4.0V).
Regardless of this setting, if the
voltage reading drops below 3.5V for
some time, the microcontroller will go
into sleep mode. The “Battery flat!”
message is then displayed and all
other functions cease. Backlight flashing continues although at a reduced
brightness.
When that happens, the current
drain drops from 100mA or more to
about 30mA. This will still drain the
battery but not as quickly.
LCD setting readout: here you can adjust
the display contrast and backlight
brightness. You may need to change
them according to lighting conditions,
viewing angle or temperature. If you
manage to reduce the contrast so much
that the display becomes unreadable,
switching the power off and on will
typically restore it to the default.
The backlight brightness selection is a compromise because as you
increase it, you increase the current
drain at the expense of battery life.
The default value of 25% is sufficient
for good display visibility under most
conditions and only adds about 30mA
to the battery current.
EEPROM setting readout: this lets you
define the default settings (ie, those
loaded at power on), as well as store
up to nine other setting configurations.
Bank 0 is loaded at switch-on, so if
you save to bank 0 you are setting the
defaults.
To save settings, select the appropriate bank number, then move the cursor
to “Save” and press the Up or Down
button. The read-out will change to
“Saved” and the current configuration
and mode settings will be stored in that
siliconchip.com.au
slot. You can then switch the generator
off, or continue using it. You can even
change the bank number and save to
another one if you wish.
To load settings, the procedure is essentially the same. You select the bank
number you want, move the cursor to
“Load”, and press the Up or Down button. The read-out changes to “Loaded”
and the current settings are replaced
with those stored in EEPROM. Almost
everything will be set just as it was
when you saved to that bank.
Note that attempting to load a bank
that has nothing saved in it has no
effect.
The additional banks can be handy
if you often repeat certain tests and
they involve a specific configuration.
You can store commonly used configurations in banks 1-9 and save yourself
the time of having to adjust multiple
settings to the same values again later.
Table 4: Example Wave Types
Internal DAC
Sine
External DAC
Sine
Wave types
Table 4 gives an example of each
wave type. Each has been sampled
using both the analog outputs of the
Digital Audio Signal Generator and
also the SILICON CHIP High-Quality
Stereo DAC (September-November
2009), the latter fed from the generator’s S/PDIF output.
The high-frequency oscillations apparent in both the square and sawtooth
signal outputs from both DACs are a
result of their delta-sigma architecture.
These types of waveforms are unnatural due to their discontinuous nature –
ie, they contain vertical lines whereas
natural waveforms normally do not.
As a result, the digital sinewave
signal interpolation is smoothing
the abrupt transitions, with the filter
inserting some high-frequency waves
before and after each transition to
cover up the discontinuity. The result
is what you see here. We know that the
digital circuitry must be responsible
for the oscillations because they occur equally both before and after each
transition.
On the other hand, the external DAC
has some overshoot with the square
and sawtooth waves, which is presumably due to the analog filter circuitry
after the DAC chip itself. It only occurs
post-transition.
The sinewave signal does not suffer
from this issue because it is continuous. The triangle signal does have a
discontinuous first derivative (at the
point of each triangle) but since it has a
siliconchip.com.au
Square
Square
Triangle
Triangle
Sawtooth Up
Sawtooth Up
Sawtooth Down
Sawtooth Down
May 2010 77
Fig.1: the effects of aliasing start to become noticeable at
44kHz. Note the subtle variations in the signal amplitude.
Fig.2: at 47kHz, aliasing effects are quite severe (the input
data in this case actually has constant amplitude).
Fig.3: this scope grab shows the analog output distortion
residuals (0.06%) for a 1kHz sinewave & 0dB attenuation.
Fig.4: the distortion residuals drop to just 0.0006% (1kHz,
0dB attenuation) when using the High-Quality Stereo DAC.
continuous waveform it is not badly affected. There is a little rounding at the
tips, again likely due to the digital sine
signal interpolation, but it is minimal.
Aliasing
There is an additional issue related
to the digital filtering and that is aliasing. In fact, all DACs suffer from it to
some extent.
When the sample rate is set to
96kHz, the highest frequency signal
you can generate is 48kHz. There is a
wrinkle, though – as you get very close
to 48kHz, there are so few samples
per signal that the signal form can no
longer be properly represented.
Basically, the digital data becomes
ambiguous – while the frequency information can still be extracted, the
amplitude of each wave is no longer
clear. Aliasing starts to be become no78 Silicon Chip
ticeable above 44kHz (note the subtle
variations in amplitude shown in the
scope shot of Fig.1) and it is quite
severe at 47kHz (Fig.2).
The input data for the second capture actually has a constant amplitude.
However, aliasing does not increase
monotonically with frequency. There
is no aliasing at exactly 48kHz, for
example.
What this means is that you should
generally avoid frequencies between
45% and 50% of the sample rate,
except for exactly half (ie, 48kHz in
this case). That way, aliasing will not
typically be an issue.
By the way, if you want to make
sound effects for a science fiction film,
try setting the signal type to triangle
and the sample rate to 48kHz, then
initiate a sweep from 12-24kHz. What
you then hear is due to the aliasing
causing frequency shifts in the output.
Distortion
There’s another issue to keep in
mind when selecting the sample rate.
When the output frequency is below
about 10kHz, the sinewave signal
distortion is actually lower at 48kHz
sampling than at 96kHz sampling. So
if you’re only going to generate low-tomid frequency sinewaves and need the
least distortion, stick with the 48kHz
sampling rate. You can still switch
to 96kHz when necessary for higher
frequency output signals.
Finally, if you have an oscilloscope,
it’s a good idea to connect the generator’s outputs to it and try out the
various modes. By doing this, you will
quickly get used to the interface and
get a feel for how the various modes
SC
work.
siliconchip.com.au
|