Magazine Archive

Home -> Magazines -> Issues -> Articles in this issue -> View

Chip Parade (Part 6)

Micro sound generators

Robert Penfold takes a PEEK at sound chips for microcomputers

Many home computers, particularly those in the sub-one hundred pounds bracket, have quite limited sound facilities with just one tone channel, or no sound facility at all. On the other hand, machines such as the Oric 1, BBC, Atari, and Commodore offer typically three tone channels plus one noise channel. Furthermore, a wide frequency range plus facilities for envelope shaping for both volume and frequency are often included. In the case of the Commodore 64 there is even a choice of waveforms and several types of filtering can be used.

Although one might expect a vast amount of circuitry to provide these facilities, there is invariably just one (admittedly rather complex) chip at the centre of computer sound generators, and little in the way of discrete circuitry. These chips are generally known as PSGs (programmable sound generators), although Commodore refer to their 6526 device (as used in the CBM64) as a SID (sound interface device). In this and next month's articles we will consider the basics of some of the most popular and interesting sound generator chips.

GI's Chips

Fig 1 AY-3-8910/12 pin-out details

Probably the best known of these sound generator chips are the AY-3-8910 and AY-3-8912 devices which are popular for home-constructor add-on sound generators for simple computers, and are also to be found in a few machines. The Oric 1 uses the AY-3-8912 for instance. Fig 1 shows pin-out details for both devices and there is no difference between the sound generator section of each one. The only difference between the two chips is that the AY-3-8910 has two eight bit input/output ports (pins IOA0 to IOA7 and IOB0 to IOB7) whereas the AY-3-8912 has only one input/output port. In many practical applications these ports are not used, and we will not consider them further here. Incidentally, the "TEST" pins are only used by the manufacturer during the final checking of the chips, and no connections are made to these in use.

Fig 2 Basic arrangement used in the 8910/12 PSGs

These sound generators are obviously quite complex, but the basic arrangement used is shown in block diagram form in Fig 2 (which ignores the I/O ports and control logic). There are three tone generators which each feed through to separate outputs, but the noise generator does not have a separate output. Instead, under software control it is mixed into one of the other channels. The inclusion of separate outputs enables a sort of crude stereo effect to be produced if desired, but invariably in practice the three outputs just seem to be wired together.

Although normally referred to as tone generators, these circuits are not actually oscillators. They are in fact a form of down-counter circuit, and each one is controlled by a 12 bit binary number. The 8910/12 chips have only an eight bit data bus (pins DA0 to DA7) and are primarily intended for use with eight bit microprocessors. The 12 bit binary number therefore has to be written to the device in two bytes, with four bits of one byte being unused.

The basic action is for the counter to count downwards until it reaches zero, whereupon it is automatically reloaded with the original number and the countdown commences again. The rate at which the counter operates is determined by an external clock signal, which is often provided by one of the existing clock circuits of the computer. The output frequency is equal to the frequency at which the counter completes the count-down action, but the clock is divided by 16 before it reaches the counter circuits. In other words, the output frequency is equal to the clock frequency divided by 16, and then divided by the number fed to the counter circuit. A 12 bit counter gives a range of more than 4000 different output frequencies, and tones from the sub-audio to the ultrasonic range can be produced. A point worth noting is that the larger the number fed to the counter, the longer it takes to perform each count-down, and the lower the output frequency. Some computers manipulate things for the user so that the larger the number used as the pitch value of a SOUND statement the higher the pitch, but many (including the Oric 1 and Aquarius machines) do not.

The noise generator actually produces a squarewave output of pseudo-random frequency, rather than a true white noise sound. The pitch of the noise can be varied using a system which is similar to that used for the tone generators, but the relevant counter circuit is only a five bit type which gives a range of just 32 pitches. The noise output is quite good at high frequencies, but at low frequencies the strong harmonics on the squarewave output give a rather rough sounding output. This is good for games sound effects, but is probably not of great use for music applications.

Controlling the amplitude of the output signals is not difficult as all the signals, including the pseudo-noise one, are squarewaves. Problems with clipping or otherwise distorting the signals are therefore avoided. There is a four bit volume control register for each tone channel, and this gives 15 volume settings plus off for each channel. Alternatively, the built-in envelope generator can be used, but this is quite complex and there is insufficient space available here to give a detailed discussion of it. However, there are effectively a number of predefined and fairly simple envelope shapes that can be selected. The number of different volume levels available within the envelope remains at just 15 plus off, and this does not give very precise envelope control. This is less than ideal from the music making point of view, and the stepping up and down in volume can often be clearly heard!

