HARDWARE ★ MIDI PROJECTS ★

MIDI Projects

Although the MIDI interface seems to be regarded by many as the very latest thing in the field of electronic music, at the time of writing this, it has in fact been in existence for a few years. It is only in relatively recent times that it has become popular, and has been adopted by all the main electronic instrument manufacturers. It is not only synthesisers that are fitted with MIDI interfaces these days, but other instruments such as electronic pianos, percussion synthesisers, and even some portable keyboards are now equipped with them. In fact MIDI interfaces are even beginning to appear on some of the more sophisticated effects units such as digital delay lines.

One of the main points of the MIDI interface is that it enables any MIDI equipped instruments, regardless of which manufacturers they originate from, to be easily connected together and used as a sophisticated system. A less well publicised but possibly more important aspect of the MIDI interface is that it permits easy computer control of complex systems, and a few MIDI instruments plus a suitable computer and interface gives the user what is virtually a programmable orchestra. This has obvious attractions to those of limited playing ability, as well as accomplished musicians who require complex accompaniments while playing “live”. The main part of this book deals with the missing link, and provides details of interfacing some popular home computers to MIDI systems. The machines covered include the Amstrad CPC 464 and 6128, the Commodore 64 and VIC-20, the BBC model B, the MTX and MSX machines, the Sinclair QL, Spectrum, and ZX81, and others. Other subjects covered include interfacing MIDI equipment to analogue synthesisers, and interfacing MIDI systems to percussion synthesisers.

Amstrad CPC464

As far as interfacing is concerned the Amstrad CPC464 computer is very similar to the Sinclair Spectrum, and both machines are Z80 based. The Amstrad machine does not actually have an expansion port as such, but the “Floppy Disc" port is eminently suitable for add-on devices as it provides all the necessary address, data, and control lines, plus supply and other useful lines. Like the Spectrum, the Amstrad CPC464 utilizes a simplied form of input/ output address mapping which enables user add-ons to be easily intefaced to it. A10 going low is used to activate user add- ons, rather like A5 in the Spectrum's scheme of things. Where more than one address is needed the eight least significant address lines (AO to A7) can be decoded as well. A10 low corresponds to an address range of &F800 to &FBFF (some 1k). With an unexpanded machine it seems to be perfectly alright to use any addresses within this range, but with a disc drive fitted Amstrad recommend that only addresses in the range &F8E0 to &F8FF, &F9E0 to &F9FF, &FAE0 to &FAFF, and &FBE0 to &FBFF should be utilized. In other words the number on address lines A0 to A7 should be in the range &E0 to &FF. This avoids user addons causing any inteference with the disc drives or other peripherals, or vice versa.


Fig 18. The modification for use with the Amstrad CPC464

Provided no disc drive or other peripheral devices are fitted to the computer it is quite easy to fit the MIDI interface to the floppy disc port, and Figure 18 shows the necessary modification to the circuit. This is very similar to the system of decoding used for the Spectrum, with A10 being connected instead of A5, and A0 being connected in place of A6. The interface appears as echoes throughout the &F800 to &FBFF address range, but if the base addresses are used when using the interface it is controlled in the manner shown below:

  • Read &F800 Read Received Data flag
  • Write &F800 Reset Received Data flag
  • Read &F801 Read Received values
  • Write &F801 Transmit values

A 2 by 25 way 0.1 inch pitch female edge connector is needed to make the connections to the disc port, and the necessary connections are shown in Figure 19. The computer's connector has provision for a polarising key, but it may not be possible to find a matching edge connector. If it is not, it might be possible to add one to an ordinary 2 by 25 way connector, or the simple alternative of clearly marking the top and bottom edges of the connector will suffice.

The CPC464 has a 4MHz clock signal which is available at the floppy disc port (see Figure 19). This can be used as the basis of the 500kHz clock generator for the UART, and all that is needed is a three stage binary (divide by eight) counter circuit, as shown in Figure 20.

Software

A point worth emphasizing is that add-ons should always be connected to the computer prior to switch-on, not afterwards. This is especially the case with circuits that connect direct to the computer's busses, where at best the computer is likely to crash when the add-on is connected, and at worst the computer, the add-on, or both could be damaged. When any of the MIDI interfaces described in this book are fitted to the computer, after switch-on the usual start-up routine should always be obtained. If it is not there is almost certainly a fault in the interface, and the computer should be switched off again at once, after which the interface should be thoroughly checked for errors.

As in the previous examples, a good way of initially testing the interface is to get it to transmit values to itself and then read them back. A suitable test program is provided below. If all is well this will only work when the MIDI IN and MIDI OUT sockets are coupled together.

