This is only a preview of the December 2010 issue of Silicon Chip. You can view 17 of the 104 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 Hot-Wire Cutter With Inbuilt Heat Controller":
Items relevant to "Digital/Analog USB Data Logger":
Items relevant to "Digital Lighting Controller For Christmas Light Shows, Pt.3":
Items relevant to "A High-Quality DAB+/FM Tuner, Pt.3":
Items relevant to "Build A Hearing Loop Level Meter, Pt.2":
Purchase a printed copy of this issue for $10.00. |
How to use the software. . .
DIGITAL
LIGHTING
CONTROLLER
Part 3 – by
Nicholas Vinen
Christmas is just about here! Have you got your Digital Lighting
Controller ready yet? In the first two articles we explained how the
Digital Lighting Controller works and how to build it. This third
article explains how to use the software – primarily the Windowsbased sequencing program.
A
s it turns out, the majority of the time spent developing this project involved writing software – both
the firmware and the sequencing utility. We only
had space for a quick rundown of the software functions
last month. Here is a more detailed explanation.
Audio conversion
As previously stated, the Digital Lighting Controller
supports audio files in the WAV format, with 16 bits per
sample, mono or stereo, in one of the supported sample
rates (11.025kHz, 12kHz, 22.05kHz, 24kHz, 32kHz, 44.1kHz
or 48kHz).
If you have an MP3 file (or other format) that you want
to play or sequence using this device, you can use third
party software to convert it to WAV. This is also necessary
if you want to use a WAV which contains compressed data
(eg, Law or aLaw). There are many pieces of software
capable of doing so.
The best is probably Audacity (http://audacity.sourceforge.net/). It is available for Windows, Mac OS X and
Linux/Unix and can be downloaded and used at no charge.
All you need to do is open the audio file and then use the
File->Export command to save it as a WAV.
This WAV file can then be loaded into the sequencing
software. Note that it only handles simple WAV files (one
chunk, etc). This is because it uses the same WAV routines
as the master unit does, so if you can open the file in the
Windows software then it should work on the master unit
66 Silicon Chip
too. Even so, it doesn’t hurt to check that the master unit
will play the WAV before you begin sequencing it.
Operation and additional features
Sequences can be created with or without audio. Sequences with audio have a .lsq file extension, those without
have a .lsn extension.
The master unit scans the memory card for any files with
a .wav or .lsn extension. WAV files are played with or without an accompanying .lsq lighting sequence. If there is no
sequence, the lights are all switched off as the audio plays.
If an .lsn file is encountered instead, the audio output
plays silence while the lighting sequence is displayed. In
either case, after the sequence is finished, it moves onto the
next file (unless you use the single file playback buttons
on the remote control).
Since the last article was published, we added a “mute”
command which can be triggered from either compatible
remote control. It immediately sets the audio volume to
zero and is cancelled by pressing mute again, changing the
volume or else pressing play. It can be re-mapped to other
infrared codes like the other remote control commands.
Note that a sample configuration file, showing all the
main options, will be included with the HEX file and source
code downloads.
Limitations
Because the sequences are stored compressed (reducing
siliconchip.com.au
Fig.1: the main window, showing the WAV audio data at the top and the sequence below. The blue rectangle shows the
current selection while the green line is the playback cursor. The simulated light state is shown at the bottom. The main
sequence display, in the middle, represents the brightness of each light over time with strips of colour. Note that some of
the toolbar buttons are disabled. If you move the mouse cursor over them, you’ll find out why.
file size and memory card I/O), there is one minor restriction.
Light ramps (when the brightness slowly fades up or down
over time) have a minimum and maximum time period.
The possible range is about 0.016 to 8.2 seconds. It’s
unlikely you will need to go outside this range and if you
do, the software will automatically adapt. For long ramps,
it will substitute a series of evenly spaced “set brightness”
commands to give a similar effect. Still, it is a good idea to
avoid very short or long ramps since they can complicate
further sequence manipulation.
Sequencing software
To install the Windows sequencing software, simply
Fig.2: the settings dialog which provides a few options for
tweaking the behaviour of the program. Most of the settings
only need to be changed once.
siliconchip.com.au
Fig.3: the lights dialog, accessible via settings, which
allows you to name each light channel and select the
colour in which it will be displayed.
December 2010 67
Fig.4: the Custom Ramp dialog allows you to create light
ramps with a specific profile. Once a profile has been set
up, it can be repeated many times on different channels at
different times.
download and run the executable file. It will ask you a
few questions (such as where to put the files) but most users can ignore the questions (leaving the options at their
defaults) and just click the “Next” button until the installation is complete.
The first time you run the sequencing software, it is a
good idea to go to the Settings screen (Edit––>Settings) and
adjust the options.
The most important is the audio delay. To set it, select a
WAV file which has an obvious beat and then create a new
sequence for it. Use the Play command (on the toolbar or in
the menu) to play the file and watch the playback cursor (a
green vertical line) as it moves across the display.
The beats should be visible as spikes in the WAV display
at the top of the window. As the playback cursor reaches
each spike, you should hear the beat simultaneously. If the
playback cursor reaches the spike before the beat sounds,
increase the delay. If the beat sounds before the playback
cursor reaches the spike, decrease it. The possible range is
±1000ms (±one second). Repeat until it is correct.
The rest of the settings are explained in Table 1 at right.
Having set them to your satisfaction, you are ready to create
sequences. The rest of this article is dedicated to explaining
the various controls, commands and options which you
can use in choreographing your light display to the music.
Mouse controls
The mouse wheel zooms in or out on the sequence, centred on the portion under the mouse cursor. Rolling it up
zooms in while rolling it down zooms out. Note that this
is true even while you are dragging a selection (see below).
Right clicking in the WAV display (at the top) or sequence
display (below it) re-centers the display on that location.
Right-dragging (ie, right-clicking and holding) in either area
pans the display left or right. Panning can also be accomplished using the scroll bar, at the bottom of the window.
68 Silicon Chip
Fig.5: with the Cascade dialog you can create a pattern
of lights across multiple channels. The lights flash in the
specified pattern at the selected interval.
Table 1 – Settings
Monitor
Gamma
Used to display light brightness accurately.
The default is 1.6, common values are 1.6 –
2.2.
Make backup
files
If on (the default), each time you save over a
sequence, the old file is kept with a different
extension (maximum of ten backups).
Associate file
extensions
If on (defaults to off), sequence files can be
opened by double-clicking them in Windows
Explorer.
SD Card Drive
This is auto-detected but may need to be
changed. The “Publish” command copies the
sequence to this drive.
Eject After
Publish
If on (the default), after publishing a sequence, the memory card is “ejected” so that
it can be immediately removed.
Audio delay
compensation
Some sound drivers do not accurately report
the playback position. If the audio synchronisation is off, adjust this value.
Maximum undo Undo records are kept forever until they use
memory
up more than this much memory, when the
oldest undo records are discarded.
Loop playback
Can also be set on the toolbar. If on, when
playback reaches the end of the selected section, it starts again from the beginning.
Scroll to follow Can also be set on the toolbar. If on, when the
playback cursor playback cursor approaches the edge of the
window, the display scrolls to follow it.
Lights
Selects which light channels are available and
sets the associated names and colours. By
default, the first eight are enabled.
siliconchip.com.au
Fig.6: Beat Detection provides an automated hueristic for
detecting beats in the music and causing lights to flash in
time with them. It operates similarly to Cascade but the
flash times are determined by the music, rather than a
simple interval.
The mouse is used to define the selection initially and
can also be used to adjust it. The selection is a portion of
the sequence, outlined in blue. Most commands which
manipulate the sequence only change the portion within
the selection.
To make a selection, move the mouse into either the WAV
display or sequence display and hold the left button down.
You can then “drag out” an area to select it.
If you click the button rather than dragging the mouse
then this will select a single time point in the sequence.
In this case, the “Play Selection” command will play from
that point until the end of the sequence and the “Paste”
command will paste the copied data beginning at that point.
When dragging a selection, you can also move the mouse
Table 2 – Custom Ramp options
Fig.7: Spectrum Analysis operates like Beat Detection but
it breaks the audio up into multiple frequency bands and
controls each lighting channel based on the audio within
the separate bands.
vertically to select one or more light channels simultaneously.
Once a selection has been made, you can drag the edges,
changing the time span or the range of light channels selected. A double-arrow cursor indicates when the mouse
is in the right location to change the selection.
While using the mouse to create or adjust a selection,
Table 3 – Cascade options
Order
The order in which channels are flashed. “Low
to high” starts with the first selected channel
and then moves to higher channels, wrapping
back around to the first. “High to Low” is the
opposite. “Ping pong” alternates between the
previous two. “Random” creates an arbitrary
pattern.
Type
Ramp Up increases brightness over time, Ramp
down decreases it. Peak ramps up and then
down while Trough ramps down and then up.
Brightness
Defines the brightness at the salient points for
the given ramp type.
Effect
Normally the ramp is stretched to fill the selection. Start and End Delay allow for padding.
Peak/Trough delay, if set, create a brightness
plateau in those modes.
When Flash is selected the light simply turns
on for the selected On Time. With fade, the
beginning and end are ramped, according to
the Rise time and Fall time settings.
Brightness
The peak brightness of each light flash.
Interval
The time between flashes being triggered on
subsequent channels. This can be shorter
than the On time if desired and the flashes will
overlap.
Timing
Symmetry
Available in Peak and Trough modes. The up
and down ramps take the same time with 50%
symmetry while other values emphasise one
or the other.
siliconchip.com.au
December 2010 69
The up and down arrows also move the selection up and
down, selecting a different set of light channels. If shift is
held down at the same time then rather than moving the
selection, it is extended.
If the Control key is held down while pressing the left
and right arrows, the display scrolls left or right. In this
mode the shift key can also be used for larger increments.
Dialogs
Fig.8: Automatic Sequencing is a feature which allows you
to quickly and easily generate a sequence for a piece of
music, based on beat detection and spectrum analysis. It
can be further modified or used as-is.
if you move the mouse cursor off the left or right edge of
the sequence area, the display will automatically scroll in
that direction.
The light channel selection can be altered without affecting the selection time span by clicking on the light names at
the left side of the window. Holding down shift or control
while clicking on the light names allows you to select a
range or group of them. This allows you to manipulate a
number of channels at once, eg, to create a Cascade (more
on this later).
It is also possible to adjust the amount of space available
for WAV data display at the top of the screen. Move the
mouse over the line dividing the WAV and sequence area
and drag it up or down. You can use the same technique
to adjust the left/right split between the light names and
the sequence data.
Keyboard controls
In addition to the keyboard shortcuts (shown in the
menus), there are some extra keyboard controls which
perform basic functions such as changing the selection.
The arrow keys, in combination with shift and control,
allow you to move the current selection or scroll the display. The left and right arrows by themselves move the
selection left and right and if shift is held down at the
same time, it moves in larger increments (x10). Moving
the selection with the keyboard allows you easily make
fine timing adjustments.
Table 4 – Beat Detection options
Sensitivity
Previews
Some options are common to several dialogs. If “Live
Preview” is turned on then the selected operation is performed immediately so that you can see what its result will
be. If you then cancel the dialog, the changes are undone.
Table 5 – Spectrum Analysis options
Frequency
range
The upper and lower ends of the frequency
bands. This range is broken into enough logarithmic steps for the selected light channels.
Stereo
If “Left to right” or “Right to left” are selected
then the light channels are divided in half, one
set using left channel audio and the other right
channel audio. Otherwise, the selected channel
is used for all bands.
Frequency
order
Determines the order in which the resulting
bands are mapped onto the light channels.
Response
The Flash and Fade modes work similarly to
Cascade. The Sensitivity control works similarly to Beat Detection. For “Brightness tracks
volume”, instead of flashing, the brightness of
each light channel varies continuously, tracking
the audio level in each frequency band.
Scale brightness by
intensity
In Flash/Fade mode, this causes the brightness to be modulated by the intensity of each
transient.
Scale duration
by intensity
In Flash/Fade mode, this causes the On Time
and if appropriate, Rise and Fall times, to be
modulated by the intensity of each transient.
Timing
As for Beat Detection.
Determines the transient energy required to
trigger a light flash.
Minimum inter- Once a beat has been detected, any transients
val
are ignored for this period after it. The equivalent
maximum BPM (Beats Per Minute) are shown.
Delay
While much of the sequencing work is done in the main
program window, the software also includes a number of
“dialogs”. These are windows which pop up when certain
options are selected, allowing you to enter additional
parameters.
The available dialogs are: Settings, Lights, Custom Ramp,
Cascade, Beat Detection, Spectrum Analysis and Automatic
Sequencing.
The first two are used to alter the behaviour of the program while the others manipulate the sequence in some
way. One thing they all have in common are the “OK” and
“Cancel” buttons. Either button will close the dialog, but
pressing “Cancel” also discards any changes made since
it was opened.
You can only have one dialog open at any time. For dialogs that manipulate the sequence, only the selected portion
is affected, except in the case of Automatic Sequencing
which always operates on the whole file. Thus, most of
these dialogs are unavailable while there is no selection.
Each light flash is offset by this amount (±) from
the detected transient. Most commonly used in
“Fade” mode to compensate for the initial ramp.
Effect, Timing, As with Cascade. The “Multiple Lights” settings
Multiple Lights are only available if more than one light channel
has been selected.
70 Silicon Chip
siliconchip.com.au
COMMANDS
The software supports many commands which are accessible via the menu or the toolbar.
While most of them are self-explanatory, the following are worth elaborating.
File->Publish
Sequence
This copies the loaded sequence onto your memory card along with the accompanying WAV file (if appropriate).
The memory card drive letter is set automatically but you should check the Settings before using this feature
and adjust it if necessary.
Edit->Paste Special Normally when you copy and then paste sequence data, the data is copied exactly. The only change normally
made is when the selection into which it is being pasted is smaller than what was copied, in which case some
of the data is omitted.
However, the Paste Special menu provides five ways to paste data that also manipulate it in some way.
If Paste Stretch is used, the duration of the data copied will be lengthened or shortened to fit the current
selection, time-stretching it.
Paste Mix and Paste Merge allow the sequence data in the copy buffer to be combined with the data within the
current selection. In the case of “Merge”, the brightest light value will dominate at any given time. This is
useful in a case where you want to leave the existing sequence as it is but add new lighting commands on top.
“Mix” is similar but the resulting brightness is the product of the existing and pasted brightnesses. This is
especially useful with the Custom Ramp option as it allows you to take a series of light flashes (or ramps, etc)
and apply a ramp over the top which modulates their brightness over time. This effect is shown within the
selection in Fig.1.
Edit->Copy Buffer
Storage
Normally, if you perform a “Cut” or “Copy” command, the contents of the copy buffer are replaced with the
selected data and thus lost. Sometimes you need to be able to store multiple sequence sections in order to
paste them later, in a different order. Copy Buffer Storage gives you nine additional holding locations.
First, copy or cut the data in the normal manner, then store the contents of the copy buffer using this menu.
The contents can be retrieved later and then pasted as usual.
Edit->Selection
Storage
This menu allows you to store the location of the current selection so that you can recall it later. After making
a selection, store it in one of the nine locations. It can then be restored any time. The stored selection includes
both the light channels and time span.
Edit->Change
Length
This is only available if you are editing a stand-alone sequence (ie, one without audio). In this case you can
change the length (ie, running time) at will. Note that if you reduce the length, any data past the end will be lost.
Playback->Set
Playback Region
If you select a time span and then use this command, the selection becomes the new playback region, which
is shown in red. It is then independent of the selection. The “Play Region” command will then play that portion
of the sequence.
This is handy when you want to make a number of changes to a given section and play it back to check what
you have done afterwards, without having to re-select the whole section each time.
Lights->Cancel
Light Actions
All sequence commands in the selection are deleted. This means that during this period, the lights will remain
in whatever state they were left just prior to it. To turn the lights off instead, use the “Lights Off” command.
Lights->Set Light
Brightness
This option sets the brightness of the selected lights, in the selected time period, to be a constant, between 0%
and 100% of full brightness. The actual brightness is set using the dropdown arrow adjacent to this command
in the toolbar.
LightsThis ramps the brightness of the selected lights smoothly from whatever brightness they are at the beginning
>Interpolated Ramp of the selection to that at the end.
Lights->Ramp Up/
Down
These commands take the brightness of the selected lights at the beginning of the selection and either ramps
them up to maximum brightness or down to minimum brightness (off) over the selected period.
Lights->Custom
Ramp/Cascade
See the section on Dialogs.
DSP->Beat Detection/Spectrum
Analysis/Automatic
Sequencing
See the section on Dialogs.
siliconchip.com.au
December 2010 71
Table 6 – Automatic Sequencing options
Number of
light channels
Defaults to the number of available
channels. Use a lower number to leave some
channels unaffected.
Flash period
Controls the flash duration
Beat detection
allocation
The proportion of available channels to
dedicate to the Beat Detection function.
Pingpong
Controls whether the Beat Detection uses
“Low to high” or “Ping pong” order.
Fade
Controls whether the Beat Detection uses
“Flash” or “Fade” mode.
Beat detection
sensitivity
Allows the sensitivity to be adjusted over the
most useful portion of the range.
Spectrum
analysis
Stereo controls whether the Spectrum
Analysis feature uses “Left to right” or
“Mono” mode. Track selects either “Brightness tracks volume” or “Fade” mode. “Scale
Duration” selects either “Scale Brightness” or
“Scale Duration” mode.
Spectrum
analysis
sensitivity
Allows the sensitivity to be adjusted
over the most useful portion
of the range.
If you adjust any of the dialog parameters, the preview will
update to reflect the change.
Because the operation could be slow if the selection is
large (eg, Spectrum Analysis), it is a good idea to zoom into
a portion of the selection while using Live Preview. In this
case, only the visible portion will be updated, speeding
up the preview.
Once you click “OK” then the operation will be performed over the entire selection.
Any operations which take more than about a quarter of a
second will display a progress dialog. This is true whether
it is a preview or the final operation which is being performed. When the progress dialog is open, it is possible to
cancel the operation.
Note that it is possible to go to the main window and
scroll/zoom while a dialog is open. If Live Preview is active,
the preview will automatically re-calculate when the view
is changed (if necessary). You can also change the selection while a dialog is open. If Live Preview is active then
the preview will be changed to apply to the new selection.
Common options
The other two common dialog options are “Merge” and
“Mix”, which perform the same operations as described
under the “Paste Special” command.
When you click “OK” in a dialog, the options that you
have selected are remembered for next time you perform
that same operation.
In addition, many of the dialogs are accessible via the
toolbar as double-action buttons. Clicking the dropdown
arrow alongside the button opens the dialog while pressing the button itself immediately applies the associated
operation.
This means that once you have the options set up the
way you want and clicked “OK”, you can repeat the same
72 Silicon Chip
operation on a different selection using the toolbar button,
without having to go through the dialog.
Alternatively, you can click the dropdown arrow and
adjust the parameters again.
Custom Ramp and Cascade
The Custom Ramp dialog allows you to create a smoothly
changing brightness level for one or more lights over a given
time period. See Table 2 for the possible options.
Note that as you change between the four different ramp
types, the brightness values are shuffled around so that you
don’t have to make as many adjustments.
Cascade creates an effect where flashes occur across
multiple light channels over time, with a constant period
and duration for each flash. It is also possible to smooth the
beginning and end of each flash with a brightness ramp.
See Table 3 for the available options. It is possible to
select a single light channel for a Cascade, in which case
the Order option is disabled since it has no effect.
Beat Detection
Beat Detection provides a means to analyse the audio
and attempt to discover the beat by looking for transients.
Before searching for transients, a fourth-order notch filter
is applied to the audio (400Hz-4kHz) in order to eliminate
vocals and other instruments which might otherwise fool
the algorithm.
The sensitivity is critical and its operation is not always
intuitive. It is a good idea to pick a small section of the
audio file and try different sensitivity settings (using the
Live Preview option) in order to detemine the setting which
picks up the beats most reliably without much spurious
triggering.
The best settings are usually between mid-scale and
halfway to maximum.
Once the beats are detected, they are passed onto the
Cascade routine, providing similar options for light triggering on each detected transient. The full set of options
are explained in Table 4.
Spectrum Analysis
This is the most complicated of the sequencing dialogs.
Spectrum Analysis is much like Beat Detection but rather
than using a notch filter, instead the frequency spectrum
is broken up into a series of bands and a bandpass filter
(fourth order) is applied to isolate each set of frequencies.
As with Beat Detection, transients in the result trigger
flashing lights.
Because each lighting channel operates on a separate
band, that means that the lights respond to different frequencies, creating a more interesting effect. See Table 5 for
a summary of the options.
The final dialog, Automatic Sequencing, combines Beat
Detection and Spectrum Analysis while presenting fewer
options.
This makes it easy to create a quick sequence for an audio file. Simply click the icon, adjust the settings (or leave
them at the defaults) and then click “Go”.
There is no preview in this mode but if you do not like
the results you can undo the changes, adjust the parameters
and try again.
For a description of the Automatic Sequencing options,
see Table 6.
siliconchip.com.au
Connecting multiple lights without spending big $$$!
As you will recall from the first two parts,
the Digital Lighting Controller has IEC mains
output sockets, mainly because they will fit!
However, practically all lights you can buy,
especially Christmas lights, will be fitted with
a standard 3-pin mains plug.
We recommended buying an IEC-to-3-pinmains converter lead, such as that shown
bottom left in the picture below. However,
these are relatively expensive (~$10 each) so
for eight channels it quickly adds up.
And what happens when (as you almost certainly will with Christmas lights) you want to
plug in multiple lights into the same channel?
We have come up with a pretty cheap solution for both problems – and that is to use a
standard 4-way mains power board (which
you can buy anywhere these days for $3 or
less!) and change the 230V mains lead over
to one fitted with an IEC plug.
Where do you get such a lead? Call us bower-birds if
you like but every time we have thrown out an old CRT
monitor, we have cut off the mains lead (back in the early
days CRT monitors used to plug into the computer via
an IEC socket). Ergo, our junk box had several lengths of
mains leads fitted with IEC plugs one end.
So for us, the only cost was buying some power boards
(and we found a pack of four at Bunnings for $6.95!)
Don’t have spare IEC cables on hand?
If you don’t have the luxury of a well-stocked junk box,
the alternative is to use a powerboard as is but change the
mains plug over to an IEC type (as shown at right in the
photo below). It’s not quite as cheap (these plugs usually
sell for about $7 each) but at least you get
multiple outlets via the powerboard.
Opening up the powerboard
Usually, powerboards are assembled with
tamper-proof screws – so you’re going to need
a tamper-proof screwdriver to remove them.
(What self-respecting hobbyist wouldn’t have
a set of tamper-proof bits in his/her toolbox?).
Most we found simply use a slotted screw
with centre raised section, which requires a
slotted blade bit. However, we’ve also found
them with star, Torx and other bits. Sometimes they are rivetted or welded together,
in which case you can’t do this modification.
Check your powerboard before buying!
Remove the screws with whatever bit it
takes and the two halves of the powerboard
should separate. There will almost certainly
be an overload circuit breaker built in – leave the brown
wire connecting this to the Active bus bar but cut off
the Earth wire where it connects to the Earth bus and
similarly the Neutral (blue) wire where it connects to the
Neutral bus.
Remove the Active (brown) wire where it connects to
the input of the circuit breaker.
Invariably, the wires are all welded so they will have
to be cut away. Replace the cable with your IEC-ended
cable, cutting the brown, blue and green/yellow leads to
the same length as those you removed.
Make sure the individual wires are mechanically secured to the bus bars (ie, wrap them around tightly) and
then solder them in place. Replace the cover and you’re
done.
SC
Left: our modified powerboard,
now fitted with an IEC mains
plug and cable assembly “saved”
from a junked monitor.
Right: the alternative
approach, fitting
an IEC plug in
place of the
standard
mains plug.
Above: an IEC
mains plug to 230V
mains socket adaptor, as
originally recommended.
siliconchip.com.au
December 2010 73
|