1944GPW
Veteran Member
A long time ago I was a Sydney schoolkid who had an australian Applied Technology S-100 system which my brother and I built from a series of kits. It comprised a DG680 CPU, ETI-640 VDU, ETI-681 PCG, and I honestly can't remember how much memory but it was a few 16k boards of static RAM, so most likely 64k. As well as a nice black aluminium card cage with a beefy transformer and caps, and loading/saving to a cassette tape recorder. Later on we got a Versafloppy II and a TEAC FD-50A (but no operating system, started writing my own) but that's another story.
After reading the brilliant article 'A Sampling of Techniques for Computer Performance of Music' by Hal Chamberlin in the BYTE September 1977 issue one of the things I wondered was, could my Z80 also generate polyphonic music in real time:
https://archive.org/details/byte-magazine-1977-09/page/n63/mode/2up
Hardware.
Firstly I made a little etched PCB for the circuit on page 66 of the article. This is a simple 8-bit ladder DAC using two CMOS 4050 non-inverting buffers with a bunch of resistors. I most likely got the components from the Dick Smith store on the Pacific Highway in North Sydney, who actually had really good hobbyist electronics items at that time.
It's all so long ago now but I think my PCB below combined that circuit with the transistor amplifier on page 77. But given that the LM3900 is a 16-pin device and I seem to have an 8-pin amplifier chip drawn there, I'm baffled now. Maybe it was an LM386 or something, I can't recall. The BYTE article has a further circuit for a low-pass filter but I didn't bother with that and just amplified the DAC output directly.
The board had a mono headphone jack which I fed into my AKAI AA-1050 stereo receiver perched along with a pair of JVC SK-33 speakers on the top of a piano in my bedroom. The DG680 CPU board had I recall a 16(?)-pin DIP socket on it for at least one Z80 I/O port. Anyway I soldered a ~30cm length of ribbon cable to a DIP header for this, and the other ends soldered to the DAC board.
Software.
Alas the article's examples were for a KIM-1, and the 6502 instruction set was a bit too 'alien' for my 'Z80 brain' so a very clever school friend of mine who knew his Apple ][ inside and out translated the examples into Z80 code for me (without even knowing or being interested in the Z80 architecture as it was too 'baroque' compared to the 6502 he thought), and I present his code here along with my own annotations and further experiments. I haven't seen hime for maybe ~40 years now as he moved to the US but I suppose he wouldn't mind me putting this on the net for others to enjoy and learn from like I did.
This is his original code for the two routines. The ADDUP routine calls the PLAY routine which in turn does the summation of amplitudes of the four voices and sends the value in the accumulator to the DAC on I/O port 2.
Also for some reason I had a version of this Play routine which is mostly the same as my friend's version but I can't see any tempo logic there.
The two columns at right are the intruction execution times for each instruction + opcode in uSec, one for running at 2MHZ and the other for running at 4MHz, explanation below.
Also the integer cosine table needed for the lookup and summation of the (up to) four voices as the waveform was being synthesised, this lived at 6100H.
Each voice went from 0 to 3F so the four together would be FF ie the full eight bits for the DAC:
I annotated the musical note table from page 76 of the article for a 4MHz Z80. This was at 5300H, looking at my annotations to my friends ADDUP code.
Now for the musical score to be played. I had no idea what the article's 'Star Spangled Banner' example sounded like so I typed in some or half of it to test it out. It worked so I took one of my Mum's piano scores (hence the piano in my bedroom) and encoded Bach's Praeludium in C Major, one of my favourite classical pieces at the time. Unfortunately I don't have the notes or scribblings for that to present here but undoubtedly it would have been scribbled out on a piece of Foolscap paper like the above. I did start writing a simple musical note editor for further easy score encoding but never finished that.
Further note: I had modified my DG680 Z80A CPU board to have a double-speed 'turbo' mode, this was a 4MHz crystal glued to the solder side of the card near the top edge along with a cool blue rocker switch salvaged from some IBM junk. Thus I could go from 2MHz to 4MHz and it was a real performance improvement. Sometimes if I was lucky I could switch from 2 to 4 without the program crashing, and it would continue to run, probably helped by having only static RAM I guess. Otherwise it just needed a reset after switching. I think I needed to switch back to 2MHz to load/save from tape, but I can't recall now.
In the course of writing up this memoir I browsed through Hal Chamberlin's opus 'Musical applications of Microprocessors' but to be honest the details about real-time waveform encoding are really buried in there along with a heap of other technical mumbo-jumbo, so I recommend the BYTE article over the book if you just want to experiment without getting into too much complexity. It does however go into detail about NOTRAN, Mr Chamberlin's score notation encoding program, and maybe that would be good to re-imagine for a modern Z80 project.
Anyway that's all I can remember about this project from long ago, hopefully I've described enough here for VCFED folks to perhaps get their old Z80 box to do a new trick.
After reading the brilliant article 'A Sampling of Techniques for Computer Performance of Music' by Hal Chamberlin in the BYTE September 1977 issue one of the things I wondered was, could my Z80 also generate polyphonic music in real time:
https://archive.org/details/byte-magazine-1977-09/page/n63/mode/2up
Hardware.
Firstly I made a little etched PCB for the circuit on page 66 of the article. This is a simple 8-bit ladder DAC using two CMOS 4050 non-inverting buffers with a bunch of resistors. I most likely got the components from the Dick Smith store on the Pacific Highway in North Sydney, who actually had really good hobbyist electronics items at that time.
It's all so long ago now but I think my PCB below combined that circuit with the transistor amplifier on page 77. But given that the LM3900 is a 16-pin device and I seem to have an 8-pin amplifier chip drawn there, I'm baffled now. Maybe it was an LM386 or something, I can't recall. The BYTE article has a further circuit for a low-pass filter but I didn't bother with that and just amplified the DAC output directly.
The board had a mono headphone jack which I fed into my AKAI AA-1050 stereo receiver perched along with a pair of JVC SK-33 speakers on the top of a piano in my bedroom. The DG680 CPU board had I recall a 16(?)-pin DIP socket on it for at least one Z80 I/O port. Anyway I soldered a ~30cm length of ribbon cable to a DIP header for this, and the other ends soldered to the DAC board.
Software.
Alas the article's examples were for a KIM-1, and the 6502 instruction set was a bit too 'alien' for my 'Z80 brain' so a very clever school friend of mine who knew his Apple ][ inside and out translated the examples into Z80 code for me (without even knowing or being interested in the Z80 architecture as it was too 'baroque' compared to the 6502 he thought), and I present his code here along with my own annotations and further experiments. I haven't seen hime for maybe ~40 years now as he moved to the US but I suppose he wouldn't mind me putting this on the net for others to enjoy and learn from like I did.
This is his original code for the two routines. The ADDUP routine calls the PLAY routine which in turn does the summation of amplitudes of the four voices and sends the value in the accumulator to the DAC on I/O port 2.
Also for some reason I had a version of this Play routine which is mostly the same as my friend's version but I can't see any tempo logic there.
The two columns at right are the intruction execution times for each instruction + opcode in uSec, one for running at 2MHZ and the other for running at 4MHz, explanation below.
Also the integer cosine table needed for the lookup and summation of the (up to) four voices as the waveform was being synthesised, this lived at 6100H.
Each voice went from 0 to 3F so the four together would be FF ie the full eight bits for the DAC:
I annotated the musical note table from page 76 of the article for a 4MHz Z80. This was at 5300H, looking at my annotations to my friends ADDUP code.
Now for the musical score to be played. I had no idea what the article's 'Star Spangled Banner' example sounded like so I typed in some or half of it to test it out. It worked so I took one of my Mum's piano scores (hence the piano in my bedroom) and encoded Bach's Praeludium in C Major, one of my favourite classical pieces at the time. Unfortunately I don't have the notes or scribblings for that to present here but undoubtedly it would have been scribbled out on a piece of Foolscap paper like the above. I did start writing a simple musical note editor for further easy score encoding but never finished that.
Further note: I had modified my DG680 Z80A CPU board to have a double-speed 'turbo' mode, this was a 4MHz crystal glued to the solder side of the card near the top edge along with a cool blue rocker switch salvaged from some IBM junk. Thus I could go from 2MHz to 4MHz and it was a real performance improvement. Sometimes if I was lucky I could switch from 2 to 4 without the program crashing, and it would continue to run, probably helped by having only static RAM I guess. Otherwise it just needed a reset after switching. I think I needed to switch back to 2MHz to load/save from tape, but I can't recall now.
In the course of writing up this memoir I browsed through Hal Chamberlin's opus 'Musical applications of Microprocessors' but to be honest the details about real-time waveform encoding are really buried in there along with a heap of other technical mumbo-jumbo, so I recommend the BYTE article over the book if you just want to experiment without getting into too much complexity. It does however go into detail about NOTRAN, Mr Chamberlin's score notation encoding program, and maybe that would be good to re-imagine for a modern Z80 project.
Anyway that's all I can remember about this project from long ago, hopefully I've described enough here for VCFED folks to perhaps get their old Z80 box to do a new trick.