An important point to bear in mind is that the 8910/12 chips are designed to interface with GI's microprocessors which have outputs that control the function of the PSGs via BDIR, BC1, and BC2 inputs. Addresses of internal registers are fed to the device via the data bus, as is the data written to these registers. The input/output ports can also be read via the data bus, and the device must be set to the inactive state at times when it is not being written to or read from. The required state is set using the three control lines mentioned above. With most of the popular microprocessors, such as the Z80A or 6502, peripheral devices are controlled by the read/write line(s) and some of the address lines, and are placed in the memory or in/out map. It is possible to interface the 8910/12 chips to systems based on the Z80A, 6502, etc, but a little ingenuity is required, and the software is inevitably complicated slightly.


Fig 3 Pin-out details for the SN76489

The TI SN76489 is perhaps less well known than the GI chips, but it offers similar facilities and is the chip used in the sound generator of the BBC machine which is generally regarded as one of the best. It is contained in a standard 16 pin DIL package, and pin-out details are shown in Fig 3. Like the GI chips, the SN76489 does not have address inputs to select the desired register, but instead uses the eight bit data bus to select the desired register as well as sending data to it. However, the SN76489 does not have the same control inputs as the GI devices, and instead has two inputs (pins five and six) and a status output. In use, pin six is first taken low, data is written to the data bus, and then pin five is taken low. Pin four then goes low until the data has been loaded (which takes 32 clock cycles). Pin five can then be taken high, further data loaded, pin five then taken low, and so on, or pins five and six are both taken high if no further data is to be transferred to the device. Like the GI chips, the interfacing and driving software might require a little ingenuity.

There are three tone generators plus a noise source in the device, and the frequency is controlled in the same basic way as in the 8910/12 chips. The frequency control register for each tone generator is 10 bits long, and is supplied in a four bit byte followed by a six bit byte. If we take the first byte sent when setting a tone generator's frequency, bit 0 is always one (to indicate that it is the first byte). The next three bits (1, 2, and 3) are the address of the required register, and the remaining four bits (4,5,6, and 7) are the most significant bits of the number written to the counter. In the next byte bit 0 is always 0 (to indicate it is the second byte), and bit one is ignored. The other six bits are the least significant bits of the number written to the counter. A range of 1024 tones is available.

The volume of each tone generator and the noise generator can be controlled, and this requires a single byte instruction. Bits 0 to 3 are the same as when sending the first byte of a two-byte instruction. The four most significant bits select one of the 15 volume settings or off. The volume settings give a level of attenuation which varies from 0dB to 28dB in 2dB steps. There is no built-in envelope shaping, but this can, of course, be provided by the driving software. The BBC computer has provision for ADSR envelope shaping plus pitch envelope shaping.

The noise control register gives options of high, low, or medium frequency noise. Additionally, high, low, or medium frequency "periodic" noise can be provided. This would seem to be regular bursts of noise, and the sound is not actually much different to that provided by the tone generators. Another option is for the noise pitch to be controlled by the frequency of the channel 3 tone generator, and this enables it to be varied over a wide range. The noise is generated using a shift register, and as for the 8910/12 devices, it sounds rather rough at low pitch settings, and is nothing like filtered (low frequency) white noise. Both the TI and the GI chips require a single five volt suppy. They do not provide a high enough output level to directly drive a loudspeaker, but a simple output stage using a TBA820M or LM386 integrated circuit will give a reasonable output power from a five volt supply.

Series - "Chip Parade"

Read the next part in this series:

All parts in this series:

Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 (Viewing) | Part 7 | Part 8 | Part 9 | Part 10 | Part 11

More with this topic

Browse by Topic:

Electronics / Build

Previous Article in this issue

BBC Micro

Next article in this issue

BBC Reverb

Electronic Soundmaker & Computer Music - Copyright: Cover Publications Ltd, Northern & Shell Ltd.


Electronic Soundmaker - Feb 1984

Donated by: Ian Sanderson


Electronics / Build


Chip Parade

Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 (Viewing) | Part 7 | Part 8 | Part 9 | Part 10 | Part 11

Feature by Robert Penfold

Previous article in this issue:

> BBC Micro

Next article in this issue:

> BBC Reverb

Help Support The Things You Love

mu:zines is the result of thousands of hours of effort, and will require many thousands more going forward to reach our goals of getting all this content online.

If you value this resource, you can support this project - it really helps!

Donations for June 2022
Issues donated this month: 0

New issues that have been donated or scanned for us this month.

Funds donated this month: £49.00

All donations and support are gratefully appreciated - thank you.

Magazines Needed - Can You Help?

Do you have any of these magazine issues?

> See all issues we need

If so, and you can donate, lend or scan them to help complete our archive, please get in touch via the Contribute page - thanks!

Please Contribute to mu:zines by supplying magazines, scanning or donating funds. Thanks!

Monetary donations go towards site running costs, and the occasional coffee for me if there's anything left over!

Small Print

Terms of usePrivacy