Mega PCM 2 Have your ROM hacks suffered from scratchy sample playback 99% of Mega-Drive games are known for? Have you dreamed of ultra-clean high sample rate playback closer to CD quality on real hardware? Let me present to you, Mega PCM 2! The following demo of ultra-clean in-game PCM playback at whopping 32 kHz was captured on real hardware: (recorded from VA6.5 Model 1 NTSC-U; special thanks to @MDTravis for the recording) Mega PCM 2 is a complete re-write of Mega PCM 1.x released back in 2012, which improves upon it in every single aspect. As always, it aims to be user-friendly, easy to use and reliable. Feature highlights Ultra-clean PCM playback on real hardware! No more scratchy playback that 99% of games suffer from. Mega PCM 2 implements DMA protection / buffering system to bypass hardware limitations. Pitch and volume control, DAC fade in/out support. Native .WAV file support. Forget about manually specifying pitches: Mega PCM 2 now reads .WAV files natively and plays them at the correct sample rate. Basic SFX support: you can have special "SFX samples" which won't be interrupted by BGM drums (note that Mega PCM 2 is still a one-channel driver and cannot play samples simultaneously); Several supported sample formats: WAV, 8-bit raw PCM, compressed 4-bit DPCM; Unlimited sample size: your samples can be as large as your ROM can fit, forget about banks and other Z80 limitations; Supports both AS and ASM68K assemblers; Playback control: pause, stop, loop, priority; High playback rates: Turbo mode! 8-bit PCM playback at 32 kHz (without pitch and volume effects); 8-bit PCM playback up to 25.1 kHz with pitch and volume effects; 4-bit DPCM playback up to 20.5 kHz with pitch and volume effects. Read more in Mega PCM 2's README on Github: https://github.com/vladikcomper/MegaPCM It's free and open-source by the way! Download Mega PCM 2 is bundled as a single .asm file, you can download it here: https://github.com/vladikcomper/MegaPCM/releases Installation, migration from Mega PCM 1.x and help Installation guides How to migrate from Mega PCM 1.x Documentation and help
I am currently seeing if the mega PCM 2 can be adapted to version 2.7 of the clownacy clone driver I will probably have to replace the Dac Driver
Yes, it can. Someone already showed me a quick & dirty Mega PCM on Clone Driver for Sonic Clean Engine (SCE), so it's quite doable. It only took like half an hour, but that person was quite skilled. I may consider doing an "official" Clone Driver port sometime in the future.
Came back after a long hiatus to say: THIS IS FUCKING AMAZING, DUDE!!! But i had a problem. After finally implementing this to my rom hack, Fusion refused to load the game, saying: "This is probably not a Genesis/32X ROM!" Just WTF? I made it totally right, and when I loaded my hack, it was supposedly "corrupted". What happened?
I assume you exceeded the weight of a normal Sega Genesis cartridge, you require Mappers for the game to work again in Kega Fusion
Yeah, the maximum ROM size is 4 MiB without mappers (because, by default, the cartridge ROM memory is mapped to the 1st 4 MiB of the 68000 address space). Even then, when you set one up, you have to make sure that the banking is properly configured, because the way the Z80 accesses the ROM is basically via the 68000 bus, so any bank configuration that is set on the 68000 side will also be set for the Z80. Also, IIRC, even then, Fusion limits the size of a ROM file to 6 MiB, even with a mapper (and IIRC, Regen limits it to 5 MiB). On hardware and other emulators, though, the limit is 32 MiB. As great as it is that Mega PCM can even play sampled music at a good quality, you still need to adhere to the ROM size limitations. And before anyone mentions it, yes, I am aware that if you properly set up the cartridge hardware, you can go past the 4 MiB space in the 68000 memory without having to deal with bankswitching, up to 10 MiB... but unfortunately, that clashes with the Sega CD and 32X, because they use up that extra space in memory for their own stuff, so I don't think it's even worth bothering looking into that.
Like Devon said. The MegaPCM 2 should not be used for very high quality PCM music. since it will be very fast that you will have to install a Mapper to expand the rom space to 32 MB and even with that it is not enough space for many high quality PCM music. If you really want music CD. I would recommend looking elsewhere or trying to turn on the MSU-MD (Mode 1). The MegaPCM 2 is best suited for easily porting DAC from other Sonic games and/or samples as DAC. But for PCM music its use is not recommended due to the space it consumes.
I think you can get away with some sampled music if you are clever. For instance, you could have chopped up parts of a larger song, discard any duplicate/redundant parts, and then set up an SMPS track to play the parts however you want. I believe this is what Markey did for Jester's Challenge and Sonic 1 The Next Level for their sampled music (though, I believe Markey handled it on the Z80 level, but nonetheless, the method I described *should* work okay enough).
To add to Devon's point, yes, there are quite a few ways to fit more PCM music in. I made a few Sonic hacks myself that relied on high quality PCM music and samples a lot. Another efficient way to save a ton of ROM space is 4-bit DPCM, which effectively cuts your sample size in half. Yes, quality takes a small hit depending on sound wave's entropy, but it sounds quite good most of the time, especially considering its "compression rate". Mega PCM 2.0 currently supports 4-bit DPCM at up to 20 kHz and I'm working on "DPCM-HQ", a slightly modified version with even better quality. Here's a demo ROM if you're interested: https://drive.google.com/file/d/1ujCNdtqEp-VgXgbr2h7NhepIFpWvfhe1/view?usp=sharing - it compresses 3.8 MiB PCM to just 1.9 MiB without major quality loss. This hopefully will be available in v.2.1 or later.
Neat. I had plans to use 2.0 in one project (out of like, more then three) but DPCM-HQ might be viable for another; though I might still have to add NES-DMC support on top of that, for compression reasons Probably an annoying suggestion given how DPCM works, but is loop points for PCM songs on the table? To clarify, I mean like how Green Hill has that intro bit at the start of its song that doesn't get looped. From what (frankly little) I know about the standard DPCM format this would be somewhat annoying to do, since the difference in data from the start of the loop to the end of the loop would cause disastrous results. The best solution I can think of is calculating the PCMs output without playing it back until you reach the loop point, saving the output and rom bank positions, beginning sample playback as normal, then when it reaches the end working back from that saved loop points output. This prevents having to check if you're at the loop point to save the needed data on every single sample, which may make loop points for turbo pcm mode somewhat viable, and generally not bring down the quality of playback Ideally, the PCM loop points would be calculated on the 68K when the sample is being provided via MegaPCM_LoadSampleTable, or optionally pre-calculated, and standard looping would use the same protocol, just with the loop data being at the very start, in order to maintain consistency. Doing the calculations on the Z80 would be very slow and eat up Z80 RAM, though it would make the PCM calculation code easier to copy and paste, since y'know, different CPU architectures and all. I think this alongside DPCM-HQ will make full song playback way more appealing then it currently is, though maybe DPCM-HQ alone will be enough? If Nats idea for SONAR is anything to go off of, it could be used for a full game (with a 12MB bank switched rom, but still)
For PCM, they are doable, yes, in fact I've already written PCM playback in a way that it has a loop handler with restart location and bank which can be potentially manipulated. What didn't make it into 2.0 release is actual logic to make this work and extra bytes to store a loop point. I have plans to support PCM loops in one form or another in future versions. For DPCM, looping will require too much overhead I'm afraid (with the solutions you've described). A much better solution would be to physically split intro and loop into separate DPCM samples and just play them one after the other. This brings us to another feature I plan: built-in sample sequencer, where Mega PCM can be programmed to play given samples in order with basic loop and jump commands (like an extremely barebones SMPS track; I think SONAR also implements it). I don't have any estimates on when and how any of these features may be implemented though; since Mega PCM is used by other people in very different contexts, I take its "API design", easy of use and compatibility very seriously and I need time to something flexible and durable enough, so when a new version comes out, it will be a drop-in replacement, not something that requires re-working and adapting previous installation.
Major Docs Update: DAC fade in/out in SMPS, adding PCM BGMs and more Back when Mega PCM 2.0 was released a little over 2 months ago, I didn't document some of its advanced features unfortunately. I was too exhausted after months of hardwork and initial installation guides already took too much time. Now, after a long-needed break, I finally have just enough energy to finish another huge chunk of the docs and hopefully make extended usage more accessible! (I swear writing and testing good documentation as harder than development sometimes) So meet advanced docs: "Extended Mega PCM 2 integration" guide: https://github.com/vladikcomper/MegaPCM/blob/2.x/docs/2-advanced-integration/Sonic-1-Github-AS.md In this guide, we'll level up SMPS to fully take advantage of Mega PCM 2 and implement advanced features like: DAC fade in/fade out, precise playback control (pause/unpause/stop), panning control and add a few QoL improvements. How-to-guides: How to play SFX samples with Mega PCM 2 - should be easy enough, but in case you need some guidance... How to play DAC BGM using SMPS and Mega PCM 2 - this explains a good and reliable way that should save you some headache; Too lazy to install it just yet? Try ready-to-use implementations: Sonic 1 Github AS disassembly with Mega PCM 2 pre-installed: https://github.com/vladikcomper/s1disasm-megapcm2 Unofficial Sonic 2 Clone Driver v2 with Mega PCM 2 integration by TheBlad768: Sonic Clean Engine (S.C.E.): https://github.com/TheBlad768/Sonic-Clean-Engine-S.C.E.- Sonic 1 Disassembly: https://github.com/TheBlad768/s1disasm-clone-driver Sonic 2 Disassembly: https://github.com/TheBlad768/s2disasm-clone-driver