Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Game samples extraction mega-thread

Reply to topic Goto page 1, 2, 3  Next
Author Message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Game samples extraction mega-thread
Post Posted: Wed Dec 23, 2015 10:57 pm
Last edited by Maxim on Mon Feb 22, 2016 8:09 pm; edited 2 times in total
[Admin: thread split from Voice data sample conversion (How to?). This thread contains minimally-processed WAV renderings of samples from Sega 8-bit games, at the average original playback rate (or other rates as appropriate) and adjusted to 8-bit data.]

The files attached are the raw laugh data packaged into WAV files, at the sample rates they're played back. The VOC encodes its own sampling rate which doesn't match the playback rate. I didn't summon the effort to generate a full laugh reproduction.

I've added WAV as an attachable format which renders as an HTML audio tag so you can play it in the browser. Populous WAVs are attached, and end up about the same as an MP3 but much better quality. Let's see which browsers can play them - so far, Chrome desktop seems fine, Chrome Android is a bit screwy.

I've updated my converter again to support 8-bit output. See here:

https://github.com/maxim-zhao/SampleToWav/releases

I'll be pushing updates there as and when I find things to do.
Laugh1 linear.wav (3.04 KB)

Laugh1.wav (3.04 KB)

Laugh2 linear.wav (3.64 KB)

Laugh2.wav (3.64 KB)


  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Space Harrier (50Hz)
Post Posted: Thu Dec 24, 2015 6:42 pm
Last edited by Maxim on Fri Jan 08, 2016 12:23 am; edited 1 time in total
So I added PDM support after reverse-engineering Space Harrier's sample player. The weird thing is, the data sounds OK when played as 8-bit PCM. My theory is that this is because in general higher numbers have more 1 bits, which helps approximate the effect of PDM; plus the data is severely clipped (lots of runs of 0s and 1s) so 0000... = 0 and 1111.. = 255. That means PCM data can be played as PDM for a volume boost and linearization of the response. In general, PDM data shouldn't sound right as PCM.

I've attached three variants of both samples in the game:

1. 1-bit: PDM output, looks ugly but matches what the game actually does
2. 8-bit PCM: the dumb interpretation
3. 8-bit average of 1-bit PDM: just the average of each 8 bits, kind of like a resampled moving average with a flat curve

I think #1 sounds best, but I'm sure there's some model to generate a better moving-average at the 35kHz rate which might sound better. Is it possible that they are playing actual 8-bit PCM data as PDM, so the PCM is the truer sound? Or is the PCM interpretation a mistake? I'm not sure...

