Because voltron asked for it:
Component name - foo_brr
Component type (appropriate section) - Input, disk writer
Which foobar2000 version the component works with - 0.5
Author name and e-mail address (and tell me if you want your e-mail address to be published) - kode54 chris (at) kode54.tk
Description of the component - Plays and writes SNES and PSX ADPCM formats. Mono forms are identical to what the system uses, stereo is nibble interleaved so won't work too well for that purpose. Files contain a small header with flags, frequency, length, optional loop point (not supported by writer), and optional no-loop bit. Don't expect perfect performance, it tends to break on really loud files, or "problem" samples such as udial.wav. Encoding greater than 2 channels is possible, but the decoder isn't designed to handle it. Encoder originally created just to provide a means to produce samples for SNES game hacks, but later expanded into a Linux player/encoder set, now into this plug-in. Later added PSX ADPCM capability, which seems to be more robust as well, as I don't know the system's clipping behavior, so I just wing it and do normal 16 bit clipping, so it's a little more tolerant than the SNES CODEC.
Plug-in only has decoder configuration. The encoder will use whichever format you choose from the disk writer panel, converting from the 32 bit float to 16 bit signed integer samples with dithering, using the player's internal downsampling function. See:
cvt_float_to_linear.h from the SDK.
If you experience noise, try feeding the input through the preamp plug-in and attenuating a few dB below what the file's ReplayGain correction level specifies. (ie. RG says -5.71 dB, so Preamp to -7 dB or so. I suggest you also load the resulting file, remove RG info and rescan, as the original file's tags are copied to it, along with the original RG info.)
TECH INFO: Header signature is 0x42, 0x52, 0x52, 0x1A ("BRR\32"), all fields that follow are variable length, similar to MIDI. Value is data & 0x7F, if MSB is set, shift up by 7 and add the next value, repeat. First field is flags, where 1 is stereo, 2 means rate is specified, 4 means length of audio stream is specified, 8 means loop point is specified, 16 means stream is PSX format, 32 means do not loop, the rest are still undefined. The next field is rate, only if rate bit is set. Then length and then loop, also only of their bits are set. The rest of the file is the audio stream, with end bit set on the last block. Then for the hell of it, I write an APEv2 tag onto the file, only in this plug-in.
You can find the SNES ADPCM format by ripping apart SNES9x, ZSNES, or libopenspc. You can find the PSX ADPCM format by ripping apart spu.c from the P.E.Op.S. SPU source code.
Bears no warranty, no guarantee of actually serving a real purpose. I just wrote it because I can. Although, there are several PSX games with nice music in the SPU's ADPCM format, rather than XA. The reason for this is usually because XA is limited to 18900Hz and 37800Hz, while the ADPCM can be up to 44100Hz. (Or higher, but the SPU doesn't generate a higher output, so it's pointless.)
I've already produced a simple converter for Common\STAFF.BIN from Megaman Legends 2, which contains the audio stream for the staff roll music, as well as the bitmaps of the credits themselves, interleaved for proper presentation timing. Timed by the music decoding, you can observe that the credits don't play any faster or slower, regardless of the current FPS. You can disable frame limiting and and they will still run smoothly. (In my case, 122FPS or so, no effect.)
I've also manually ripped some tracks from a few games, but this required game specific hacks to P.E.Op.S. SPU, and then further hand editing for the resulting files.
Meh, enjoy, or don't. I didn't make this plug-in for anyone else, so don't complain if it causes your computer to spontaneously combust or sends your significant other to the cornfields.
Compile date - 2/20/2003
Download link -
foo_brr.zipAuthor website link -
For now, just my home page. Organized list of plug-ins coming soon, maybe.Screenshot link or send me screenshot - N/A