[Coco] SSC & MIDI

jmlaw at iprimus.com.au jmlaw at iprimus.com.au
Sat Jun 21 22:32:14 EDT 2014


As the SSC & MIDI topic has come up, I’ve posted some info on my current 
project at the facebook group.

The background is I’m trying to do a 60 fps 1 & 2 pixel horizontal scrolling 
Super Mario Bros demo (may lead to more later). My focus isn't so much on 
cloning it as I am wanting to learn about game programming, and it's a great 
case study for that with lots of info online. That said, I do intend to try 
to make it as accurate as I can. With the tile updating, managing four 
pages, software sound just wasn’t going to be enough to keep the frame rate 
up, so I’ve had to consider some alternatives. Namely the SSC & DriveWire 4 
MIDI.

Now that you’re moving to tiles Nick, maybe something to consider if you 
haven’t already?

So here’s a copy of that for anyone not in the group who may find it 
useful/interesting or whatever. Maybe it'll come up in someone's Google list 
search some day...

***********

I've been working with the Speech & Sound Cart for the Mario demo background 
music (BGM). Studying everything I could find on Nintendo Entertainment 
System (NES) music has taught me heaps about how to apply software envelopes 
to the SSC generated tones to get a near-perfect NES sound. Though using 
software envelopes you could probably emulate the sounds of many other 
systems too.

Not everyone has a SSC so I've also spent some time studying Aaron Wolf's 
DriveWire 4 MIDI. I moused a short score of the Overworld theme BGM in 
Robert Gault's modified version of Lyra and via Vcc 1.43b (Becker port) and 
with the aid of the DriveWire spec, I've learned enough to have it sounding 
the notes from my own code, but the timing was off. Knowing I'd have to 
write the code to play the BGM which controls the timing by frame (vsync 
interrupt) I figured I'll do the SSC first then work out the timing for 
DriveWire MIDI in relation to that. DriveWire MIDI via the Becker Port and 
the SSC work in a very similar way so it's ideal. I wasn't going to mention 
this yet until I'd done it all, but it's come up on the mailing list, so I 
may as well

A few hiccups:

The SSC requires a delay before sending a command after a reset or it will 
be ignored. Unless I missed this, it's not documented anywhere. From my 
tests, testing the status doesn't work in the usual way after you first 
reset the SSC. I've narrowed it down to 285 cycles after a reset before the 
SSC is actually ready for commands. 284 cycles you just get allophones for 
the tone data sent as it ignores the direct access to the AY-3-8913 command. 
My SSC model is the 26-3144A. I've sent Simon my test binary for the delay, 
he has the other model and it still works with a 284 cycle delay so it may 
be there's a ROM difference between the models?? A simple delay loop after a 
reset fixes this problem. I've extended the delay above 285 cycles just to 
be sure.

I also had trouble opening the DW4 MIDI channel. I was using the quick 
version of the command, but could not get it to work after four nights of 
trying. Maybe I misinterpreted the spec, but the longer open channel command 
worked perfectly first go. What a relief

I have the main melody square 2 (SQ2) channel playing from my own code to 
the SSC, I have one more thing to fix then it's add the harmony (SQ1), the 
baseline (TRI) and percussion noise (NOI) channels. A few things to work out 
but should hopefully have a sample wav, a few more pics & a vid soon.

In the waveform pic, the top channel is the SQ2 NES, the lower the SSC. This 
was just my first test. The background noise is greatly exaggerated as I 
maximized the volume in the SSC recording to compare it to the NES recording 
in Audacity (I have to adjust my envelopes). The VU meter in the Mario pic 
is working for the SQ2 channel, the others are just displaying test values 
until I write the code to play those. They all update per frame and work in 
MESS & Vcc too, which is great considering the timing required to run them, 
thought I'd have issues with that.

Ah and playback at 0.89 MHz as I haven't modified my SSC for the CoCo 3 when 
run at 1.78 MHz yet, so you can play the BGM on a CoCo 2 also. A 
semi-graphics VU meter of a similar style would be fairly simple in 
comparison.

So yeah, that's what I've been up to since the Mario scrolling vid, (link in 
the comments of post with the level editor if you missed it).

***************

I'm not claiming to be an expert on any of this by any means, I'm just 
learning it myself and sharing what I've leaned to date. If I'm wrong feel 
on any of it feel free to set me straight :) This is just my experience. 
Bill Pierce is far more knowledgeable on MIDI than I am, I'm just having a 
go.

Thanks heaps Aaron for the DW4 and the MIDI and the Vcc Becker port, it 
opens up some really nice options for game background music, maybe even the 
sound effects, not sure haven't got that far yet. I'm a bit worried there 
may be some noticeable lag re the latter but lets see...

Thanks RG for the Lyra DW4 MIDI mod, helped a lot initially.

Thanks Bill Pierce for the music/MIDI info on your site, first place I 
started when looking into this :)

Peace :) 



More information about the Coco mailing list