(Note that I'm using the term PDM in the way we'd usually say PWM, because it's probably the more correct term.)

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Marksman Shooting
Post Posted: Fri Jan 08, 2016 12:22 am
This game's audio is 1-bit PDM. The sample playback rate varies depending on whether the bits are 1 or 0 (!) but for the single sample present, it spends an average of 98.4018 cycles between each sample.

The data is the same in both ROMs containing the game,

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Lemmings
Post Posted: Fri Jan 08, 2016 12:39 am
A new format, but not hard to handle: 8-bit signed PCM data in the ROM, being converted to unsigned and truncated to 4 bits for playback.

Both samples have a bit of junk data at the beginning and end causing clicks (I presume it wasn't deliberate), and the effective sample rate is a bit below the original data's 8kHz, so I also produced an IPS to fix both of these issues. The difference is almost imperceptible :) and the WAVs below are at the 7595Hz the game achieves on a PAL console.

Play the Lemmings' voices at 4kHz and it just sounds like a woman talking...

Maybe it would be fun to insert a better sample player and/or better process the data, like blargg's DC offsetting converter, to maximise the audio quality.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
After Burner
Post Posted: Fri Jan 08, 2016 11:25 pm
This is the exact same "Get Ready" data from Space Harrier, but played slower. I'm seeing this PDM player a lot recently, and every version has a variable sample rate so I'm averaging it: here, I get 115.75 cycles per sample so 30925Hz.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Alien Syndrome
Post Posted: Fri Jan 08, 2016 11:27 pm
PDM again, with a higher sampling rate for Mary - maybe to better encode the higher pitch. It's a common Sega big-endian PDM player again.

; Scream 1: 0x1e080, 0x3e0 = 992
; 1356834 - 63 cycles from first out to last = 170.96 cycles per sample = 20937Hz

; Scream 2: 0x1e460, 0x9e1 = 2529
; 2045268 - 63 cycles from first out to last = 101.09 cycles per sample = 35410Hz


The GG version was tagged as having sampled audio but I'm fairly sure it doesn't, so I deleted the tag.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Altered Beast
Post Posted: Fri Jan 08, 2016 11:34 pm
Last edited by Maxim on Fri Jan 15, 2016 8:20 pm; edited 1 time in total
I'm working on this one now. It has three standalone samples and one which is built from two underlying samples, played at varying rates with short pauses between them. I'm totally unfamiliar with the game - any guesses as to what the sounds are?

Constructing a WAV of the dynamically-produced sample will be hard.

Edit: and...done. The laugh sample is built from two parts, the first is played a total of five times at three different rates, with pauses in between, then the second part. I rendered it at all the sampling rates and also mixed them into a 44kHz file. Overall, sampling rates are from 7.1 to 11.5kHz - which is very low.
Altered Beast - Laugh 1.wav (1.36 KB)
Laugh part 1 at 11475Hz
Altered Beast - Laugh 2,3.wav (1.36 KB)
Laugh part 1 at 11016Hz
Altered Beast - Laugh 4,5.wav (1.36 KB)
Laugh part 1 at 10592Hz
Altered Beast - Laugh 6.wav (5.36 KB)
Laugh part 2

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Arcade Smash Hits
Post Posted: Tue Jan 12, 2016 11:34 pm
4-bit little-endian linear data, played as PSG volumes at 9446Hz. The alien voice seems to be composed of randomly selected parts, plus the two actual voices.

The data for every sample has 104 erroneous samples at the start, possibly due to a mistake in the conversion to 4-bit data where they encoded a file header of some sort. I didn't manage to guess what that format might be - I guess we have the upper 4 bits of each byte of the header, though. The samples below have this removed, plus I have attached an IPS patch to fix the data pointers in the game to avoid the bad data, I think it helps quite a lot.

Next up is American Baseball, then all of letter A will be done... but I can take requests, if anyone cares about this stuff at all :) Looks like the old Sega PDM engine again, the one where the sampling rate depends on the data so you have to measure every sample... it's so pervasive (so far) that maybe I ought to write some code to calculate the sampling rate from the data...

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
American Baseball
Post Posted: Wed Jan 13, 2016 7:39 pm
Last edited by Maxim on Fri Jan 15, 2016 8:19 pm; edited 1 time in total
1-bit big-endian PDM, same as all the other PDM games seen so far, although it does have a more advanced samples lookup system since it has more than one or two of them. Sampling rates are all 20.2-3kHz.

In a few places it could have built phrases out of words, it instead stores the phrase, which is a good thing (the voices are slightly less robotic that way). Conversely, there's plenty of slack space they could have used to store the data at a higher sampling rate.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Bonanza Bros
Post Posted: Thu Jan 14, 2016 8:37 pm
Last edited by Maxim on Mon Jul 02, 2018 3:35 am; edited 2 times in total
More PDM, this time with an even worse version of the usual decoder which adds even more unevenness to the playback :) Sampling rates are 15.7 and 12.6kHz. The voice is actually a laugh, but it's such bad quality you might think there's some words in there. It's actually "Get Treasure", apparently.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
California Games
Post Posted: Fri Jan 15, 2016 8:15 pm
PDM again, rates between 15.8 and 19.5kHz. The game allows you to press a button to interrupt the sample, which adds extra glitchiness to the player. I couldn't quite figure out what triggers the game to play a sample, it seems random?

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Captain Silver
Post Posted: Fri Jan 15, 2016 8:39 pm
PDM, 21.1-22.6kHz. The witch laugh is two samples, part 1, then part 2 five times at the same rate, with 186ms pauses in between. I've made a mixed version of that.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Dead Angle
Post Posted: Fri Jan 15, 2016 8:51 pm
Only one sample, PDM at 19694Hz.
Dead Angle - Ouch.wav (12.05 KB)


  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Dracula (SMS)
Post Posted: Fri Jan 15, 2016 9:01 pm
Only one sample (as discussed above), little-endian 4-bit data, not log-compensated, at 6391Hz (PAL).

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Ecco the Dolphin (SMS)
Post Posted: Wed Jan 20, 2016 10:12 pm
This contains two samples, although the lookup table has four entries: two are for parts of the same, long sample, and the fourth points to other data.