5 REM CPC464 TEST PROG
10 INPUT A
20 OUT &F801,A
30 PRINT INP(&F801)
40 GOTO 10

Fig 19. The connections to the CPC464's "Floppy Disc”port


Fig 20. Deriving the 500kHz dock signal from the CPC464's clock

This operates in much the same way as the previous test programs, but note that the CPC464 uses the INP function when reading input devices, and not IN, as used by the Spectrum and some other Z80 based computers.

These four commands can be used to check that the Data Received flag can be read and reset properly. Again, the MIDI IN and MIDI OUT sockets of the interface must be linked if this test routine is to function properly.

OUT &F801,0
PRINT INP(&F800) AND 128
OUT &F800,0
PRINT INP(&F800) AND 128

If everything is functioning properly this should give a returned value of 128 from the second command (flag set), and 0 from the fourth (flag reset).

This basic step-time sequencer program can be used to test out the interface with a synthesiser or other MIDI equipped instrument.

5 REM CPC464 SEQUENCER PROG
10 READ A,B
20 IF A=0 THEN STOP
30 OUT &F801,150:OUT &F801 ,A:OUT &F801,127
40 FOR D= 1 TO B:NEXT
50 OUT &F801,134:OUT &F801,A:OUT &F801,0
60 GOTO 10
70 DATA 60,250,62,250,64,250,65,250,67,250,69,250 71,250,72,500,0,0

Here, as in the other simple sequencer programs, it has been assumed that the instrument being controlled is not a touch sensitive type, or that it is but the same velocity values are to be used for each note. It would be quite easy to make the velocity values programmable though, and this would only entail adding parameters C and D at line 10, and then using these variables to replace the dummy velocity values at lines 30 and 50.

Amstrad CPC6128

The C'PC'464 MIDI interface might function properly with the Amstrad disc drive added to the machine, but there is a problem here. The same is also true of the CPC664 computer (which is basically a CPC464 with built-in disc drive), and the CPC6128 (which is more or less a CPC664 with an extra 64k of memory). As pointed out earlier, by using addresses in the range &F8E0 to &F8FF the interface can be controlled without any risk of interfering with operation of the disc drive, or other Amstrad peripherals such as the communications port. However, when any external add-ons are accessed line A10 is taken low, and this would almost certainly cause spurious operations of the MIDI interface.


Fig. 21 : Additional address decoding for use with the CPC464

This can be avoided by decoding some of the eight least significant address lines so that the interface is only activated when addresses in the area reserved for user add-ons are accessed. This is easily accomplished, and all that is needed is a couple of extra gates connected as shown in Figure 21. These are the two 4 input NAND gates of a 74LS20 device, and one of them is fed from lines A4 to A7. This gate's output will go low only when all four inputs are high (which corresponds to the hexadecimal digit “F”). The second gate is just wired as an inverter, so that the output of the circuit goes high when all four inputs are high. This output is used to drive the positive enable input of IC2 in the interface, which is the 3 to 8 line decoder. This input was previously unused and therefore tied to the positive supply rail. This places the interface at addresses from &F8F0 to &F8FF (and corresponding addresses in pages &F9, &FA, and &FB), which is the upper half section of memory which is reserved for user addons. When using the additional address decoding the addresses shown below are used to control the interface.

  • Read &F8F0 Read Data Received flag
  • Write &F8F0 Reset Data Received flag
  • Read &F8F1 Read received values
  • Write &F8F1 Transmit values

It is only fair to point out that I have not had an opportunity to try out the interface with a CPC464 connected to a disc drive, or to one of the Amstrad machines which has a built-in disc drive. However, with the interface mapped into the Amstrad approved section of the input/output map there should be no difficulty with any other peripherals interfering with the interface, or the interface interfering with other peripherals. There is one exception, and that is where another user add-on is connected to the computer at the same time as the MIDI interface. The other user add-on might be designed to only use addresses from &F8E0 to &F8EF. which is the half of the input/output map for user addons which the MIDI interface does not use. In this case there should be no problems. If the other device uses any addresses in the range &F8F0 to &F8FF, then it should not be used at the same time as the MIDI interface.

R. A. Penfold , MIDI Projects

★ ANNÉE: 198X
★ AUTHOR: R. A. Penfold

★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Hardware » Modem - Btx - Dataphon (CPC Amstrad International)
» Hardware » Amstrad et Minitel (CPC Revue)
» Hardware » Modem - Pace Series 4
» Hardware » Modem - Astracom 1000
» Hardware » Modem - Volex TTX 2000A
» Hardware » Interface Minitel - Cortel
Je participe au site:

» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.7-desktop/c
Page créée en 262 millisecondes et consultée 1042 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.