[Homebrew Topic] Sound drivers that only use DAC and PWM for audio, do they exist?

Discussion in 'Discussion and Q&A Archive' started by Royameadow, Jul 23, 2016.

  1. Royameadow

    Royameadow Welcome to the modern existence. Member

    Feb 21, 2012
    Lynn MA, North America
    This is a subject that has stuck with me since Summer of 2008, and especially in recent time, now with the rise of Megadrive sound drivers such as MegaPCM and JST: Jester Stream Technology, which make ample use of the DAC for music in ROM hacks and Homebrew works alike, taking the current scene by storm.
    I have always promised myself that if I were to ever work on a Super 032X Homebrew title, as well as any ROM hacks and ports on the console, I wanted to make it so that all of the audio would run solely on the DAC and PWM channels, leaving the YM2612 and PSG open to do other things or not be used at all, more or less for increasing the overall quality of the audio's presentation, which I am sure that some have also wanted to do as well, over the years.

    Given that said, the title question comes into play: Has anybody created or intended at some point to work on a sound driver that strictly only uses the DAC and PWM channels for playing audio for both sound effects and background music?
    I feel that something such as this would help optimize how we hear sound on the console, as well as make more titles with original music and sound effects that do not need to use the YM2612 and PSG at any point; as a composer and remixer myself, I have simply felt that Sampling is an easier method in its own right and that also goes for the DAC and PWM, it wouldn't force us to feel as limited in the audio department and might make for clearer listening benefits in the long run, at least that's how I've viewed it since 2008.
  2. ArcaniaCQ

    ArcaniaCQ Well-Known Member Member

    Jul 18, 2015
    So yea I would suggest that we are not talking about JST. But MegaPcm is not perfectly working on hardware for some hacks. They usually sound distorted or just broken. For example Sonic 1 Boom. (VAdaPEGA's hack) shows exactly that with it's voice lines. Even CrazySonic's music sounds wierd.
  3. vladikcomper

    vladikcomper Well-Known Member Member

    Dec 2, 2009
    I personally don't think a sound system to make use of DAC and/or PWM only would be a good idea. The 4 PMW channels, as you know, is the 32X hardware feature, so this leaves a single DAC channel as the only option for the Mega-Drive. Also, from what I've heard from Varion (who, as you may know, specializes in 32X development now), you practically cannot use the YM2612's DAC channel on the 32X, since the Z80 cannot read ROM anymore, the SH2 is too busy with sprite rendering and PWM playback (I'm also unsure if it can access the YM) and the M68K is used for game logics.

    Eventually, we end up with a sound driver that can play only one sound at a time on the Mega-Drive (through the only DAC channel) or 4 sounds at a time on the 32X (through 4 PWM channels). Of course, with this approach we may focus on DAC or PWM playback entirely: get playback quality as good as possible, add a few nifty effects or even filters... But how far can we get with this few channels?
    To me, it's like saying "let's make a Mega-Drive platformer that uses only one scroll layer", so you'll have just the Sprites and the FG. Of course, you can make the FG it as colorful as possible, spend a whole lot of tiles on it, add various awesome deformation effects. And this may do it for a level or two... but not for an entire game.

    I see no reason to intentionally limit yourself and focus just on a tiny part of the sound power the console provides. In many cases, it's simply not worth it. As in many cases, you just can't use use this tiny part of capabilities to an extent, where it may compete with using the whole thing, but in a more dispersed manner.

    ... unless you're insane or a genius (which usually is the same thing). To be absolutely fair, there are a few examples where this rule doesn't work. But these are rare exceptions. The Adventures of Batman & Robin, for one, had a fairly limited sound driver; it didn't support DAC or PSG, it couldn't even pause the music. It focused on FM-synthesis primarily, taking advantage of the YM2612 hardware modulation capabilities (something that many other drivers ignored). And this game's music considered one of the most impressive sounding on the Mega-Drive, while it practically used about half the sound power. Yet, you're tempted to use even less...

    P.S.: Before anyone mentions; yes, it's possible to build a DAC driver to play 2 or even more sounds simultaneously via software mixing. I didn't highlight it as it wasn't my message's main focus. Moreover, the sacrafices are huge, and I mean really huge, including playback quality, sample length and size, banking and more. And I know what I'm talking about, since I myself wrote a several sound drivers with channel mixing.
    Devon, ArcaniaCQ, Crimson Neo and 5 others like this.

    AURORA☆FIELDS so uh yes Exiled

    Oct 7, 2011
    Ok, based on this post, Roya, I conclude you are a troll, and are intentionally making cringy and horribly uneducated posts. There is no way during these 8 years you did not do any research, and realize how hard it actually is to get good DAC working, let alone for both music and SFX! Its no feasible, even if you eliminate 100% of DMA's, optimize a lot of code, and do some black magic while you are at it. At all. Give up before you try. It either sounds utter garbage, or you at best get 1 SFX and 1 music, they sound ok, and you spend 90% of the ROM space for it. Was it worth it? Fuck no. You could have used that effort to something better, like creating a very cool and interesting FM+PSG driver, with good-ish DAC capabilities, then mix FM and PSG with DAC, to make introcate and interesting sounding music. Kinda like what Sonic 3 did. This way you save ROM space, your brains, and ultimately make massively better music still.
    ArcaniaCQ likes this.
  5. Clownacy

    Clownacy Retired Staff lolololo Member

    Aug 15, 2014
    I've only been working with the 32X for a short time but... I'm pretty sure there are only two hardware PWM channels (Chaotix's PWM driver does software mixing), and the Z80 can access 68k ROM (unless Kega is broken; I don't have hardware to test on). I've seen official 32X ports of SMPS 68k, complete with a Z80 DAC driver that uses the 68k bank window.

    In fact, from what I've seen of the 32X game Metal Head, its SMPS driver can only play DAC SFX: there's no FM or PSG SFX support left, so, to a small extent, Royameadow's idea has been realised before. In fact, that driver allows music to make use of DAC as well, along with PWM. I imagine the SFX just get muted when the music uses the DAC instead, or maybe the other way around.

    I think the problem with Z80 on a 32X game is that the ROM is accessed weird. I've mentioned this before, but only the first 512KB of the ROM can be accessed at all times, like you would on a normal Mega Drive: the rest must be accessed through a 1MB window, a bit like the Z80. That means, to keep things simple, all DAC samples would have to be in the first 512KB of the ROM, so the Z80 can freely access it. The only alternate would be having the 68k upload the current sample to Z80 RAM, like how S2/Wily Wars loads its music. I doubt storing the samples in a cartridge bank would be feasible at all, since the 68k would somehow have to know when to switch bank before the Z80 tries to read data.

    EDIT: Derp, Metal Head's DAC driver does software mixing, too: one for music, and one for SFX, apparently.

    EDIT2: @Royameadow, have you ever considered using the Mega CD's 8 PCM channels, or do you think that would be too easy? 8 channels (9, if you count the DAC) is better than 5.
    Last edited: Jul 24, 2016
    vladikcomper and Royameadow like this.