Programming a native Sega Genesis tracker.

For anything related to sound (YM2612, PSG, Z80, PCM...)

Moderator: BigEvilCorporation

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sun Nov 18, 2012 3:48 am

powerofrecall wrote:I don't know what the raw bandwidth requirement for midi is in bps--or even if it's constant--but I imagine if the serial port can't meet that demand, it must be a damn slow serial port! I'm just spitballing but since midi itself is just serial I'd have a hard time imagining a one (midi) channel keyboard input having large bandwidth requirements. What if you limited it purely to one channel, receive only, and didn't support any kind of SysEx to or from the genesis? Just a simple way to hook up one midi device, no daisy chaining.

edit: just offhand what kind of bitrate could someone achieve on that serial port?
The Genesis IO controller tops out at 4800 baud. MIDI is 31.25 kBaud. So using the serial is out. As I mentioned, you need to use parallel out, and convert it to/from serial on the adapter.

powerofrecall
Very interested
Posts: 237
Joined: Fri Apr 17, 2009 7:35 pm
Location: USA

Post by powerofrecall » Sun Nov 18, 2012 3:55 am

Oh wow never mind then. Had no idea it was literally too slow by orders of magnitude!

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sun Nov 18, 2012 4:41 am

powerofrecall wrote:Oh wow never mind then. Had no idea it was literally too slow by orders of magnitude!
Well, remember when the Genesis came out - 4800 baud was pretty fast for a console... in fact, it's surprising they even supported serial on the controller ports.

Count SymphoniC
Very interested
Posts: 149
Joined: Sat Nov 17, 2012 3:58 am

Post by Count SymphoniC » Sun Nov 18, 2012 6:10 am

Just as an FYI.

A MIDI interface has already been successfully been created for use with the Genesis. Google GenMDM. It was made by someone with the screen name little-scale, more info can be found on chipmusic.org... This is also where I started a thread to gauge demand for a native tracker for the Genesis.

I love LSDJ, speaking of which! More than likely, the UI is going to be heavily based on LSDJ. It's very efficient, especially considering that's it was pulled off using d-pad, buttons A, B, Start, and Select.

So I guess that using Echo wouldn't work all that well for this particular project? Meaning I would have to do all of that by scratch? Well... gulp. If anyone has any tips on getting started, most particularly with the sound engine, then by all means, I welcome your feedback. As long as I have a general idea of what I'm supposed to be doing, I can break the project down into bite sized "mini projects", and take it on that way.

I also read that using Linux would be better for developing for other platforms, whether this is true or not in the case of the Genesis doesn't matter much, I'm probably going to use Kubuntu... was going for Xubuntu, but I changed my mind.

I'm thinking I'm going to have to code this tracker in both C and Assembly. Is this ideal?

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sun Nov 18, 2012 6:02 pm

Look over Echo before you decide... see what it gives versus what you need.

Kubuntu is fine... while I don't use KDE, many people like it. The main point is the underlying linux base, which helps with cross-development. If you were going to stick to Windows, we'd probably try to talk you into at least trying linux in a VM.

As for controls, you might consider six button pads, and perhap even requiring more than one pad. Perhaps maybe a mouse as the second controller? The MegaMouse is pretty easy to get, and fairly cheap, so requiring a mouse really shouldn't be a big deal.

TmEE co.(TM)
Very interested
Posts: 2443
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Sun Nov 18, 2012 6:30 pm

Echo is not really suited for some realtime work
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Count SymphoniC
Very interested
Posts: 149
Joined: Sat Nov 17, 2012 3:58 am

Post by Count SymphoniC » Mon Nov 19, 2012 12:27 am

What about Echo, makes it less of a candidate for realtime use??? Are you saying I'm better off doing my own sound engine from scratch? Well I was originally expecting doing it this way anyways, so I'm not too bummed about it.

My question now is... with our current Sega Genesis Development resources, is it feasible to program the tracker in pure C, including sound engine? I'm willing to take a guess... NO.

I'm thinking I'm going to have to dive into some books and online info on 68000 and/or Z80 assembly. Anyone have any good recommendations? :)
Thanks guys for your input, I really appreciate it.

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Mon Nov 19, 2012 12:32 am

Echo, in its current state, is for playing back already-made music files. Loads a buffer of data and plays it. It hasn't been made with the idea of playing individual notes at any time like an editor would require.

But Sik and Oerg can talk about more of it's suitability for something like what you're trying to do.

Mask of Destiny
Very interested
Posts: 624
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Mon Nov 19, 2012 4:49 am