The sample player is almost very good: it has 8-bit unsigned data, and it then looks up into a table of PSG command values for each sample. However, for some reason it does it wrong: it multiplies the index by 3 instead of 4 (the fourth byte being one to silence the noise channel anyway) so it ends up misaligned and in the wrong place, then rounds the offset to semi-correct it so it's merely in the wrong place. The data itself seems to do a fair approximation of a linear output range (i.e. log compensation). It pages in two slots to allow up to 32KB of sample data, but then the longer sample is 49KB so it plays it in chunks anyway.

I'm not sure if the "splash screen" sample is used in the game, since I could only see it used in the Sega splash screen which has been removed from the game. That's 64KB of ROM used for nothing...

There's a weird tone in the middle of the "splash screen" sample which I think the sample player manages to mask out.

Sample rates are 5931Hz and 7588Hz on a PAL system (as used here). The GG version ought to get a separate pack at NTSC rates.

I've also attached a patch to fix the sample player bug. It was a bit tricky because I had to replicate the timing of the bad code.
Sample output curve.png (5.82 KB)
Plot of linearisation result
Sample output curve.png

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Excellent Dizzy Collection (GG)
Post Posted: Wed Jan 20, 2016 11:09 pm
Last edited by Maxim on Thu Jan 21, 2016 10:04 am; edited 1 time in total
The SMS version doesn't seem to play samples? Data is 8-bit signed data, played by conversion to unsigned then truncation and inversion. It does something weird, which is to boost all samples up by two steps (unless that would overflow the 4-bit range) which makes the whole sample much louder, but mis-shapen as well. It also includes six bytes of file header which it plays as samples, giving a pop at the start of every one.

The saving grace seems to be the sampling rate, which is about 10kHz, the highest seen so far for PCM, and the data is well cleaned and normalised, giving a loud and clear voice.

I'll post an IPS to fix the popping later...

  View user's profile Send private message Visit poster's website
  • Joined: 17 Sep 2013
  • Posts: 114
  • Location: Gravataí, RS, Brazil
Reply with quote
Post Posted: Thu Jan 21, 2016 12:33 am
Reading the Advanced PCM section on SN76489 about using combinations of the 3 tone channel volumes to create the possible samples. Is not possible to also use the noise channel to create more combinations? Putting in %011 mode and use it's volume as the others.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Post Posted: Thu Jan 21, 2016 8:39 am
I haven't experimented, but I suspect you can't stop it flip-flopping and producing noise. I'm not sure what happens when it's locked to channel 2 at a wavelength of 0, though.

Also, an extra channel might make it louder, but it won't add much to the resolution at the top end. I think the source data preprocessing has a much bigger impact...
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Flintstones
Post Posted: Thu Jan 21, 2016 8:58 pm
A single sample, using a lookup table for PSG volume commands with log compensation, very similar to Ecco and Lemmings 2. The screw-up here is that the sample data is terrible quality, and it is padded with a click at one end and cut off at the other. So here's an IPS to fix the data played, if not the data itself - but we could probably find a decent sample to replace it here if it was worth the effort.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Gauntlet
Post Posted: Fri Jan 22, 2016 10:55 pm
A new player - not too surprising as this is one of the very first European-developed games. What we have here is 4-bit big-endian linear PCM data, played back using a lookup table over the three tone channels to maintain the linear response.

Experience tells me to expect something screwy: the sample player has inconsistent timing between consecutive samples (I took the average, which gives 5111Hz) and the data seems to be cut a bit badly - it sounds a lot like a single sample with an echo effect across it, then chunks are played which sounds like they start and end in not quite the right places. So I've attached the whole sample for comparison.
Gauntlet - Elf.wav (1.74 KB)

Gauntlet - All.wav (12.18 KB)


  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Golfamania
Post Posted: Sat Jan 23, 2016 3:59 pm
The usual PDM engine, averaging 167.9 cycles per sample for 21315Hz output. I'm assuming it was developed for NTSC timing. Only one sample.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
GP Rider (SMS)
Post Posted: Sat Jan 23, 2016 4:46 pm
8-bit unsigned PCM played via a lookup table to produce linear output. The lookup table seems to be the same as the one in The Flintstones and Ecco - I wonder where it originated? And why the samples here sound so noisy in-game? Maybe the 3-channel method is just noisy due to the intermediate values you get while changing the volumes?

