MIDI interface

ZXNet echo conference «real.speccy»

From Aleksey Tarasow To All 24 December 2003

Hello All!

I remember the topic of the subject was raised. It all started with the publication of an article
on this topic in Paragraph 18. But as I understand, most of the participants in the conversation never read this article. It seemed to me that it would be nice to place this article here,
especially since the editors do not prohibit it.

=== Beginning midi_zx.txt ===
Reprint from Paragraph ©18. p.12

MIDI interface. Continuation

Greetings, Spectrumists!

Once again I propose my project lMIDI interface for
ZX-Spectrum-compatible computers. Why l again? Because
he has already suggested it several times. Unfortunately - to no avail. And the reaction to my proposals that was 90% has no right
to be called a result. But I still do not lose hope and hope that there are still enthusiasts with heads who are capable of thinking creatively and
working with hands that are sharpened as they should be. Wake up and start
helping. Help not me, but, first of all, yourself and the platform that you still love, no matter what. This time I decided
to write an article in more detail and I will try not to miss the most
important things in it.

Where to start? It would probably be worth starting with something that would immediately arouse interest and attract attentionSpectrum users.
What could it be? Probably some kind of thing that the Spectrum still didn’t have, but which it wouldn’t be superfluous to have, and, most importantly, which would be useful for users of this computer.

As far as I remember the history of Specky, in 1985 its previous version was
refined - the memory was increased to 128 kilobytes, the number of screens was increased and... music was added processor
AY-3-8912 (AY-3-8910, YM2149F... - hereinafter - "AY"). That is even then
the developers were puzzled by increasing the sound capabilities of Specky.
For some time, indeed, this simple three-voice synthesizer
was simply a godsend for Spectrumists, especially for musicians. Music editors were written for it, and they immediately began to use it in games and simply for scoring programs. Listening to the music written
for AY, I was sometimes surprised at the virtuosity with which those who wrote this music used the more than modest (in modern times) capabilities of AY. And more than once the thought came to mind - what would they do if they were given more advanced technical means?!

Progress does not stand still. Now the capabilities of the small AY
can really be considered more than modest. And everything would be fine if Specky was currently already a lumer. But! HurtIt's a very durable machine.
There are still (I sincerely hope) many of its admirers. But time passes and since Specky lives, he must improve. And it
is being improved - a mouse, CD-ROM, hard drive are connected to it, a modem has been developed...

The sound has not remained unchanged. One of the most famous
developments in this area, in my opinion, is General Sound (GS).
Of course, the appearance of this module gives Specky new sound capabilities,
for example, you can write music using real instruments, loading
them into the module's memory.

All this is good. Of course, the developers worked conscientiously
(developing and debugging such a device is very difficult - I know from
my own experience), but what immediately caught my eye was the excessively high
complexity of the circuit; it could have been significantly simplified. Also, in my
opinion, the choice of a central processor is extremely unfortunate, which also operates at the limit of its capabilities - at the limit frequency.
It would be more reasonable, it seems to me, to use in this scheme
single-chip computers i8031, i8051 or their domestic analogues (BE31,
BE51) - at that time they were already available and hardly cost more Z80.
I think that the 8051 with its powerful assembler, high
performance, ability to address 64kb of RAM+ 64kb of ROM and
the ability to easily operate at frequencies up to 25 megahertz would be more appropriate.
However, I will not go deeper into the analysis of this circuit, because this is not
the purpose of my article.

In general, I decided to make my own “sound card”.
There were two options:

1. Develop something similar to GS.
2. Use an industrial sound card.

I immediately discarded the first option - it’s not worth the candle. All the same, using the available element base (for example, K572PA1)
it is impossible to achieve decent sound quality. And there’s a lot of fuss.

The second option suited me better. But again, too many
problems arose when trying to connect industrial sound cards. And it’s not even a matter of the number of wires and additional
chips. The problem is that there are many
varieties of sound cards and each has its own characteristics, starting with the initialization
of ports and beyond.

In this case, the way out of the situation could be to use
a family of cards that would have the same connection method and
the same data exchange protocol for control. Soon such an option was found. In my opinion, the smartest thing would be to use so-called “daughter MIDI cards”.

In order to make such a card sound you needdo the following:
1. Apply supply voltage to it (+5 V, +12 V, -12 V);
2. Generate a "reset" signal;
3. Connect an amplifier to the outputs of the left and right channels;
4. Transmit data to control the card via a serial channel.

There were no problems with points 1-3 - a printed circuit board was manufactured, on which were installed: a “comb” for connecting the card itself, an RC chain for generating a “reset” signal, connectors for supplying
supply voltages and connecting an amplifier. To “feed”
(transfer) data to the card, one of the data lines
of the parallel port (DO) was used. The data transfer was generated programmatically.

