MAMEWorld >> Programming
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

Pages: 1

MoonTurtle
MAME Fan
Reged: 04/16/19
Posts: 3
Send PM


Problems with ripping digitized samples from arcade games
#384257 - 11/12/19 09:01 PM Attachment: Splatterhouse-SFX.zip 402 KB (6 downloads)


Hello!
Prepare for a bit of a long read, PLEASE read the full thing before replying.

I recently played some of my favorite arcade games and took a liking to some of the sound effects from these games, so I went on the internet and searched for ways to get the sounds from the arcade (emulated in MAME, of course)

One way is an old program called "m1", it's a command prompt application originally released in 2008, claimed as a "Multi-Platform Arcade music/Sound eEmulator" and It does live up to that claim, as it can play most arcade music pretty flawlessly, (I only really use MAME for arcade emulation)
and any digitized sounds play ...mostly flawlessly.

For example I tried using M1 to rip the digitized samples from NinjaWarriors (1987, Taito) and was rather successful! the samples were crisp and clear, but when I tried doing the same for Final Fight and Haunted Castle(1987, Konami) I ran into an issue where the digitized sound samples would play, but the music track that played before would not stop, it would keep playing even as the sound effect played, making it near-impossible to rip the sound.

I soon got sick of the issue and looked for an alternative way to rip digitized sound samples, and eventually I came across another involving the use of Audacity,

FIRST, open up Audacity (if you have it)
then open up an arcade's parent rom, and look for any BIN files, COPY these files and put them in a new or empty folder (name the folder "[insert arcade game title here]-SFX.zip" then PASTE the copied BIN Files into the folder.

NEXT, in Audacity, go into File->Import->Raw Data,click Raw Data, then when the file selection window pops up, go to the folder you created with the copied files in it, and select whichever file you want to import, click OK, then a window will pop up allowing you to change the encoding, the byte order, how many sound channels you want, (go with Mono) and the sample rate.