The woman's voice is at 10621Hz (337 cycles per sample) and the man's at 7261Hz (493 cycles per sample), on an NTSC machine. I'm assuming this game wasn't developed for PAL timings.

The sample data sometimes looks like it is favouring the lower end of the spectrum where the PSG playback has good fidelity, but not everywhere.

Next up are the Great sports games. I predict horrible PDM, and lots of samples (where I have to time every one of them due to the inconsistent playback rate)...

The lookup table is 1024 bytes from $63b7, would anyone care to search for it across the whole Sega 8-bit library? It does have data for the noise channel, I wonder if it actually works? No player has yet actually used it...

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Great Baseball
Post Posted: Sun Jan 24, 2016 11:31 pm
PDM at 36267-36378Hz, but weirdly cut off samples (e.g. "Strike" is missing the k).

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Great Basketball
Post Posted: Fri Jan 29, 2016 8:47 pm
The usual PDM engine, the hard part now is that almost all samples are split, sometimes for a pause and sometimes not. Most are around 9kHz, one at 7.1kHz, one at 17.7kHz. The split samples have been joined and played at their average sampling rate.

I can't understand two of them, can a basketball person guess what they might be?

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Impossible Mission
Post Posted: Fri Jan 29, 2016 8:51 pm
I'll come back to the Great games, I want something more fun.

This has almost the same sample player as Gauntlet - 4-bit linear PCM data played over three channels using a lookup which linearises the output. (The lookup is identical.) The samples are at 3738Hz which is very low. The sample data seems to have been thoroughly destroyed in a bunch of places - maybe an audio filter to make it sound robotic? What it really does is make several of the samples totally unintelligible, so I couldn't even guess at what is said. Explanations are welcome.

Sample 2 is played three times, at varying sampling rates to get a rising pitch, at a certain point in the game but I'm not familiar with it. Is it a laugh?

  View user's profile Send private message Visit poster's website
  • Joined: 01 Feb 2014
  • Posts: 406
Reply with quote
Post Posted: Sat Jan 30, 2016 7:59 am
Maxim wrote
What it really does is make several of the samples totally unintelligible, so I couldn't even guess at what is said. Explanations are welcome.

I played through the commodore 64 original back in the day and it had amazingly clear voice samples for its time, so I think I can help.

I actually can't place sample 2 at the moment. It being a laugh sounds like a good guess, though.

Sample 5 is supposed to be: "Destroy him, my robots!"

Sample 4 is "Another visitor".
(Used in combination with the last two samples: "Another visitor. Stay a while - stay forever!")
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Post Posted: Sat Jan 30, 2016 8:49 am
Maybe we can pull the samples out of the C64 game and fix it. It's remarkable how many games have screwed up sample data.

Here's a useful reference: https://youtu.be/UxmtE5ylifU Sample 2 is the bit at 0:17 which sounds to me like "LOL... LOL... LOL!"... But it's actually the end of the game, with the bad guy saying "No... No... No!". I'll need to make the full sample, I guess.

It seems the original audio was somewhat compressed, making it a bit robotic, but not as bad as the above.
  View user's profile Send private message Visit poster's website
  • Joined: 15 Sep 2009
  • Posts: 373
Reply with quote
Post Posted: Sat Jan 30, 2016 9:09 am
Just for reference, these are the endings of the SMS and C64 versions.

