Rip PCM samples from Roms?
Rip PCM samples from Roms?
Hello!
First post! Long time lurker and noob. I'm curious if theres any software out there that extracts samples from game boy roms?
The way Ive done it is that Ive imported the rom as raw audio into an audio editor (sony sound forge, audacity etc..) and located the samples.
The downside is that I'm not sure how to determine what sample rate the samples are supposed to be in. I usually set it to somewhere between 4000Hz - 8000Hz and 8-bit unsigned.
It doesn't work that well with all games, often the samples sound extremely bad and almost unrecognizable.
Anyone have any ideas?
Thanks in advance!
// catsup
First post! Long time lurker and noob. I'm curious if theres any software out there that extracts samples from game boy roms?
The way Ive done it is that Ive imported the rom as raw audio into an audio editor (sony sound forge, audacity etc..) and located the samples.
The downside is that I'm not sure how to determine what sample rate the samples are supposed to be in. I usually set it to somewhere between 4000Hz - 8000Hz and 8-bit unsigned.
It doesn't work that well with all games, often the samples sound extremely bad and almost unrecognizable.
Anyone have any ideas?
Thanks in advance!
// catsup
Thanks for your quick response!
The reason I'm setting it to 8-bits is that sound forge doesn't seem to go any lower.
The reason I'm setting it to 8-bits is that sound forge doesn't seem to go any lower.
Stupid question maybe but is this ripper exclusively for NES games or would it work with any file containing that specific data?tepples wrote:A couple old NES games used this same format, for which I made a ripper a long time ago when REing Skate or Die 2.
If you treat the ROM as an 8-bit unsigned sample, you'll be able to hear any 4-bit samples just fine. You'll miss every other sample, but that just has the effect of halving the sampling rate. Try playing it at 44.1 kHz to locate samples, then experiment with lower rates for each sample you find. Once you do that, you can do some more advanced extraction to get the missing samples that treating it as 8-bit skips.
System requirements: 2.6 snakes on a plane
Save the following as nibbledecode.py
Save the following as nibbledecode.py
Code: Select all
#!/usr/bin/env python
"""
nibbledecode
Use this to convert the samples in e.g. Skate or Die 2 for NES or
any of several Game Boy games to wave format for other apps to use.
In Windows, save it as nibbledecode.py and drag raw files onto it.
Limitations: Master System/Game Gear nonlinear samples are not
supported.
(See copyright notice in versionMsg below.)
"""
from __future__ import with_statement, division
from contextlib import closing
usageMsg = "usage: %prog [options] infile.4bl [outfile.wav]"
descriptionMsg = """Expands 4-bit-per-sample linear PCM to an 8-bit wave file."""
versionMsg = """%prog 0.01
Copyright 2010 Damian Yerrick
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without any warranty.
"""
def expand4bit(src, little=False, signed=False):
import array
dst = array.array('B')
xorData = 0x88 if signed else 0x08
for byte in src:
byte = ord(byte)
s1 = (byte & 0xF0)
s2 = (byte & 0x0F) << 4
if little:
s2, s1 = s1, s2
dst.append(s1 ^ xorData)
dst.append(s2 ^ xorData)
return dst.tostring()
def main(argv=None):
from optparse import OptionParser
import wave
if argv is None:
import sys
argv = sys.argv
parser = OptionParser(usage=usageMsg, description=descriptionMsg,
version=versionMsg)
parser.add_option('-l', '--little', dest='little',
default=False, action='store_true',
help='use low nibble first')
parser.add_option('-s', '--signed', dest='signed',
default=False, action='store_true',
help='decode samples as signed nibbles')
(options, args) = parser.parse_args(argv[1:])
if len(args) not in (1, 2):
parser.error("wrong number of arguments; try with --help")
with open(args[0], 'rb') as infp:
data = infp.read()
data = expand4bit(data, little=options.little, signed=options.signed)
outfilename = args[1] if len(args) > 1 else args[0] + '.wav'
with closing(wave.open(outfilename, 'wb')) as outfp:
outfp.setnchannels(1)
outfp.setframerate(8372)
outfp.setsampwidth(1)
outfp.writeframes(data)
if __name__=='__main__':
main()
Re: Rip PCM samples from Roms?
i want to rip pcm samples from mame roms and such but dont know how need answers
Re: Rip PCM samples from Roms?
First step is to just load a file into Goldwave or something and see if you can hear anything using standard uncompressed audio (8 bit unsigned).
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!