Page 2 of 2

Posted: Fri May 17, 2013 4:06 am
by TechnoZealot
A lot of commercial games for MD/Genesis tend to have sampled drum sounds in their soundtack. How was this achieved? That's mostly all of what I'm interested in, but the occasional sampled sound I'm sure can also be done. Just take a look at Shinobi III to see how they did both sampled drums in their music and a healthy variety of sampled game sounds. They had a very cool system where you could override the drums by doing certain moves continuously at the right times.

Is it likely that they were utilizing the Z80 for this? I mean I can try dumping the instructions for the Z80 with genskmod but not sure how far i'll get with that.

Posted: Fri May 17, 2013 11:10 am
by TmEE co.(TM)
I don't think any game used 68K do to samples ingame, it is hard to get good quality and have time left for a game.

Posted: Fri May 17, 2013 8:37 pm
by eteream
..

Posted: Sun May 19, 2013 8:10 am
by foobat
I believe the z80 almost exclusively plays music in the Sonic games. It sits in a tight loop manipulating the ym2612 and sn76489, usually using the vblank interrupt for timing. The ym2612 does have timers, but it takes a lot of cycles to check them and can slow down playback and reduce the complexity of the songs you can play.

The z80 has direct access to its own 8k of RAM and will usually store the entire sound driver with samples in there. In order to play back samples the z80 will read the first byte of the sample from its RAM, write 0x2A (the address of the channel 6 DAC register in the ym2612) to 4002h, then write the byte you read from RAM to 4003h. Then you move your pointer to the next byte and after a certain amount of time elapses (maybe doing other audio work during the downtime) you repeat this process.

Some bootstrapping has to be done on the ym2612 to get it into the right mode to begin playing pcm samples.

It's actually really hard to do this in real-time from scratch.

Posted: Sun May 19, 2013 6:02 pm
by Chilly Willy
foobat wrote:Some bootstrapping has to be done on the ym2612 to get it into the right mode to begin playing pcm samples.
Which is why some VGM streams don't play PCM on real hardware - they forgot that the PCM shares hardware with FM channel 6, and they don't do the commands needed to switch between the two. A prime example is VGM-MM doesn't init the PCM or do the switch commands, so you only get FM and no PCM. Deflemask originally had the same problem, but I worked with the author to fix that.

Posted: Tue May 21, 2013 6:57 am
by TechnoZealot
I read something very interesting on BigEvilCorp's blog post here (http://bigevilcorp.wordpress.com/2012/0 ... -psg-chip/) about using the PSG to play PCM. Would that be an option? This would also free up all six channels of the YM2612 for business. Of course you would have a single bit depth for all samples played through it, but for in-game sounds, this might be useable.

Posted: Wed May 22, 2013 10:15 am
by foobat
using the PSG to actually play music is more valuable than having an extra channel on the ym2612 in my opinion, and the 2612 dac is way more useful. In a pinch I guess you could do some simple high-frequency sound effects with 1-bit pcm, but it won't be enough for percussion.

http://www.youtube.com/watch?v=xNWv7htg7_c

Posted: Sat May 25, 2013 3:30 pm
by kubilus1
A lot of games do use sampled sounds for drums (or record scratches for ToeJam & Earl), on the z80 with the Yamaha chip. Road rash does not use any PCM samples, at least in all the VGM tracks I've dug through.

Posted: Mon May 27, 2013 2:03 am
by r57shell
Toejam & Earl in Panic on Funkotron uses GEMS Sound Driver.
You can found sound driver list for example here:
http://gdri.smspower.org/wiki/index.php ... ngine_List
And here sorted by engine version:
http://elektropage.ru/r57shell/sounde_e ... sorted.txt

Now I'm working on GEMS toolkit, of course not official :Y
Here: http://github.com/realmonster/GEMS
Status: in progress, so now not enough work done. But it's allmost done :).

Many games uses PCM for SFX. You can reserve FM 5 for SFX, but it's not cool, so "cool" driver "watch" over FM 5, and when no SFX played, then play drums. If drums played, and some SFX need to start, then stop play current drum, and start SFX.

GEMS more than... GEMS know everything about channels status at every moment. For playing notes/samples GEMS uses Dynamic Voice Allocation. Right! When driver needs to play note, he search for suitable channel, and use it.
See how it works :) http://www.youtube.com/watch?v=iQjfjEHVnGY

Posted: Wed May 29, 2013 11:36 am
by TechnoZealot
Wow! :shock: This is really good stuff! Thanks r57shell!

I wonder how they even gathered all of the information to make this table.

Posted: Wed May 29, 2013 1:02 pm
by r57shell
TechnoZealot wrote:Wow! :shock: This is really good stuff! Thanks r57shell!
Thanks for what?
TechnoZealot wrote:I wonder how they even gathered all of the information to make this table.
Who they? Which table?
If you about Jukebox in video - it is my code. GEMS v2.8 - original code, more about GEMS see topic: viewtopic.php?t=1349.