Funnily, the SMS version of sample 5 sounds more like "Destroy the game, my robots!" to me.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Post Posted: Sat Jan 30, 2016 3:48 pm
I'm slightly inspired to make a patch to replace the samples with the C64 voices, even if they are a bit synthy. I'd try to leave everything else as is, though, to avoid getting carried away with a 1MB+ ROM with 44kHz samples, etc...
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Krusty's Fun House
Post Posted: Mon Feb 01, 2016 9:46 pm
4-bit little-endian PCM with no log compensation, at 7838Hz (PAL). The sample player looks fairly different to what I've seen before.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Mahjong Sengoku Jidai
Post Posted: Mon Feb 01, 2016 10:29 pm
Six samples each played at two different sampling rates to sound female or male (I think). I have no idea what's being said, though - I guess you'd need to know Japanese Mahjong to be sure. 1-bit PDM, the usual Sega player. Sampling rates from 12768 to 20262Hz.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Mortal Kombat II
Post Posted: Mon Feb 01, 2016 11:11 pm
A single sample, 8-bit signed PCM data which is converted on the fly to 4-bit unsigned, and then sent as PSG attenuation values (so no log compensation). 7665Hz. The player doesn't look very familiar.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Post Posted: Tue Feb 02, 2016 7:24 pm
Here's an IPS patch to replace the Impossible Mission samples with versions from the C64 game. I'm not sure it's any better, though - mastering 4 bit samples is hard. I left the death scream as-is because the C64 sample is much longer and would be hard to fit. Otherwise I time-stretched the C64 samples into the existing sample lengths. It would be possible to replace them with higher quality data and expand the ROM, but I don't want to spend that much time on it.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Sega Chess
Post Posted: Tue Feb 02, 2016 9:20 pm
A slightly weird version of the UK sample engine - 4-bit big-endian PCM, looked up in a table of PSG commands - four bytes per index.

What's good: 12 samples, used to build phrases.

Where it goes wrong: the lookup table is actually 31 items (!), the first 16 all have blanked channel 2 and 3 data (so you only get two channels of output), the values are not log-compensated. Data is not log-compensated either.

What's weird: the sample data has terminator bytes (0x1f) rather than byte counts. I guess that byte is fairly unlikely to appear in the data, but it's the first time I've seen terminators used.

WAVs below are linear, 6921Hz (for PAL) with no attempt at joining into phrases.

There's also an IPS to replace the lookup table with that from Gauntlet, which boosts the clarity and volume a bit.
Sega Chess - 2D.wav (3.87 KB)

Sega Chess - 3D.wav (4.54 KB)


  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Shadow Dancer
Post Posted: Tue Feb 02, 2016 10:29 pm
The usual Sega PDM player at 16290-16347Hz. What's the voice saying?

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
X-Men - Mojo World, X-Men, X-Men: GamesMaster's Legacy
Post Posted: Thu Feb 04, 2016 9:17 pm
Last edited by Maxim on Tue Mar 01, 2016 11:54 pm; edited 1 time in total
The mid-90s "Sega" voice on startup is the only sample in the game. 11099Hz 4-bit big-endian PCM with no log compensation. Possibly the highest bitrate audio I've seen so far (except for those games truncating 8-bit audio, but they're wasting half the bits).

Edit: confirmed that all three X-Men games have exactly the same sample and no more.
X-Men - Sega.wav (5.41 KB)


  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Virtua Fighter Animation
Post Posted: Thu Feb 04, 2016 9:22 pm
8089Hz 4-bit PCM, inverted on playback, no log compensation. I'm going to have to pass on transcribing what they are saying... I also couldn't figure out how to get the game to play them.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
World Class Leader Board
Post Posted: Fri Feb 05, 2016 7:16 pm
Last edited by Maxim on Sat Mar 05, 2016 8:37 am; edited 1 time in total
Another game where I couldn't figure out how to make it play the samples, so for the non-speech ones I guessed at what they are.

8-bit signed PCM data is looked up on the fly in a table of PSG commands, played back at either 5621Hz or 7467Hz. These are long samples, most longer than 16KB in fact so the player uses two paging slots.

In fact, its sample player is almost identical to that of Ecco the Dolphin - with the exact same bug and half-fix. To compound the screwups, however, the 8-bit signed sample data has been scaled to only use 25% of the available range - the whole wave is between 0 and 64 instead of -127 to +128, so it's effectively 6-bit audio. The result is incredibly unclear, quiet audio despite having pretty good (and high bitrate) source data which has been amplified/compressed/clipped fairly well for the usage. It's remarkable that a 1990 2Mbit SMS game would dedicate 30% of its ROM to sampled audio.

The samples also seem a bit cut off at the end...

The WAVs here are the badly-scaled raw data (converted to unsigned 8-bit for better compatibility), so imagine the volume multiplied by 4.

Maybe I'll make a IPS to fix the bad lookup code and also rescale the data...