I followed these steps in order, using Splatterhouse(1988, Namco) when I got to the final step, I decided that because the game came out in 1988, the digitized sound samples would be around 11025 Hz, (digitized voices, sounds and music at the time were much lower in terms of quality because of the low bitrate and/or due to the abilities of the sound hardware of the time, the highest bitrate that digitized voices/SFX/music in video games of the 80s-early 90s was probably around 22050 Hz, but that's just a wild guess)

I selected 11025 Hz and hit "OK"...but when I hit space to play the sound, the sound effects' pitch was way too high, I tried again, imported the same BIN file, but this time I selected 8000 Hz, still too high, 7000, still too high, then I tried 6000 Hz, and the digitized voices and sound effects seem to have the right pitch, but the problem is that the sound in general is not only really muffled, but also a bit scratchy and crackly in some places,

And the weird thing is is that the sound effects don't that problem in the actual game, they sound much clearer and the scratchiness is severely minimal,if it's even there.

I can only assume that the crackling heard in the raw data imports in Audacity is most likely the game's actual code stored in the BIN file, at least that's what I THINK it is, it might be something entirely different.

I've never been able to fix the issue, so if somebody knows how to fix the issue, Please let me know, I'd really appreciate it, I am trying to make them sound exactly the way they do in-game (play it in MAME or just watch a video of Splatterhouse arcade)

In case you're wondering what I have set for when I import the raw sound data into Audacity, here's what I have set up specifically for SplatterHouse Arcade:

(Keep in mind that the result of these settings will be the heavily muffled and scratchy quality I mentioned eariler)

ENCODING-[Unsigned 8-bit PCM]

BYTE ORDER-[Little-endian]

CHANNELS-[1 Channel (Mono)]
---------------------------
START OFFSET-[0] bytes

AMOUNT TO IMPORT-[100]%

SAMPLE RATE-[6000] Hz

Also, I've included a zip file containing 4 BIN files these files have all the digitized voices and sound effects from the Splatterhouse arcade game, these were taken directly from the parent ROM of the game, import any one of them into Audacity.

If you already have Splatterhouse for MAME, open up splatter.zip(parent rom) and look for these four BIN files:

sh_voi-0.bin
sh_voi-1.bin
sh_voi-2.bin
sh_voi-3.bin

Copy these files, pt them in a empty folder, them follow the steps I listed before

I will also upload a zip file containing M1, or "Multi-Platform Arcade Music/SFX Emulator" this forum will only allow me to upload one file at a time.



hydef
Reged: 04/10/16
Posts: 150
Send PM


Re: Problems with ripping digitized samples from arcade games new [Re: MoonTurtle]
#384258 - 11/12/19 09:39 PM


I'd be interested to know too, as I figured the same thing when trying to edit a sound file from Rave Racer to erase annoying announcers. I would import the bin file in Audacity and select 6000Hz as that seemed to be the right right pitch, but there was a ton of static in the sound file and unsurprisingly, when I saved it, it was static in MAME, so I figured something else was set to the wrong format but couldn't figure it out and went though each option.

You can ignore this part. In the end what worked for me was I just replaced the file with a blank one, which took out more a few more sounds than I wanted but somehow worked with no static.



MAME Artwork / Artwork Previews



MooglyGuy
Renegade MAME Dev
Reged: 09/01/05
Posts: 2261
Send PM


Re: Problems with ripping digitized samples from arcade games new [Re: MoonTurtle]
#384267 - 11/13/19 07:39 PM Attachment: hcastle_pcm.zip 138 KB (5 downloads)


Is this more like what you're looking for, quality-wise, regarding hcastle?



MoonTurtle
MAME Fan
Reged: 04/16/19
Posts: 3
Send PM


Re: Problems with ripping digitized samples from arcade games new [Re: MooglyGuy]
#384273 - 11/15/19 12:17 AM


Yes! that's exactly what I'm looking for! thank you!

How did you manage to rip/extract these?



MooglyGuy
Renegade MAME Dev
Reged: 09/01/05
Posts: 2261
Send PM


Re: Problems with ripping digitized samples from arcade games new [Re: MoonTurtle]
#384282 - 11/15/19 10:50 AM


> Yes! that's exactly what I'm looking for! thank you!
>
> How did you manage to rip/extract these?

Rather than trying to work out how to decode the samples myself, I let MAME do the heavy lifting for me. This is MAMEWorld, after all.

If you're able to compile your own build of MAME, then if you pull the latest code from our Github page, you'll have my changes which make extracting samples a cinch, as long as you can get the game to play them.

Once you have the code downloaded, throw open the following file, and change the value at this line from 0 to 1:

https://github.com/mamedev/mame/blob/master/src/devices/sound/k007232.cpp#L30

Then compile MAME. Any games using the K007232 sample-player chip will log out the samples being played as WAV files, tagged with the address in memory where the sample is located.



hydef
Reged: 04/10/16
Posts: 150
Send PM


Re: Problems with ripping digitized samples from arcade games new [Re: MooglyGuy]
#384288 - 11/16/19 07:00 PM


Hopefully it's not too much to ask and sorry OP for jumping in your topic again, but if one had the memory addresses of certain sound samples (I got this far), how do I stop them from playing?



MAME Artwork / Artwork Previews



MoonTurtle
MAME Fan
Reged: 04/16/19
Posts: 3
Send PM


Re: Problems with ripping digitized samples from arcade games new [Re: MooglyGuy]
#384399 - 11/26/19 06:06 PM


I've never really successfully compiled anything before, I've heard that MAME should be compiled with GCC, so I decided to go to SourceForge to get MAME properly compiled,

https://sourceforge.net/projects/tdm-gcc/files/latest/download

I haven't downloaded it yet, because I don't know if it's the version needed to compile MAME.

I previously installed "MSYS64" to try to compile the MAME source code however I have no idea how to use it.

I've always been a bit terrible about compiling anything, because it can easily go wrong, resulting in a buggy, compiled mess, I'm speaking from experience here, I've never compiled anything without it being glitchy or completely unusable.



MooglyGuy
Renegade MAME Dev
Reged: 09/01/05
Posts: 2261
Send PM


Re: Problems with ripping digitized samples from arcade games new [Re: MoonTurtle]
#384401 - 11/27/19 01:38 AM


> I haven't downloaded it yet, because I don't know if it's the version needed to
> compile MAME.

It's not. You just need to follow the instructions listed here. https://www.mamedev.org/tools/



Vas Crabb
BOFH
Reged: 12/13/05
Posts: 4462
Loc: Melbourne, Australia
Send PM


Re: Problems with ripping digitized samples from arcade games new [Re: MooglyGuy]
#384435 - 11/28/19 10:25 AM


> > I haven't downloaded it yet, because I don't know if it's the version needed to
> > compile MAME.
>
> It's not. You just need to follow the instructions listed here.
> https://www.mamedev.org/tools/

Yeah, we don't support building with tdm-gcc. In addition to that page with our custom MSYS64 package, we've also got documentation on compiling MAME here:
https://docs.mamedev.org/initialsetup/compilingmame.html



Heihachi_73
I am the Table!
Reged: 10/29/03
Posts: 1074
Loc: Melbourne, Australia
Send PM


Re: Problems with ripping digitized samples from arcade games new [Re: hydef]
#387427 - 08/09/20 03:50 PM


> I'd be interested to know too, as I figured the same thing when trying to edit a
> sound file from Rave Racer to erase annoying announcers. I would import the bin file
> in Audacity and select 6000Hz as that seemed to be the right right pitch, but there
> was a ton of static in the sound file and unsurprisingly, when I saved it, it was
> static in MAME, so I figured something else was set to the wrong format but couldn't
> figure it out and went though each option.
>
> You can ignore this part. In the end what worked for me was I just replaced the file
> with a blank one, which took out more a few more sounds than I wanted but somehow
> worked with no static.

Namco games sometimes have µlaw samples instead of plain PCM and may also need the bytes to be flipped in order to get anything useful out of them, otherwise it will sound distorted/garbled when loaded. Some games may even use a mix of µlaw and uncompressed PCM depending on the sound, I've noticed this with the Tekken games (S11/S12). If you open the Tekken 3 audio in Audacity you will notice that the µlaw sounds are very distorted when you load the ROM in that format. If you flip the bytes of the entire ROM (e.g. in a hex editor) the sounds will play properly. That said, some things still sound like garbage because of the low frequency (if anything the Namco sound hardware probably has something like a low pass filter to make it marginally better).

On a side note, Audacity is not the best way to edit sound ROMs, it slightly modifies/corrupts the data when either loading or saving the file (not sure which, unless it affects both) - you'll see what I mean when you load them side by side in a hex editor. If it isn't Audacity itself doing it, it's the encoder being used ("other compressed files" -> Unsigned 8-bit PCM). I'm using version 2.0.6 on this PC, no idea if it's been fixed in later versions or if the same thing still happens. You should always load and save as unsigned data when editing ROMs otherwise values like 00/FF or 7F/80 can switch around; this is not what Audacity is doing - the data is all over the place when saving regardless of what you do.

My old (and now dead) PC used to have an ancient version of Cool Edit Pro (I know, closed source commercial crap) but this program did not corrupt data unless you deliberately saved in a lossy format or used signed data.


Pages: 1

MAMEWorld >> Programming
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Pi 
0 registered and 59 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 2088