During the test run, everything went fine - the card obediently carried out
the commands I gave, an eerie cacaphony came from the speakers (since
I was impatient to listen to my creation, I didn’t want to type
any melody. Therefore, I had to limit myself to random notes
“from the lantern”). But when I first tried to write a simple MIDI player that could play MIDI files, I ran into a problem - it wasn't fast enough. Melody stumbled, hobbled, twitched and dragged herself on
crutches. This happened due to the fact that the byte
transfer routine over the serial channel took upa certain time and the processor
had to wait until the last bit was transmitted. Only after this
processing of the MIDI file was resumed.

We had to look for ways to “unload” the processor. The best
option, in my opinion, would be to transfer the data to some kind of hardware "gadget" - in this case, the processor would only need
to throw bytes to it for sending and periodically
ask it whether the transfer has ended.

The first experiment was using the KR580BB51 microcircuit.
The experiment failed, since the data transfer speed The MIDI port
is 31.25 kBaud, and BB51 was simply unable to operate at such a speed.

The second experiment turned out to be more successful - the MIDI keyboard circuit published in the magazine "Radio" (N 11, 1993) by A. Studnev was taken as a basis. Its basis is a single-chip computer 1816BE35 + register
latch 580IR82 + ROM 573RF2. The multiplexers used to interrogate the keyboard were discarded as unnecessary. The 580IR82 register was
replaced with a much less power-hungry 1533IRZZ microcircuit. Instead of ROM
573RF2, its foreign analogue 2716 was used. Of the port 8 lines were
used for data input (DO-D7), one was used for
gating data input(Strobe) and one signaled the process of data transfer (Busy). Thus, the interface of the "Centronix" standard was obtained, albeit in a simplified form. The control program was also rewritten.

The circuit worked like a charm - MIDI files were played normally in
real time. Also for the experiment, a musical keyboard was connected and a simple sequencer program was written. But I was still
dissatisfied - the MIDI interface circuit was somewhat bulky and it was
problematic to place it in the computer case. Therefore, we had to look
for ways to minimize the device.

The solution is obvious - you need to use another mainframe computer. Fortunately, at that time
chips from Microchip and Atmel were already widely available. I chose the 20-leg Atmelov AT89S2051 chip - it had small dimensions, required almost no wiring and, most importantly, had a built-in serial port.

No sooner said than done. A schematic diagram
was quickly developed (there would be something to develop there!), and a control program was written. I
gave up the reset chain. Now the card was reset by the computer itself.
The resulting circuit composition was as follows: the AT89S2051 chip itself, a pair of 15 pF capacitors, a pair of 10 μF capacitors, a 6 MHz quartz resonator, a printed circuit board,
connectors. That's all, except for the power supply.The MIDI card used was the RT-202 type. Tests were also carried out with a Yamaha DB50XG card.
All of this was connected to a standard Centronix parallel
printer port.

That's all. With this my work was completed and was no longer resumed. I no longer needed this, my attempts to interest
people in the echo conference of the FIDO ZX.SPECTRUM network ended in nothing. Currently, I have nothing left: neither the board with the microcontroller, nor the firmware program. There is no MIDI card left either -
for music I use an IBM and a Yamaha YMF-754 sound card.

It’s a terribly disappointing fact that the idea was not supported. I’ll try to draw a line under
what I, in fact, proposed:

1. Equip Specky with a high-quality and inexpensive MIDI synthesizer
(RT-202 card or similar now costs no more than 200 rubles, chip
AT89S2051 - no more than 60 rubles);
2. Get the ability to easily transfer musical compositions from
computer to computer - a MIDI file of 30-40 kilobytes in size can
contain a piece of music of significant duration
(you don’t need to carry the instruments themselves along with the notes - in a MIDI card
they are stored in their own ROM, usually 512 KB - 4 MB);
3. Get the opportunity to enter high-qualitymusical
accompaniment in games and other programs;
4. Get a link to the standard - your musical work
can be recorded in IBM format on a floppy disk and played on professional
equipment;
5. Musicians can get an inexpensive and quite
powerful musical synthesizer with a sequencer based on Specky (a sequencer is a thing that can remember the sequence of pressing notes with the
possibility of their subsequent playback and editing. An example
of this is trackers);
6. Speaking of trackers, it will be possible to write new
music editor programs with greater capabilities.
7. Using a MIDI adapter, you can control not only a MIDI card,
but also any music synthesizer that has a MIDI input.

The list goes on, but, it seems to me, the examples given are quite sufficient. Think, decide. Is it worth giving your Specky
a “new breath” by increasing its sound capabilities? Are there any musicians left on the Spectrum who are not “stuck” enough in traditional AY to
accept the innovation? Come on, write letters, respond, all those who can REALLY get involved and be interested in my proposal! I
have accumulated a significant amount of information on MIDI, I’ll be happy to
share it!