Edit: confirmed identical code and data in the Game Gear version.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Super Monaco GP II
Post Posted: Wed Feb 10, 2016 11:50 pm
Just one sample, at astonishingly low quality: 1-bit PDM at 8697Hz. The sample takes up just 781 bytes in a bank with 10472 bytes unused! I had to go look at the Mega Drive version to figure out what's said.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Street Fighter II
Post Posted: Thu Feb 11, 2016 8:58 pm
Perhaps not surprisingly, this has a (so far) unique sample player. It's 4-bit big-endian PCM, played on all three tone channels, with an uneven sampling rate which comes out at about 8390Hz in the end. The most interesting part here is that the sample data is pre-adjusted for the PSG's logarithmic output, so you get a nicely centred wave only when the output curve is logarithmic. I'm surprised this is the only game to do this so far - it seems a lot more sensible to process the data at compilation time than to jump though hoops at playback.

The only glitch seems to be that the number five has its duration copied from the number four, which cuts it off a bit. The WAV below includes all the data, which includes a small click at the end.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
RoboCop vs. the Terminator
Post Posted: Fri Feb 12, 2016 6:58 pm
Last edited by Maxim on Fri Feb 12, 2016 7:11 pm; edited 1 time in total
Another new engine. This one has a few interesting features:

1. It has an 8-bit lookup for three tone channel attenuation commands, but it's a different lookup to one seen in other European games (and seems more noisy)
2. It mashes its PSG output commands into three consecutive out(c), r opcodes to minimise the duration of mid-transition noise (to 24 cycles = 6.7us)
3. The embedded data is the AVR sound format, which allows me to pick out the original sampling rate of the data, which is about 10% off what the game actually achieves, and also original sample names: COOPERAT, EXCELENT, LOOKIN2 and TERMIN2.


And some oddities:

1. The sample player is included twice (including 1KB lookup table), so it can be run from the bank holding the samples and save ~1100 bytes of unmapped ROM space
2. Each player is identical except for a delay counter, affecting the playback sampling rate; so the four samples have two different rates.
3. Each player has two samples next to it, and the pointers for the first are correct in each but the second includes the 128 byte file header, played as data, for each. A weirdly systematic mistake to make.

WAVs below are for the correct data stream and at the sampling rate given in the header (8084Hz or 6981Hz) rather than what the game achieves (8465Hz and 7343Hz respectively).

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Tennis Ace
Post Posted: Fri Feb 12, 2016 7:06 pm
The usual Sega PDM engine, at a range of frequencies from 16.7kHz to 24.1kHz. I couldn't figure out some of the words, and guessed some of the others, not least because I suck at this game.
Tennis Ace - xxxx.wav (13.43 KB)


  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Sports Pad Football / Great Football
Post Posted: Fri Feb 12, 2016 7:41 pm
Last edited by Maxim on Sat Feb 13, 2016 3:14 pm; edited 1 time in total
I guess I hadn't realised how many sports games I'd have to endure with this project. Luckily these two are identical for the sample playback code and data.

1-bit big-endian PDM, the usual player. There are only three samples, one of which is crowd noise which the game always plays three times in a row. Sampling rates are 32-36kHz, which is pretty high - but they're still super unclear. I'm starting to wonder if the PDM data is in fact just horribly clipped PCM...

Edit: named Interception thanks to Paul Baker.

  View user's profile Send private message Visit poster's website
  • Joined: 08 Dec 2005
  • Posts: 481
  • Location: Melbourne, Australia
Reply with quote
Post Posted: Sat Feb 13, 2016 10:02 am
Maxim wrote
Mortal Kombat II

A single sample, 8-bit signed PCM data which is converted on the fly to 4-bit unsigned, and then sent as PSG attenuation values (so no log compensation). 7665Hz. The player doesn't look very familiar.

I believe this player is the same as the one in Lemmings. I previously posted some information about the sampled audio in these two games here.

Maxim wrote
Sports Pad Football / Great Football

Sampling rates are 32-36kHz, which is pretty high - but I still can't tell what it's saying on one of them (and the other is only a guess).

Your guess ("Touchdown") is correct. The other sample says "Interception".
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Post Posted: Sat Feb 13, 2016 2:26 pm
I'll have to look back, it's a while since I looked at Lemmings, so I may have forgotten it.

As a side project I've been identifying location-independent code that is related to sample playback, or lookup tables, and checking the 8-bit game catalogue for them. So far it's found quite a lot of games which aren't currently tagged as having sampled audio... but maybe they just have unused code in them. I thought I was close to the end (on the SMS side), but maybe not...

Edit: here's the hits for the Mortal Kombat II player:

