##### Organ Talk

##### Organ Talk

Home -> Magazines -> Issues -> Articles in this issue -> View Show Page Scans 2

## Organ Talk | |

## Computerscope |

**Here's a special treat for ZX81 users, with computerscope programs that show you harmonic synthesis at work for organ or synthesiser.**

All hobbies tend to be addictive and electronic music is no exception. The addiction leads to purchasing and constructing various pieces of equipment but even so we never have all the items we would really like.

An oscilloscope is extremely useful but there may be readers who have considered a small personal computer to have a higher priority. For those in this category who have an unexpanded ZX81, this article suggests methods of setting up complex waveform programs by mixing sine waves based on drawbar settings. The monitor will show a static display similar to the oscilloscope trace and, whilst not as exciting as 'Space Invaders', such programs are interesting and instructive.

I have always favoured the drawbar organ as this method of harmonic synthesis does not limit the player to a number of tabs with fixed tonal qualities. The Dictionary of Hammond Organ Stops states that drawbars can provide 23 million String Organs, 20 million Full Organs and 10 million short-resonated Reeds!

These comments are based on mathematical permutations and the individual tonal variations are often too small to be detected. However, there is no doubt that additive synthesis can provide many audibly different tonal effects from which the player can select his favourites — and he can spend a lifetime experimenting with them.

Examining waveforms of drawbar combinations on a 'scope is a fascinating exercise which we can attempt to duplicate on the 1K ZX81 — or at least obtain close approximations with pixel plotting.

Type the listing below into the ZX81, which will plot a simple sine curve to represent the fundamental drawbar used at its maximum setting (00 8000 000). With the exception of the double FOR-NEXT loop program for overlaying two sine waves on each other (shown later), this listing will be used in amended form for all subsequent examples:

**10 FAST
20 FOR N = 0 TO 63
30 PLOT N, 22+20*SIN(N/32*PI)
40 NEXT N**

This is our starting point but, before beginning to elaborate, we should take a closer look at the calculation for the Y co-ordinate:

'22' places the zero line of the sine wave at mid-screen, pixel line 22. As the sine calculations swing either side of zero, this figure will always head the Y co-ordinate calculation to ensure that it is correctly placed on the screen. Failing this, there is every chance of error report B (integer out of range) as the plot could try to exceed the vertical plot limit of 0-43.

'20' represents the relative strength of the waveform component. As additional waveforms are added to the fundamental this figure will have to be scaled down: a safe rule is to divide 20 by the total number of waveforms being summed if they are all to 'sound' at maximum strength. The result found can be scaled to accord with drawbar settings and, although drawbars are usually calibrated over the range 0-8, percentage mixtures are easier to deal with when setting up a program. This component of the Y co-ordinate needs a little thought to avoid error report B: running the program will soon prove if there is an error! Alternatively, change PLOT to PRINT in line 30 and note whether the sequence thrown up exceeds 43 or is less than 0.

'32' is the figure that controls the number of sine curves obtained - in our first program, one only. Divide 32 by the harmonic number when adding waveforms to the fundamental so that 16 will be required for the Second Harmonic, 10.667 for the Third etc.

To plot the curve of the second harmonic, therefore, line 30 is edited to read:

**30 PLOT N, 22+20*SIN(N/16*PI)**

Curves of both the fundamental and second harmonic can be overlaid by using two FOR-NEXT loops:

**10 FAST
20 FOR N = 0 TO 63
30 PLOT N, 22+20*SIN(N/32*PI)
40 NEXT N
50 FOR N = 0 TO 63
60 PLOT N, 22+20*SIN(N/16*PI)
70 NEXT N**

This may give some idea of what to expect when the fundamental and second harmonic are combined into a single trace, but adding a third loop is not possible with a 1K RAM and in any case the screen would become cluttered and confusing.

In order to combine these two waveforms mathematically (bearing in mind the previous comments on the Y co-ordinate), we revert to

This will print out the curve of drawbars set at 00 8800000. To make the second harmonic weaker relative to the fundamental, scale down the figure by which SIN(N/16*PI) is multiplied — in this case 10. So, a trace of 00 8400 000 will require:

Printing out the third harmonic trace on its own will call for:

**30 PLOT N, 22+20*SIN(N/10.667* PI)**

- or, to combine fundamental, second and third harmonics at full strength for drawbar setting 00 8880 000, this line becomes:

**30 PLOT N,22+7*SIN(N/32*PI)+7 *SIN(N/16*PI)+7*SIN(N/10.667 *PI)**

This process can be extended until, even in FAST mode, the ZX81 takes half a minute or more to complete its task. Complex waveforms all have differing overtones: sawtooth, for example, contains the full series of harmonics that get weaker as their frequencies increase. Typified by drawbars set at 00 8765 432, an approximation is given by editing line 30 finally to:

**30 PLOT N, 22+6*SIN(N/32*PI)+5, 25*SIN(N/16*PI)+4.5*SIN(N/10.667*PI)+3.75*SIN(N/8*PI)+3*SIN (N/6.4*PI)+2.25*SIN(N/5.3*PI)+1.5*SIN(N/4*PI)**

There are plenty of ways this principle can be used (or should I say plenty of scope!) but a luxury you miss is the inability to alter Y amplifier gain by the turn of a knob. Instead, you have to play with the multiplier figure to make the vertical spread as great as possible before running into error report B.

It would be possible to assign variables at the start of the program by means of LET statements so that the multiplier (or drawbar setting) could be altered more easily and perhaps also the harmonic number as well. Part of line 30 would then appear as:

**......22+A*SIN(N/X*PI) ... +B*SIN(N/Y*PI) etc.**

- but much will depend on the memory usage in this case.

As line 30 becomes more complex, the ZX81 takes longer to plot its answer - hence, the suggestion to run in FAST mode. Without a printer attached, small differences in the waveform may not be easy to discern. An SLR camera can provide a permanent record of any display as a substitute: loaded with 100ASA film, give 1/4 second at f5.6 with brightness turned down somewhat to give the sharpest result.

Each of the suggested programs will give sensible curves, bearing in mind the limitations of pixel plotting. A graph of combined upper harmonics, however, will appear very jumbled with the course of plotting impossible to follow. In such cases, run in SLOW mode and join the plots as they appear by means of a chinagraph pencil on the monitor screen. This is easily removed afterwards with paper tissue, but at least you have a record of the plots after the equipment is switched off!

I can't think of a more sophisticated method with only 1K of memory and without extra modules but maybe you can. At any rate, the process described is an interesting one for a wet Sunday afternoon.

If musical waveforms are of particular interest, perhaps the moral of this article is to save up and purchase a 'scope!

Micro Music - The ZX Spectrum Beepquencer

(EMM Oct 82)

Micromusic - Make music with the ZX81 (Part 1)

(EMM Dec 81)

Browse category: Computer > Sinclair

*Feature
by Ken Lenton-Smith*

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!