Magazine Archive

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

Article Group:
Computer Musician

OMDAC Update

Article from Electronics & Music Maker, September 1984

Some Spectrum software for our music control micro-peripheral project, published in E&MM June '83. Explanations by the project's designer, Jim Grant.


Some Spectrum software - and a couple of hardware modifications - for E&MM's DAC computer peripheral, with more to come next month.


In E&MM June '83 we published a computer peripheral project, the OMDAC. To recap, this was a general arrangement consisting of an ADC, an eight-way multiplexed DAC, eight output drivers suitable for synth triggers and four digital In/Out channels for clocks, switches and so on.

In addition to the constructional project several demonstration programs for the Acorn Atom were listed. The Atom is now an obsolete machine, almost entirely overshadowed by the BBC and Electron. Fortunately, the OMDAC is completely compatible with the Sinclair Spectrum, but unfortunately the original article did not include any Spectrum programs. To correct this omission, and to encourage reader response, we have written a useful 'Patch Change' program for the Spectrum.

Although the program is shown in two parts, the machine code and BASIC, the BASIC listing contains the machine code in the DATA statements at the beginning of the program. Since the BASIC program is highly modular, with each subroutine performing a distinct task, it is straightforward to trace program execution for different commands.

There are four commands displayed at the bottom of the screen, and these are shown in Table 1. Pressing 'C' on the keyboard causes the displayed command to flash, and the Spectrum next expects a number between 1 and 8 inclusive. When a valid number is supplied, the program immediately opens a link between the ADC and the selected control voltage channel. The current conversion is rounded and scaled to give a maximum of 63, and if the DAC is correctly calibrated will result in a voltage range of five octaves and one tone in semitone steps. When a different channel is selected, the last conversion is stored and continually output as a voltage through the old channel.

So far, the program does much the same as the Atom version: however, there are extra features. Pressing 'P' causes the command Panel to flash, and the Spectrum again expects a number between 1 and 8 inclusive. If you imagine each screen of eight channels as a patch (CH-1 to VCO-1 freq, CH-2 to VCO-2 freq, CH-3 to VCF ref, say) then selecting different Panels allows up to eight patches to be resident in the Spectrum.

To demonstrate this, BREAK the program and GO TO TEST (line 1510). The Channels will be filled with artificial data generated by the program: CH-1 to CH-8 of Panel 1 will be 0 to 7 respectively, while CH-1 to CH-8 of Panel 2 will be 8 to 15, and so on.

When 'S' (SAVE) or 'L' (LOAD) is pressed, the selected command will flash and the Spectrum will wait until the key is pressed again. If it is, a prompt appears for a filename and the eight Panels with Channel data are Saved or Loaded as bytes in the usual Spectrum way. If the same key is not pressed again, the command is aborted.

Assembler Program



The second program is an assembler listing of the machine code held in the DATA statements, lines 170-260. This short but very important program takes care of the Channel multiplexing, and can be included as an I/O subroutine in many OMDAC programs. Each time it's called by a RANDOMIZE USER 32344 statement, it fetches consecutive values from a table held in RAM (whose base address is 32256) and outputs them via the DAC to their corresponding channels.

The routine is best called fairly often to refresh the output sample and holds and prevent them from drifting. An outside limit would be about 10 seconds between scans if no discernible pitch occurs from VCOs connected to the control voltage channels.

Considering the importance of the machine code in the program, I think it's worth examining its action in detail. The program is quite simple and can be divided into three sections as listed below.

1) Initialise constants
2) Scanning loop
3) Delay subroutine

The section that requires the most programming care is the loop, and in particular the part which deals with changing the channel address. The output channel is controlled by a CMOS 4051 (1 of 8 switch). This has three address lines to close a uniquely selected switch and a control line to open all switches regardless of the address. It's a useful chip, and there are many to be found in programmable synths such as those made by SCI. However, it does possess one annoying fault: when the switch address is changed, for the briefest instant all the switches are connected together thus corrupting the voltages held on the sample and holds. The problem is aggravated by changing the address at high speed, which is exactly what the machine code does.

A partial solution is to bring the control line HI (open all switches) before changing the address and to bring LO afterwards. This cures most funnies except for the worst case when all address lines are changing, ie. from the 111 code to the 000 code at the end of a scan. A simple way round the problem is to change only one address line between adjacent channels, and this can be achieved by scanning the channels in Grey code order. This explains the need for two lookup tables in the listing: lines 600 to 670 show the channel order for the control line LO, while lines 680 to 750 show the order for the control line HI (just add 8, remembering that it's HEX).

For those who are unfamiliar with Grey code, keep calm, it's nothing complicated. It's simply a way of generating a binary sequence so that only one bit changes between adjacent numbers, and is often used in mechanical binary encoders to minimise errors when the code changes. If more than one bit changes, perhaps due to some part being out of alignment, then the error can be detected and flagged.

BINARY GREY CODE
000 000
001 001
010 011
011 010
100 110
101 111
110 101
111 100


The delay subroutine is to give the sample and holds a chance to charge to the DAC voltage and settle down before the address is changed.

Modifications



Finally, it's been found that the conversion dither of the ADC can be reduced quite significantly by the inclusion of two 1uF capacitors, each used to decouple digital noise from the reference voltages. Solder - on the track side - one of the capacitors directly across RV4 between the wiper and ground and the other one between the wiper of RV1 and ground. Make sure that the polarity of the capacitors is correct: the minus side goes to ground.

OMDAC/Spectrum assembler listing.
(Click image for higher resolution version)

OMDAC/Spectrum BASIC listing.
(Click image for higher resolution version)


Next month's E&MM will feature details of further hardware modifications that adapt the OMDAC for use with the BBC Model B microcomputer, while additional software is also in the pipeline. Meanwhile, OMDAC PCBs are still available from the E&MM Mail Order Dept at the editorial address, price £5.95 each including VAT and carriage. The June 83 back issue containing parts and construction details is also available at £1.30. Please make cheques-POs payable to Music Maker Publications Ltd, and allow 28 days for delivery.


More with this topic


Browse by Topic:

Computing



Previous Article in this issue

Rumblings...

Next article in this issue

Passport MIDI/4 Software


Publisher: Electronics & Music Maker - Music Maker Publications (UK), Future Publishing.

The current copyright owner/s of this content may differ from the originally published copyright notice.
More details on copyright ownership...

 

Electronics & Music Maker - Sep 1984

Computer Musician

Topic:

Computing


Feature by Jim Grant

Previous article in this issue:

> Rumblings...

Next article in this issue:

> Passport MIDI/4 Software


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 December 2024
Issues donated this month: 0

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

Funds donated this month: £0.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!
muzines_logo_02

Small Print

Terms of usePrivacy