VGM or TFM with PCM?
Moderator: BigEvilCorporation
-
- Interested
- Posts: 30
- Joined: Mon May 06, 2013 2:27 am
- Location: Vermont, USA
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.
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.
-
- Very interested
- Posts: 2443
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
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.
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
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.
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.
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
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.foobat wrote:Some bootstrapping has to be done on the ym2612 to get it into the right mode to begin playing pcm samples.
-
- Interested
- Posts: 30
- Joined: Mon May 06, 2013 2:27 am
- Location: Vermont, USA
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.
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
http://www.youtube.com/watch?v=xNWv7htg7_c
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
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
-
- Interested
- Posts: 30
- Joined: Mon May 06, 2013 2:27 am
- Location: Vermont, USA
Thanks for what?TechnoZealot wrote:Wow! This is really good stuff! Thanks r57shell!
Who they? Which table?TechnoZealot wrote:I wonder how they even gathered all of the information to make this 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.