In general, I’m waiting for yoursresponses.

Alexey BELODVORTSEV

Address for letters: Belodvortsev Alexey Nikolaevich, 400066, Volgograd-66, p.o. box 11.
e-mail: ra4...@avtlg.ru

From the editor: We would really like the readers responded to Alexey's proposal and became interested in this project. Ask all your questions to the author, he promised to answer the most interesting of them on the pages of the “Paragraph”. If our editorial office receives any letters about this, we will pass them on to Alexey. He also said that if
after this publication the people do not show their reaction and are not
interested in all this, then the project will be abandoned, and this time
forever.
=== End midi_zx.txt ===

With respect, Alexey.

PS When replying to netmail, a huge request, cut the letters to 11Kb. Otherwise
the ending will be lost. :((


From Shiru Otaku To All 24 December 2003

Greetings, Aleksey.


AT> I remember the topic of the subject was raised. It all started with the publication in Paragraph 18
of an article
AT> on this topic. But as I understand, most of the participants in the conversation did not read this
article.

I was not a participant in the conversation, but I will tell you my humble opinion. Why is it needed? :) You can make a midi player on the Spectrum (by putting together a fairly complex
circuit for connecting a midi device), but a _decent_ sequencer is not.
Speccy is not suitable for this at all. It's trivial that even the screen resolution is not enough... Even in fairly old midi sequencers it is simply impossible to work on an offtopic lower than 800x600 - all the necessary information does not fit on the screen. Its quantity can be reduced (they cram the interface of hardware sequencers into small LCD screens), but the ease of use will _significantly_ drop, to the point of complete pointlessness in using this thing. But
a sequencer program also needs to be written. Who will do this? But
there is still such a computer among the people - Atari ST, which has a built-in standard
midi interface; there are already ready-made decent midi sequencers on it. And now it costs a penny. Those musicians who are very limited in funds
(so much so that they cannot buy 486 offtopic;) have been using it
for a long time and successfully.

Shiru Otaku^IIpr


From Alexander A. Lyadenko To All 25 December 2003

/_* ready*_/

25 Dec 03 02:49, Shiru Otaku wrote to Aleksey Tarasow:
SO> a complex circuit for connecting a midi device), but a _decent_
SO> sequencer is not. Not suitable for this Speccy at all. It’s trivial
SO> even the screen resolution is not enough... Even in fairly old
SO> midi sequencers on offtopic lower than 800x600 it’s simply
SO> impossible to work - all the necessary information does not fit on the screen. Are you talking about Sonar or Cubase? Sorry, nominally forgetting the composition is enough and
Master Tracks (hmmm... well, for example 5) - that is, if you don’t do all sorts of DX/VST
creativity.

SO> the number can be reduced (they shove the interface
SO> of hardware sequencers into small LCD screens), but the ease of use
SO> will _significantly_ drop, to the point of complete pointlessness of use this
SO> matter. But you also need to write a sequencer program. Who will
SO> do this? But there is still such a computer among the people - Atari ST,
SO> which has a built-in standard midi interface; there are already
SO> ready-made decent midi sequencers on it. And now it costs a penny. Those
SO> musicians who are very limited in funds (so much so that 486
SO> offtopic are not able to buy;) have been using it for a long time and successfully.
what are you saying... go buy an Atari ST now ^_^ so I want an Atari. Where
buy it, preferably in Kyiv and preferably with delivery.
don’t talk nonsense - 486 offtopic can be bought from us for ~20 real money
and the monitor for it will cost the same amount.

. __ __| ___ __ __ ___ |_
|__)_ | ) (__| (__/_ | ' | ) (__/_ | , [80`s]

From Ilya Kudryavcev To All 3 January 2004

Greetings, dear Alexander!

Thursday December 25 2003 06:56, Alexander A. Lyadenko for some reason wrote to Shiru
Otaku:

SO>> using this case. But you also need to write a sequencer program
SO>>. Who will do this? But there is also such a computer among
SO>> people - the Atari ST, which has a built-in standard
SO>> midi interface; there are already ready-made decent
SO>> midi sequencers on it. And now it costs a penny. Those musicians who
SO>> are very limited in funds (so much so that they can’t buy 486 offtopic
SO>>;) have been using it successfully for a long time.
AL> what are you saying... go buy an Atari ST now ^_^ so I want
AL> an Atari. where to buy it, preferably in Kyiv and preferably with delivery. don't
AL> talk nonsense - 486 offtopic can be bought from us for ~20 real
AL> money and the monitor for it will cost the same.

I have a working Atari-1040ST in stock. Izhevsk...

Sincerely, HIMIK'S ZxZ/PoS-WT.