|
ForumsSega Master System / Mark III / Game GearSG-1000 / SC-3000 / SF-7000 / OMV |
Home - Forums - Games - Scans - Maps - Cheats - Credits Music - Videos - Development - Hacks - Translations - Homebrew |
Author | Message |
---|---|
|
Sampled Audio in Lemmings and Mortal Kombat II
Posted: Mon Jan 09, 2012 10:26 pm
|
Lemmings and Mortal Kombat II, both developed by Probe, use exactly the same code to play their audio samples.
The code works on 8-bit signed sample data, converting a sample to 4-bit unsigned and outputting it to the PSG once every 467 Z80 cycles. This works out as a sample rate of approximately 7600Hz on PAL systems. I have extracted the sample data from the ROMs and attach it here both in raw binary form and converted to WAV format - allowing the samples to be heard in their full 8-bit quality. (All of the attached files have been zipped due to the forum's restrictions on file extensions.) Interestingly, the samples in Lemmings are almost identical to those used in the original Amiga version. For the Master System they have been slightly shortened, and a 62-byte header and 4-byte footer ("AMII") have been added. The SMS games treat the header and footer as part of the sample data - this is the reason for the clicks at the beginning and end of the attached WAV files. On the Amiga the Lemmings voices are played at a rate of one sample every 480 cycles of the "Paula" chip. Since this chip runs at the same clock rate as the Master System's Z80, the Amiga plays the samples more slowly: at approximately 7400Hz. |
|
|
Posted: Tue Jan 10, 2012 10:57 am |
Here's some MP3 versions...
|
|
|
Posted: Tue Jan 10, 2012 11:02 am |
Do the games convert the samples to PSG log curve or they just chop off bottom 4 bits and go with top 4 ? | |
|
Posted: Thu Jan 12, 2012 10:27 am Last edited by RetroSpark on Sat Sep 10, 2016 10:59 am; edited 1 time in total |
They just use the top 4 bits: ld a, (hl)
inc hl sub $80 srl a srl a srl a srl a
Immediately after the above code comes a delay loop which consumes the majority of the 467 cycles: ld b, $19
-: djnz - DJNZ takes 13 cycles when b is non-zero. So, simply increasing the loop count from $19 to $1a will make the sample rate exactly match the Amiga. |
|
|
Posted: Thu Jan 12, 2012 11:05 am |
You get slightly less noisy output when you convert samples to log. It is still noisy though, but in a different way... | |