QUOTE(esight @ Oct 10 2006, 18:16)

I test for success by playing back the MP3 combined result, as the gap is audibly ostensible.
The weird part is that when I play my three MP3 files through ITunes in succession, the three sound seamless. So ITunes is apparently doing it right. It also plays back seamless with ProTools.
I have downloaded several MP3 "joiners" or "mergers" over the past days, and they are generating a non-seamless result as well.
How can knowledge on how to do this be so elusive? I wish someone could provide me document specifications on how to do this seemingly simple operation. I need to merge MP3 files seamlessly, that's all I care about.
Aha!
As Jaz has just mentioned,
MP3 is not a gapless format, instrinsically for two reasons:
- encoder padding or delay
- block/frame length (576 or 1152 samples) different to audio CD frame lengh (588 samples)
The LAME encoder stores the information on padding and accurate track length in the LAME header, allowing decoders that recognise this extra info (like foobar2000 or lame itself, when used as a decoder) to produce true gapless playback when separate files are played, but preserve gaps that were there on the original CD.
Other attempts to make gapless playback from a list of separate MP3 files simply try to detect and eliminate silence or sounds so quiet they're assumed to be silent, and possibly smooth over the join in some way. That's possibly what iTunes is doing when there's no accurate length data in the files.
Programs like mp3DirectCut can be used to join MP3 files without decoding and re-encoding (transcoding is detrimental to quality), but you'll again find gaps and need to delete one or two frames from near the join point. I've tried this on a few files from a DJ-mixed album encoded by FhG fastenc and the results were satisfactory, albeit a slightly imperfect reconstruction of the original CD rhythm/timing.
If you're prepared to use Java to analyze the files, remove tags and perhaps discard certain frames near the join as a matter of course, you might get a more gapless-sounding result. You'd need to get to grips with the MP3 frame format to identify the appropriate boundaries and any tags that need elimination.
Using any gapless format (including PCM WAV files) then converting to MP3 would work perfectly, assuming of course that all the music is at the same sample rate and mode (e.g. 44.1 kHz, stereo like a CD). For a WAV, you cannot simply concatenate, but need to remove the RIFF header on the second file. You can search for the specifications, but I think it's always a constant number of bytes.
You should note that the WAV format is a generic container for audio, so some WAV files can contain embedded MP3 files or ADPCM encoded audio (a simple encoding used widely in Windows system sounds, particularly early versions like Windows 95 and Windows 3.1). We sloppily use WAV in the most common sense, to denote PCM, and in particular 44.1 kHz stereo 16-bit per channel PCM, which you get by ripping an audio CD.
Depending on how robust your Java software should be, you might want to check the RIFF header to ensure that each WAV you concatenate is PCM, perhaps to check that it's 44.1 kHz stereo 16-bit PCM and otherwise report an error.
An alternative to WAV is to create a RAW file, which contains only the PCM data with no header or footer to explain the sample rate, the bit-depth (e.g. 16-bit) the stereo mode or which channel comes first. Many audio editors can output RAW format. Assuming they have the same sample rate, bit depth and byte order, two RAW files may be concatenated directly, the way you're doing it now. The LAME encoder can accept RAW input, but you should tell it using commandline switches such as -r (to say it's a RAW PCM file) and, if neccessary, to override the default sampling frequency, byte-order and bitwidth (see lame --longhelp).