VOGONS


First post, by baku-chan

User metadata
Rank Newbie
Rank
Newbie

I mean, seriously... alright, not really quite that seriously. But it's something that's always nagged at me upon falling into the XG MIDI rabbit hole and then hearing about how the Dreamcast apparently has XG MIDI support and how that's so awesome, right? Gushing over SEGA sound hardware has always been something of a trend, really, and there's nothing necessarily wrong with that because, really, most of it actually is pretty damn awesome. With that said, exaggerations do exist, which often get in the way of determining what these sound chips are truly capable of, whether that be for better or for worse. And, more to the point here: I have yet to find any actual documentation about how XG MIDI support works on the Dreamcast, or indeed any confirmation that it ever did support XG MIDI in the first place besides secondary sources such as Sega Retro and the like (versus, say, SEGA or Yamaha themselves).

According to everything that I've heard from those familiar with Dreamcast hardware — think emulator developers specifically — its AICA sound chip is architecturally almost identical to its predecessor in the Saturn called the SCSP. The former is basically a direct hardware superset of the latter; as in, fundamentals like the ADSR envelope engine and the DSP are all but the same between the two (to the point where code is often shared between SCSP and AICA emulators, such as with the Highly Theoretical plug-in for foobar2000). As to how that's relevant to the subject at hand, the SCSP — which, again, AICA is in all likelihood a direct hardware superset of — was finalized in late 1993 if available SEGA documents are to be believed. Whereas the first commercial XG product from Yamaha was the MU80, and that was released in 1994. Which means that — unless Yamaha designed the SCSP with the then-nascent XG specification in mind and then proceeded to tell no one about it — one can't help but beg the question: if AICA is architecturally an SCSP, then how, exactly, can AICA be compatible with XG? I mean, it's not as if one can reasonably say that Yamaha was lying about the Dreamcast having XG support (again, if they did in fact ever say that) or anything like that, but... just how!? Is there something that I'm missing here? It's just that I'd imagine that the inner playback engines of the SCSP — and thus by extension AICA — would be completely different from whatever solution Yamaha used for their XG hardware given how they were almost certainly developed independently, and in that case, well...

Meanwhile, there's also the matter how XG — in most of the ways that it was used by Yamaha, at least — is rather fundamentally different from how video game consoles of the 32-bit era handled their synthesized music. Especially given the latter's memory constraints stemming from the fact that their budgets for things like sound are much, much smaller than those of multi-hundred dollar XG sound modules that probably cost more than an entire PS1 or Saturn alone. To the point: said sound modules were ROMplers, with the highest-end examples of them consisting of the MU2000EX with its 20 MiB of sample ROM. Video game consoles, meanwhile, again didn't have the luxury of such space with 90s-era memory prices and consumer-level price targets, and as such the sound hardware of consoles from that era — or rather the PS1 and the Saturn specifically; we don't speak of what the N64 did, oof — instead used a relatively tiny 512 KiB of dedicated RAM, not ROM, to store samples in (or the rough equivalent of 1820 KiB in uncompressed terms if you were fortunate enough to be working with the PS1's SPU with its 32:9 hardware ADPCM compression that the Saturn's SCSP lacked, but I digress). They were essentially what you could call RAMplers, with developers being prompted to basically "bring your own samples" (BYOS) rather than rely on a fixed, pre-determined pool of them supplied by Sony or Yamaha or whoever. Now, there was of course the CD-ROM medium used by the PS1 and Saturn that could hold much more than 512 KiB or even 20 MiB. But then constantly accessing the disc drive isn't practical for a game console because you would wear the hell out of said drive by doing that and developers had to prioritize streaming other things from disc over something as relatively trivial as samples in any case (like voice acting streams, game assets, and such). Plus, you still only had 512 KiB of sound RAM even with an entire CD-ROM available to you, which means that the sound chip still can't actually play more than 512 KiB of samples at any given time and you would have to constantly swap from disc — and thus also constantly delete samples from RAM, so hopefully you weren't planning to use them or anything! — if you wanted more. All in all, then, it's hard for me to see how XG as Yamaha liked to use it back then — again, with relatively expensive, professional-grade sound modules — is really compatible with how video game sound chips of that era worked, with those tiny amounts of memory available to them. Now, our subject at hand — the Dreamcast's AICA — does happen to have 2 MiB of sound RAM available to it in a four-fold increase over its SCSP predecessor (or sixteen-fold if you count the 4:1 hardware ADPCM compression that increases the effective sound RAM to 8 MiB in uncompressed terms). But even the S-YXG50 softsynth relies on 4 MiB of sample ROM, let alone the aforementioned MU2000EX with its 20 MiB of sample ROM which the Dreamcast, for all of its significant improvements in the sound memory department versus the Saturn, still doesn't come anywhere close to reaching.

