This is only a preview of the July 1994 issue of Silicon Chip. You can view 30 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. Articles in this series:
Items relevant to "Build A 4-Bay Bow-Tie UHF Antenna":
Items relevant to "The PreChamp 2-Transistor Preamplifier":
Items relevant to "Steam Train Whistle & Diesel Horn Simulator":
Items relevant to "Build A Portable 6V SLA Battery Charger":
|
By GARY YATES
Computers & programs
that just go “beep”
are old hat. This tiny
digitiser records voice
input through the
games port & replays
it on the PC’s speaker.
What’s more, it can
record to your hard disc
for long recording &
playback times.
SmallTALK
A tiny voice
digitiser for the PC
PCs are moving into the world of sound – there’s
no denying it. Manufacturers are moving away from
the days when the computer just beeped at you and
are launching themselves into voice recognition
and voice-annotated software packages. So much
so that Compaq computers now come with a sound
board as standard and there are other manufacturers
about to follow suit.
However, sound cards are still quite expensive
and if you’re a programmer, writing programs that
July 1994 17
GAMES
PORT
PIN 1
33
100
16VW
1k
4.7k
A
100k
LED1
ON
1
3
IC1a
2 LM358
4
100k
MIC
K
8
1
5
47k
1k
A
K
PIN 2
PIN 4
100k
33k
1
7
IC1b
6
.001
.0022
SMALLTALK FOR PCS
Fig.1: the circuit is based on IC1, an LM358 dual op amp. IC1a
functions as a microphone preamplifier stage & its output
modulates a 40kHz carrier signal produced by IC1b.
18 Silicon Chip
•
•
Sound playback is independent of
PC clock speed;
Uses only one IC.
How it works
This design uses a novel method
of interfacing with the PC via the
games port. Not only does this port
have its own 5V supply rail, removing the need for an external power
source, but it leaves the serial and
parallel printer ports for their more
traditional roles.
Over the years, the printer and serial
ports have been used for externally
interfaced projects which meant you
could be without the use of either your
printer or mouse. By using the games
port, these problems are avoided. It
also has the benefit of a small con100uF
33
1k
K
1uF
1
1k
100k
33k
IC1
LM358
MIC
.001
100k
A
DB-15
SOCKET
100k
4.7k
LED1
47k
use any sound other than a “beep”
means that you’re relying on the
end-user to have a compatible sound
card in their machine. However, as
popular as sound cards are becoming,
the days when you can count on every
machine having a sound card installed
are still a fair way off.
Those of you who built the PC Voice
Recorder back in the August 1991
issue of SILICON CHIP will have been
aware of its limitations – it required
hardware for both recording and play
back. GWBASIC was required to run
the software and only 16Kb of storage
was available which gave a maximum
recording time of just 20 seconds.
The SmallTALK digitiser presented
here overcomes all of these problems
and has to be one of the world’s smallest voice digitiser systems. It has the
following features:
• No additional hardware required
for playback;
• Either 3-minute RAM version or
optional hard disc recording (an
85Mb HDD would give 13 hours
recording time);
• No external power supply required;
• Fully self-executable software;
• QuickBASIC .QLB and .LIB libraries
available;.
• Easily added to other programs;
• Voice files can be stored on disc
for replay;
• Requires less than 2Kb per second
storage;
.0022
1uF
Fig.2: install the parts on the PC
board as shown in this diagram. Note
that the mic insert will need a link
connected to the shielding can tab so
that it can be earthed via the circuit.
nector which results in a smaller PC
board as well.
Looking at the circuit diagram in
Fig.1, you can see that there aren’t a
great number of components involved.
The circuit uses only one IC, a LM358
dual op amp. In fact there are so few
components used in the circuit that
it is difficult to see how it works.
The first half of IC1 is connected as a
non-inverting AC amplifier with a gain
of 48. This is used to amplify the signal
coming from the electret microphone
which is biased via the 4.7kΩ resistor.
That’s the straightforward part. Now
comes the tricky bit.
The output signal from pin 1 of IC1a
is connected to pin 5 of IC1b. This second op amp has two RC filter networks
providing the feedback from pin 7 to
pin 6. These components have been
selected so that with no signal present
at the input, the output is effectively
muted and the DC voltage at pin 2 sits
at half supply; ie, around +2.5 volts
DC. However, when a signal is present,
IC1b rings severely at around 40kHz
or so and this damped oscillation is
superimposed on the amplified signal
from the electret microphone.
In effect, the audio signal from the
electret modulates a 40kHz carrier and
this is presented to one of the switch
inputs of the game port.
From here on, the signal present
at the games port is sampled by the
computer at a rate of 15kHz or, to
be precise, 15 thousand samples per
second. The resulting samples are
stored directly as one-bit information
either in RAM or on the hard disc. All
of these functions are controlled by
the software program which has been
written to accompany this circuit.
Because it’s only one bit per sample,
the SmallTALK is memory efficient
– it uses about 1.8Kb per second
or less than 25% that required by
conventional 8-bit analog-to-digital
conversion. This method of conversion is similar to Delta-Sigma Modula
tion and is briefly described in the
accompanying panel.
Storing to HDD
While saving the sound data directly to RAM is relatively straight
forward, saving the information to
disc is a less simple process. What
happens is that a 128Kb block of
memory is allocated to storage of the
sound data and this block is divided
into two 64Kb regions.
PARTS LIST
1 PC board, 52 x 40mm
1 DB15 PC-mount female socket
1 electret mic insert
2 male DB15 sockets
2 DB15 backshells
1 SmallTALK software disc
1 1-metre length of twin shielded
audio cable (supplied with kit)
Semiconductors
1 LM358 dual op amp IC
1 5mm red LED
The board is connected to the games card inside the computer via a DB15-DB15
cable. Because there are only three connections, you can easily make up your
own cable using two male DB15 sockets & some twin shielded audio cable.
When sound recording begins, data
is stored in the first region, which for
ease of understanding we’ll call the
“lower” region. Once the data fills the
lower region, the computer switches
over and begins to fill the “upper”
region. While it is recording to this
upper region, it stores the contents
of the lower region to the hard drive.
When the upper region has been
filled, the program loops the data
address counter back down to the beginning of the lower region and begins
to fill this region up again, over-writing
the data in the RAM which has been
saved to the hard drive. Similarly,
while it’s recording in the lower region, the contents of the upper region
are stored to disc and this cycle continues until the user ends the recording
by pressing a key.
In effect, what happens is that while
recording is continuing into one memory region, the other memory region
is being saved to disc. This way, we
can store huge amounts of sound data
whilst only using 128Kb of memory,
which is great for systems that only
have 640Kb of RAM. Creative Lab’s
Sound Blaster and other sound cards
use a similar process to achieve the
same result.
Capacitors
1 100µF 16VW electrolytic
2 1µF 63VW electrolytics
1 0.0022µF 63VW MKT
polyester
1 0.001µF 63VW MKT polyester
Resistors (0.25W, 5%)
3 100kΩ
1 4.7kΩ
1 47kΩ
2 1kΩ
1 33kΩ
1 33Ω
System requirements
In order for SmallTALK to work,
your system must have the following:
• One floppy drive;
• One hard disc drive (with at least
500Kb free);
• One joystick port;
• DOS 3.0 or later (DOS 5 or later
preferred);
• 512Kb of RAM minimum;
• 80286 processor or higher.
Sound recording on a PC is by its
nature a very CPU-hungry process and
unfortunately the 8086/8088 processor
just isn’t fast enough to do the job.
However, any sound file recorded on
a 286 can be replayed at exactly the
same pitch on any other machine and
you don’t need to set any special parameters. This is made possible by the
program’s use of what can be termed
“interrupt-driven sampling” or IDS.
This relies on reprogramming the
computer’s internal clock circuitry to
take approximately 14,900 samples
per second, regardless of the machine
architecture. It also does this in the
“background”, which means that
provided you have the QuickBASIC
libraries (which we’ll get onto shortly),
it’s possible to do other things such
as print to the screen or get keyboard
input while all this is happening.
Software
The software is available in two
versions – RECORD and PLAY.EXE for
the 3-minute version and HDRECORD
and HDPLAY.EXE for the HDD option.
In both cases, to record a file, you
simply plug in the SmallTALK board,
type in the program name and then a
filename on the same line; eg,
RECORD SOUND.VOC
would start a 3-minute maximum
RESISTOR COLOUR CODES
❏
No.
❏ 3
❏ 1
❏ 1
❏ 1
❏ 2
❏ 1
Value
100kΩ
47kΩ
33kΩ
4.7kΩ
1kΩ
33Ω
4-Band Code (1%)
brown black yellow brown
yellow violet orange brown
orange orange orange brown
yellow violet red brown
brown black red brown
orange orange black brown
5-Band Code (1%)
brown black black orange brown
yellow violet black red brown
orange orange black red brown
yellow violet black brown brown
brown black black brown brown
orange orange black gold brown
July 1994 19
Delta-Sigma Modulation (DSM)
Delta-Sigma ModulaHIGH
FREQUENCY
tion (DSM) is a form of
OSCILLATOR
analog-digital converter
(ADC) which transforms
COMPARATOR
ANALOG
analog signals into a series
CLK
DIGITAL
IN
D
Q
of high and low digital
OUT
FLIP
voltage levels. Fig.3 shows
FLOP
the basic elements of a
DSM ADC.
R
The analog input signal is connected to the
C
LOW-PASS
non-inverting input of a
FILTER/
INTEGRATOR
comparator. The output
of this comparator is then Fig.3: the basic elements of a DSM ADC.
fed to the D-input of a D
flipflop, which is clocked at a very is higher that the returning signal,
high frequency by an oscillator.
the comparator produces a high
The digital output of the D output; otherwise it is low.
flipflop then passes through a
The D flipflop and the associatlow-pass filter which is then routed ed clock circuit ensure that the
back to the inverting input of the samples produced by the circuit
comparator. The low-pass filter are at equal intervals.
reconstructs the original signal so
The D flipflop and oscillator
that the comparator can com- circuitry is not necessary for the
pare the slope of the incoming SmallTALK as the sample rate
signal against that of the recon- produced by the op amp itself
structed signal. If the input signal is sufficient for our application.
recording with the data stored in the
file SOUND.VOC in the current drive
and directory. The sound files are compatible on both systems provided that
files recorded on the HDD system are
less than 320Kb. Longer files can only
be replayed using the HDD system.
The 3-minute version must load
the complete file into memory before
playback begins whereas the HDD
system needs to only load in 64Kb
before playback will begin, regardless
of the size of the file. In both cases,
only 128Kb of memory are used for
data storage.
If you are conscious about using up
too much disc space for your sound
files, a byte counter displays the
current number of kilobytes used on
screen and the exact number of bytes
used when recording is completed. If
you find that a sound file is too long,
you can simply re-record the file and
check it against the byte counter.
Uses
The PLAY.EXE program has also
been designed to be incorporated into
your own programs – it plays the file
20 Silicon Chip
without writing any information to the
screen. You can simply use the SHELL
command in either Quick
BASIC or
DOS’s QBasic to play sound files
within your own programs.
For example, you may wish to have
the computer say “Press a key to continue”. You could record this into a
file called, say, PRESS.SND and use
the shell command at the appropriate
time to replay the file:
SHELL “PLAY PRESS.SND”
The only condition is that both
PLAY.EXE and the sound file, PRESS.
SND, must be in the same directory
that is currently in use. If your program
is in a different directory or even a
different drive, you can type:
SHELL “E:\JUNK\PLAY D:\SOUND\
PRESS.SND”
The only concern that this method
raises is that you can’t do anything
else while the SHELLed program is
running.
You can add this PLAY program to
games, process control programs, word
processors, database management
programs, file utilities – just about
anything where the computer needs
to warn or indicate to the user that
some process is occurring or needs
the user’s attention. You could even
use it as a message recorder, talking
clock, talking voltmeter etc – the list
is basically as long as your arm.
QuickBASIC libraries
Now if you’re sitting down and
thinking “Wait a minute! BASIC’s not
fast enough to do that!” then you’re
quite right. The crucial routines which
sample and play back the audio have
been written in assembler and linked
into QuickBASIC libraries, SMAL
TALK.LIB/QLB and HDTALK.LIB/QLB
which are also being made available.
The beauty of these libraries is twofold. Firstly, you can create your own
programs using only QuickBASIC and
not have to know anything about assembler. Secondly, you can combine
all of the routines into one program
name and do away with the SHELL
command.
These libraries contain easily-accessible routines which carry out
the initialisation and the setting up
of the record and replay clock reprogramming parameters, and a status
routine which returns the total number
of bytes either played or recorded so
far. This feature is handy for when
you need to keep an eye on file size or
wish to stop at a certain point in the
file. The libraries allow you to access
any part of the sound file and initiate
playback from one point to another.
One example of where this idea would
be useful is in speech pathology where
speech analysis of a particular word
spoken is necessary.
Construction
This is quite simple and can be
done in about an hour or so – less if
you’re more experienced. Before you
begin any soldering, check the board
thoroughly for any shorts or breaks
in the copper tracks. These should be
repaired with a small artwork knife
or a touch of the soldering iron where
appropriate.
When you’re sure that the board
is OK, you can start construction by
installing the resistors, capacitors,
the LED and the IC. These last two
components and the two electrolytic
capacitors are polarised so make sure
that you follow the overlay wiring
diagram and install them correctly.
The final two components are the
electret mic insert and the DB15 female
connector. In both cases, each component should just drop into place. The
mic insert will need a link connected
to the shielding can tab so that it can
be earthed via the circuit. Simply use
one of the clipped off leads from a
resistor to do this.
Wiring the cable
Rather than buy a complete DB15
male-male cable which costs about
$32, you can make your own (all of the
required parts will be included in the
kit). Twin shielded microphone cable
is used to make the connections. Use
the two inner conductors to make the
pin 1 and pin 2 connections to each
socket and the shield to make the pin
4 connections.
Testing
To test the unit, connect the cable
and the PC board to your computer and
measure the voltage drop across the
33Ω resistor. This should be around
120mV (0.12V). Any more than 200mV
and you should disconnect the board
and check for errors.
If this measures correctly, you
should also see the LED light up. Other voltages to check are the +5V rail
Where to get the kit
SmallTALK is available in two versions: the 3-minute version including
software and kit for $34.95; and the HDD version including software
and kit for $39.95.
Additional QuickBASIC .QLB and .LIB libraries of the record and playback routines for either versions are available for $7 each.
Please add $3.05 to all orders for postage and packaging and allow
two weeks for delivery. You can send your cheque or money order
to: R.A.T. Electronics, PO Box 641, Penrith, NSW 2750.
Note: Copyright © 1994. All software, circuits and PC art remain the
property of R.A.T. Electronics.
from pin 1 which should also appear
at pin 8 of IC1 (it should be around
4.9V). Pins 3, 5 and 7 of IC1 should
be 2.45V as well.
Now depending upon the software
you request, run the install program to
load it onto your hard drive. Once in
the directory SMALTALK type:
RECORD TEST.VOC
and press enter. You’ll be asked to
press enter again to initiate recording.
At this point, say a few words and
then press the space bar. You should
get a file byte count of around 8-10Kb
depending on how long you speak.
Now type in the same directory:
PLAY TEST.VOC
and you should hear the file being
replayed through your PC’s speaker.
If you purchased the HDD system,
then you would substitute the names
HDRECORD and HDPLAY for these
tests.
If all goes well, you can now include
the PLAY program and your own sound
files into your own programs whether
they are written in PASCAL, C or “plain
SC
old” BASIC.
July 1994 21
|