Count SymphoniC wrote: My question now is... with our current Sega Genesis Development resources, is it feasible to program the tracker in pure C, including sound engine? I'm willing to take a guess... NO.
Depends. If you don't wont to support sample playback (PCM), I think C will work fine. You can just base the timing off of VINTs or polling the YM2612 timers. Sample playback generally requires cycle counting though. The Genesis doesn't have a proper PCM chip, just a simple DAC that replaces FM channel 6 (or is it 3? I don't remember off the top of my head). So you have to time your writes properly to control the sample rate.

Count SymphoniC
Very interested
Posts: 149
Joined: Sat Nov 17, 2012 3:58 am

Post by Count SymphoniC » Mon Nov 19, 2012 5:32 am

Mask of Destiny wrote:
Count SymphoniC wrote: My question now is... with our current Sega Genesis Development resources, is it feasible to program the tracker in pure C, including sound engine? I'm willing to take a guess... NO.
Depends. If you don't wont to support sample playback (PCM), I think C will work fine. You can just base the timing off of VINTs or polling the YM2612 timers. Sample playback generally requires cycle counting though. The Genesis doesn't have a proper PCM chip, just a simple DAC that replaces FM channel 6 (or is it 3? I don't remember off the top of my head). So you have to time your writes properly to control the sample rate.
In that case, I should be able to code this mostly in C then... and do partial asm to take care of the rest what C can't.

Then again, it's also possible to modify Echo for usage with a tracker. Something to maybe look into, why work harder when you can work smarter?

kubilus1
Very interested
Posts: 237
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Sun Jul 21, 2013 3:26 pm

I wrote some sound driver stuff in C on the Z80 processor, including 8khz sample playback using SDCC. Lots of cycle counting required, but it is possible to do this in C. (I did go back and change parts into inline assembler, however)

The Genesis is going to give you two processors you can program, but since your stuff is a pure sequencer, unless you are planning to do a bunch of graphical effects, just programming the 68000 would be the way to go. Having 16bits to work with is far more straightforward and faster than the 8bit Z80. Plus the added Hz should give some more headroom.

Since you will likely want to intersperse samples with chip music, your code will likely have to switch between playing the other sound channels and the samples, even mid sample. Also, don't forget the PSG can be used as a DAC as well.

If it was me, I would do a straight C implementation to get all the logic correct and then go back and turn it into assembly as necessary.

MintyTheCat
Very interested
Posts: 484
Joined: Sat Mar 05, 2011 11:11 pm
Location: Berlin, Germany

Post by MintyTheCat » Wed Aug 13, 2014 2:49 pm

powerofrecall wrote:The absolute dream genesis tracker would be something that ran on the hardware, could work with and SD card, read and write, plus maybe some kind of midi adapter (that serial port on the back of the model 1?) for a keyboard or other midi input device.
Well, as it happens UMDK has an SD Card Reader built in.

It also has USB so you can transfer data back and forth quickly over USB.

Any of the MD's Ports could be configured for RS232 mode and then used to send MIDI Messages from the PC to the MD.

We are taking orders :D
UMDK Fanboy

MintyTheCat
Very interested
Posts: 484
Joined: Sat Mar 05, 2011 11:11 pm
Location: Berlin, Germany

Post by MintyTheCat » Wed Aug 13, 2014 3:03 pm

I was discussing some matters with Kaneda today and he told me about MVS Tracker MD.

I was looking for something akin to what Count Symphonic describes: a Tracker that runs on the actual Hardware.

But I also want it to accept MIDI Messages over either RS232, an intermediate processor connected to the MD's Ports or to use UMDK's USB to overcome the speed limitations.

How did this work progress?

I wonder also if anyone know of a MIDI Sniffer program that I could use or look at? I can easily use my Bus-Pirate and Logic-Analyser to watch the traffic but it would be nice to be able to have something that can interpret MIDI Messages.

GENMDM is a no go considering that Little-Scale is not keen on selling them to people.

I am looking at having an Open-Source solution as outcome too.

Any ideas?

Cheers,

Minty.
UMDK Fanboy

Qjimbo
Newbie
Posts: 4
Joined: Wed Jan 17, 2007 11:36 pm

Post by Qjimbo » Fri Aug 22, 2014 11:46 pm

A random idea I thought of that might work is using a Gameboy Nanoloop USB MIDI adapter and wiring it to a controller plug, and then software on the MD that could parse this data, the same way mGB does. Mainly because this is a very cheap adapter designed for a similar purpose.

No idea how feasible that would actually be though - this device must reduce the baudrate of the midi data but I have no idea to what speed.

MintyTheCat
Very interested
Posts: 484
Joined: Sat Mar 05, 2011 11:11 pm
Location: Berlin, Germany

Post by MintyTheCat » Sun Aug 24, 2014 9:34 am

Qjimbo wrote:A random idea I thought of that might work is using a Gameboy Nanoloop USB MIDI adapter and wiring it to a controller plug, and then software on the MD that could parse this data, the same way mGB does. Mainly because this is a very cheap adapter designed for a similar purpose.

No idea how feasible that would actually be though - this device must reduce the baudrate of the midi data but I have no idea to what speed.
That is an idea! But mostly I had not heard of any sourcecode to look at.

Essentially, for us MIDI can happen over RS232 or using UMDK and the USB getting data into ROM using the FPGA-Links connection between the PC and the MD.

As such, one can use either a straight USB to RS232 converter or have a small microcontroller sitting on the Gameport handling the feeding of the MIDI interpretation software running on the MD.

There is an upper speed limit due to the MD's Baudrate 9600 bps (correct, I would have to look it up, I actually only use 1200 for my Command-Monitor).

However, using UMDK there would be essentially no limit.

What then follows is to have the MIDI parameters mapped accordingly to the PSG and the 2612.

I was going to open up a request in the Collaboration section once I have worked with the chaps on getting UMDK Kits manufactured.
UMDK Fanboy

Post Reply