Speaking of things like the S-XYG50 and the MU2000EX, there's also the issue of exactly what level of XG AICA is capable of representing, even before we get to the issue of things like memory constraints as discussed above. For the uninitiated, the S-YXG50 from everything that I've heard seems to be roughly equivalent on paper to a MU50 with fewer effects, or in practice arguably close-sounding to a MU80 with less polyphony and also fewer effects. Meanwhile, the AICA with its 64 hardware channels would seem — on paper, anyway — to be comfortable with the polyphony requirements of something like a MU100 (32 parts, 64 hardware voices). And assuming that the DSP is indeed identical to that of its predecessor in the Saturn which itself is a programmable 128-step DSP that runs "mini-programs" which individually enable things like reverb, chorus, EQ, and the like, it doesn't seem unreasonable that AICA could run the equivalent of at least a reverb and chorus buss on there, if not much more. Especially given how, according to certain SEGA documents outlining the default effects of the DSP on the Saturn's SCSP, "Reverb" takes up 34 steps and 30 KiB of sound RAM while "Chorus" takes up 22 steps and 2 KiB of sound RAM. Assuming that the DSP works the way that I think it does and you can run any combination of DSP effects you want as long as you don't exceed 128 steps, whatever available sound RAM you happen to have, or the 16-channel limit of the DSP's I/O, that leaves 72 steps and 480 KiB of sound RAM available to you on SCSP (and way more than that on AICA with its 2 MiB of sound RAM, to the point where it's almost not even worth considering DSP RAM usage there). As for some of the other DSP effects available, according to those same documents? "Early Reflection" (100 steps and 26 KiB), "Echo/Delay" (20 steps and 52 KiB), "Flanger" (20 steps and 4 KiB) and others, albeit in not nearly as great of a quantity as something like a MU50. Unless SEGA documents simply don't go into it — hardly farfetched given that this is SEGA in the 90s we're talking about here; their reputation for crappy documentation was nothing short of legendary during that time — it seems that the DSP only has one reverb effect and one chorus effect, versus literally over a dozen of both on the aforementioned MU50; to say nothing of later, more advanced XG modules.

Given all of the above, then, there are really only two scenarios that I can imagine XG MIDI working in any meaningful way on the Dreamcast. One such scenario would be if there's some kind of program running on the Dreamcast — perhaps provided to developers in the official Dreamcast SDK — that translates XG commands to AICA-compatible ones in real-time, thus compensating for the vast fundamental differences between the two. Such a scenario doesn't explain how the latter's memory constraints are dealt with, however (unless everything is stored in the Dreamcast's 16 MiB of main RAM... somehow). Meanwhile, the other — and more likely scenario, in my opinion — is that XG MIDI support on the Dreamcast is actually entirely done on the CPU — as in, not the ARM CPU that runs AICA, but rather the main SH4 CPU — in a similar manner as Yamaha's softsynths of the late 90s (including, indeed, the aforementioned S-YXG50). I'm not too sure about how well the Dreamcast's CPU would be able to handle that — let alone while also running game code — although given that an average PC in 1997 when the Dreamcast's hardware was finalized was probably running around 200MHz-ish Pentiums, perhaps it's not entirely farfetched after all. With that said, I'd imagine that the resulting sound capabilities would be quite a bit below what you could do by just using the AICA sound chip natively; as in, if you were to create a plain SMF MIDI sequence, sample bank, and instrument definition file for it using SEGA's bespoke tools and file formats (dedicated sound chips in hardware were a thing back then for a reason, after all). That is, unless such a software solution is actually more clever than I think it is and actually does take advantage of AICA's hardware capabilities somehow (such as, the actual sound generation is handled by the main SH4 CPU, but AICA is used to apply DSP effects to the final mix, or to a certain number of voices that are mixed into a single sound and then sent to AICA for further processing on the DSP, à la insertion effects on a higher-end XG implementation).

Anyone have any insights or thoughts about any of this? Thank you in advance for any answers!

Last edited by baku-chan on 2024-05-03, 23:02. Edited 1 time in total.

Reply 1 of 6, by BloodyCactus

User metadata
Rank Oldbie
Rank
Oldbie

Ive never heard it supporting XG. AICA is attached to the DC's serial port for midi, so you can connect it to an external synth. AICA is just an ARM cpu with 2mb ram, there is no rompler samples in the DC, but I imagine someone could upload samples and a write midi layer into the aica code space.