Found at 61b9
Bram Stoker's Dracula.gg
Found at 6098
Bram Stoker's Dracula.sms
Found at 6f94
Lemmings [Proto].gg
Found at 7a06
Lemmings [Proto].sms
Found at 72ef
Lemmings.gg
Found at 764b
Lemmings.sms
Found at 7e835
Mortal Kombat II.gg
Found at 7e835
Mortal Kombat II.sms

So it's the third time I've seen this engine :)
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Jurassic Park
Post Posted: Thu Feb 18, 2016 6:46 pm
A re-rip, because my code detection tool let me know that this game actually has two sample players in it. I deleted the original post above.

Two samples, using 4-bit big-endian PCM at 7434Hz and 10184Hz (NTSC) with no log compensation. The samples are complemented to make the PSG attenuations not flip the wave, although it doesn't really matter and could have been trivially done in preprocessing. It's sent to all three tone channels at once for extra volume.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Sonic Blast
Post Posted: Thu Feb 18, 2016 6:48 pm
Just the original Sega voice, but look at the sampling rate: 24945Hz! 4-bit big-endian data with no log compensation. The quality is great, but it is a big chunk of data in the ROM (nearly a whole bank) and is a bit cut off (they should have used the rest of the bank).

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Sonic The Hedgehog 2
Post Posted: Thu Feb 18, 2016 6:55 pm
Just the Sega voice again, at 21118Hz this time (4-bit big-endian PSG attenuation values with no log compensation). Not cut off like in Sonic Blast, although it has a bit of space left unused.

The data and code are all there in the Master System versions of the game but they are not used because the Sega screen is not shown. A shame they didn't find a way to use it.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
Great Golf
Post Posted: Thu Feb 18, 2016 7:00 pm
Last edited by Maxim on Sat Feb 20, 2016 2:38 pm; edited 1 time in total
And back to horrible 1-bit data! I have no idea what it's saying. I couldn't get the game to play them so I don't have any context. The data in the ROM seems a bit longer than what is specified in code, if that's any help. Data is played at 16588-16618Hz.

Edit: fixed voice, which was not taken at the right address.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12485
  • Location: London
Reply with quote
An aside on PDM
Post Posted: Thu Feb 18, 2016 7:20 pm
Last edited by Maxim on Fri Feb 19, 2016 7:32 pm; edited 4 times in total
I had a go at making a PDM converter. It's basically the same as a 1-D "error diffusion" algorithm which you may be familiar with from the world of graphics. The thing is, this will by definition produce a 1010101010 sequence for silence, which is fine when the sample rate is in the MHz range - it'll be low-pass-filtered, plus it's beyond human hearing and speaker response anyway. However, when the sample rate is in the kHz, it's incredibly distracting.

Here's an example. I took the half-decent Sega voice sample from Sonic 2 and processed it to 1-bit PDM data at 36kHz - the highest rate I've seen so far in an SMS game - and also implemented a dumb "round to 1 or 0" algorithm at the same rate. The results are attached, converted to listenable WAVs. Note that the PDM file ends up with a funny hissy noise - either my algorithm is rubbish, or that's the "noise shaping" I see mentioned when reading about PDM. The goal is to shift it out of the audible range, but it's very audible here. There isn't enough silence to get an 18kHz tone, though.

The dumb 1-bit conversion sounds pretty terrible - but a lot more like the Sega samples. It has no dynamic range at all (everything is at 100% volume) and sounds very harsh.

These come to 6.65KB of data each, which seems not unreasonable and a lot less than the original sample.

I repeated it at 192kHz, which won't help the dumb algorithm at all, but have a listen to the PDM: the noise is almost gone. However, the data is now 35.5KB. This is not even (reasonably) achievable on a Master System, though. We had a code optimisation challenge which got us up to 96.7kHz, but it'll be very hard to get much higher.

So, I suspect the 1-bit samples in Sega games are not PDM, or PWM, they are just reduced to one bit per sample, possibly with some sort of noise floor algorithm to avoid massively amplifying silence. This also means there's not much we can do to recover more listenable data...

If I can find some suitable high-sampling-rate data I can make some more examples. However, I think PDM is not going to be an acceptable tradeoff for Sega 8-bit homebrew given the alternatives (and lack of ROM limitations) we know about.

  View user's profile Send private message Visit poster's website
Reply to topic Goto page 1, 2, 3  Next



Back to the top of this page

Back to SMS Power!