Sound Engine & Midi Music player for the MTX

Everything about programming, including VDP and Sound programming.
Potholepete
Posts: 85
Joined: 11 Aug 2012 22:13

Re: Sound Engine & Midi Music player for the MTX

Post by Potholepete »

A good project for you then Stephen ;-) to create a midi interface for the MTX that can either use the default sound capabilities of the MTX or use ES? Am guessing you would need the older din style midi connector rather than the usb of these days but it would make for an interesting project for someone interested and with the skills to do it :-)

As Bill says though its not what I am looking for on this occasion, I am thinking that if midi tracks can be read in and sent to ES to play then it means a lot of people who might be put off creating chiptune music because most use trackers and not DAWs may still be able to create something usable. Even if they cannot use in their program of choice the capabilities that ES offers if needed that can be added later one once a good tune has been created.

Al interesting stuff though, I had never even thought at all of being able to connect a midi keyboard direct to the MTX dart setup :-)
Potholepete
Posts: 85
Joined: 11 Aug 2012 22:13

Re: Sound Engine & Midi Music player for the MTX

Post by Potholepete »

Has anyone got any suitable 3/4 channel midi tracks that are chiptune in style that can be used to test with? I will have a google but if anyone has some they already did and was happy to send one over to play with then please let me know :-)
Martin A
Posts: 825
Joined: 09 Nov 2013 21:03

Re: Sound Engine & Midi Music player for the MTX

Post by Martin A »

Wiki says .. https://en.wikipedia.org/wiki/MIDI that the Midi data rate is 31.25khz.

That's 1MHz divided by 32, or 4MHz divided by 128.

On the MTX the serial clock for the DART is generated by the CTC in counter mode.

If the CTC were fed with 4MHz then 31250 baud could be done. But it's not the CTC is counting the 4MHz/13 clock and pre-scaler 16 is the shortest available, so 19230 baud is the maximum rate in that configuration.

So looks like a new board would be needed.




PS Not it!
Bill B
Posts: 618
Joined: 26 Jan 2014 16:31

Re: Sound Engine & Midi Music player for the MTX

Post by Bill B »

Use the CTC in Timer mode, not Counter mode. It then uses the 4MHz system clock. A divide by 16 pre-scaler and a count of 8 will give a 31.25khz output.

The DART will have to be operated in x1 clock mode. To operate the DART in x16 clock mode would require a 4MHz/8 data clock, which the CTC cannot do.
stephen_usher
Posts: 328
Joined: 27 Nov 2016 19:58

Re: Sound Engine & Midi Music player for the MTX

Post by stephen_usher »

Bill B wrote: 04 Jul 2023 09:02
stephen_usher wrote: 03 Jul 2023 20:22 Can't the Z80 DART on the serial board be persuaded to talk MIDI? If so then the Memotech could act as a MIDI instrument and record the data coming in.
I believe that the usual voltages for MIDI are incompatible with RS232, so at least some level converters would be needed. However this is probably a common problem so such converters should exist.

However the current requirement is to embed tunes into games. For that, what is required is some way of converting MIDI data into Z80 code / data which can be included in the game code.
There is an inexpensive RS232-MIDI interface available which will talk at 19200 baud: https://www.serdashop.com/MPU-232

It may be a useful method of reading in the MIDI data as MIDI sequencers will all hold the data in different formats. Maybe write a program which pretends to be an instrument and then read the data from the MIDI interface as a sequencer plays it, writing the data into a free RAM bank which can then be saved as a binary file on "disk". A game could then read this into the memory location that the player can access.
stephen_usher
Posts: 328
Joined: 27 Nov 2016 19:58

Re: Sound Engine & Midi Music player for the MTX

Post by stephen_usher »

Bill B wrote: 05 Jul 2023 08:33 Use the CTC in Timer mode, not Counter mode. It then uses the 4MHz system clock. A divide by 16 pre-scaler and a count of 8 will give a 31.25khz output.

The DART will have to be operated in x1 clock mode. To operate the DART in x16 clock mode would require a 4MHz/8 data clock, which the CTC cannot do.
Oh dear, so low speeds only and probably not synchronous mode available either.
Potholepete
Posts: 85
Joined: 11 Aug 2012 22:13

Re: Sound Engine & Midi Music player for the MTX

Post by Potholepete »

Some good progress has been made with this and I have posted a short video on the FB group with the results of a test conversion. Plenty left to resolve but its getting there thanks to Bill.
stephen_usher
Posts: 328
Joined: 27 Nov 2016 19:58

Re: Sound Engine & Midi Music player for the MTX

Post by stephen_usher »

I saw that, great progress.
Potholepete
Posts: 85
Joined: 11 Aug 2012 22:13

Re: Sound Engine & Midi Music player for the MTX

Post by Potholepete »

Thanks, but its Bill that deserves the praise as its all his work :-) now I just need some more midi files that I can test it with. Using the many I can find online is often more work that its worth as you have to remove tracks and make sure only 1 instrument is used per track before it can be converted. Still all of these things can be overcome and after a few false starts it was great to be able to recognise the tune the MTX was playing :-)
Post Reply