--/\-[ Stu : Bloody Cactus :: [ https://bloodycactus.com :: http://kråketær.com ]-/\--

Reply 2 of 6, by baku-chan

User metadata
Rank Newbie
Rank
Newbie
BloodyCactus wrote on 2024-05-03, 17:48:

Ive never heard it supporting XG. AICA is attached to the DC's serial port for midi, so you can connect it to an external synth. AICA is just an ARM cpu with 2mb ram, there is no rompler samples in the DC, but I imagine someone could upload samples and a write midi layer into the aica code space.

Such a MIDI layer would presumably just run standard SMF files, then? Wouldn't that be something! Going back to the subject at hand, though, this whole thing actually ended up being kind of a stream-of-consciousness on my part while I was working out in my head the increasing unlikelihood that XG could ever be a thing on Dreamcast. My hypothesis was basically "no, that makes no sense at all!" and I went from there, as you can see from that wall of text I wrote. Again, as you say, AICA isn't a ROMpler, and the closest thing that you could get to that on Dreamcast is probably by using a softsynth on the main CPU (which would probably made it around S-YXG50 level, and thus by extension either MU50 or MU80 level, excluding the obvious memory constraint problems). Unless, again, there was some seriously bespoke work done by Yamaha to get XG working on a Dreamcast that we don't know about...

Reply 3 of 6, by SuperDeadite

User metadata
Rank Member
Rank
Member

Both the Dreamcast and Saturn did have official MIDI cables released, but only used by the piano teaching games to connect a keyboard controller. Iirc the game software uploads samples to the console's memory. It wouldn't surprise me if samples were licensed from Yamaha.

Modules: CM-64, CM-500, SC-55MkII, SC-88 Pro, SY22, TG100, MU2000EX, PLG100-SG, PLG150-DR, PLG150-AN, SG01k, NS5R, GZ-50M, SN-U110-07, SN-U110-10, Pocket Studio 5, DreamBlaster S2, X2, McFly, E-Wave, QWave, CrystalBlaster C2, Yucatan FX, BeepBlaster

Reply 4 of 6, by GrizzlyAdams

User metadata
Rank Newbie
Rank
Newbie

As someone who has touched the hardware and both the official and homebrew SDKs, I can offer some tidbits here. Mind you this is largely from memory and I've not touched DCDev in close to 20 years at this point.

ACIA does not have any access to the SCIF (serial port). The SCIF is an in-chip peripheral of the SH4 main cpu. ACIA sits on the G2 bus along with the expansion port used for the modem. There is DMA between the SH4 and ACIA, but the SH4 is in control of that channel, not the ACIA.

The official SDKs include a few ACIA firmware images that do things like streaming audio, but also MIDI with soundfonts.
There are tools to help composers make sure their tracks will not exceed the CPU capability of the ACIA with a profiler that calculates expected CPU usage, and to c0nvert & compress DLS packs with ADPCM.

LibDream / KOS have their own firmware images for the ACIA. There are MOD / S3M players that run on the ACIA included in various homebrew demos for the dreamcast. That should give you a clue at what you can actually do with a 25MHz ARM7TMDI. Once the music file is copied over and the firmware kicked off, the ACIA handles playback without further input from the SH4.

The ACIA has 64-voice PCM hardware mixing with loop and envelopes, optional low pass filter, and floating point playback frequency. Each channel has 128 register addresses reserved, not all of them actually do something. Those registers are accessible from both the ARM7 and the SH4. Unless you *really* were doing something out there with audio, typically the ACIA will handle music playback and effects scheduling and you would send commands via FIFO for it to kick or stop a channel.

And in case you don't think a 25MHz ARM7TDMI is fast enough to do anything interesting, the Nintendo DS has an ARM7TDMI at 33MHz, and Maxmod (homebrew audio lib for the nds) does 32 channel software mixing. The ACIA in the dreamcast has hardware mixing & playback engines.

Reply 5 of 6, by leileilol

User metadata
Rank l33t++
Rank
l33t++

The most MIDI's anyone ever heard out of a Dreamcast had been through that synth coming with the web browsers like Planetweb, which had a limited patch set and sounded rather basic. Wouldn't be surprised if audio capabilities were exaggerated as much as what CLX2 gets all the time though, so much cope with that thing.

apsosig.png
long live PCem

Reply 6 of 6, by GrizzlyAdams

User metadata
Rank Newbie
Rank
Newbie

Looking through the documentation again, the later audio driver (ACIA firmware) that was recommended as part of the last SDK release supports 128 tone banks, and 48 note polyphony. XG level 1 fits within the capabilities of the libraries provided by SEGA. Not sure what the WindowsCE SDK provided exactly for audio support, but it was probably some subset of DirectMusic / InteractiveMusic between DirectX 6.1 and 7.