Short: Bugfixed, Hi-Fi mpega.library Author: Jan Zahurancik, based on work by S. Skjaeret and G. Steger Uploader: amikit amiga sk (Jan Zahurancik) Type: util/libs Version: 3.1 Requires: 68020 or faster CPU, no FPU needed Architecture: m68k-amigaos >= 3.0 A new version of mpega.library by Jan Zahurancik, based on S. Skjaeret's & G. Steger's libmad edition of mpega.library (https://aminet.net/util/libs/mpega_libmad.lha) for AmigaOS 3 (68020). It decodes MPEG audio (layers I, II and III) with libmad. Programs that use mpega.library (AmigaAMP, AMPlifier, TKPlayer, ...) work unchanged: just replace the library. VERSION 3 COMES IN THREE FLAVOURS: - -bugfix (mpega.library-bugfix): the original decoder, just fixed. It no longer crashes or freezes where the old one did: with some players (those that give it little memory to work in), on MP3s with a loudness (ReplayGain) tag, on damaged files. Music streamed from the network plays to the end. Every track plays to its very last note. Mono keeps both channels. Jumping within a track lands where you asked. Very loud MP3s (made louder with MP3Gain, say) still crackle, as they always did; -hifi plays them. - -hifi (mpega.library-hifi): every fix of -bugfix, and on top of that it calculates with much higher precision, so the music comes out cleaner, and MP3s that were made louder than a CD allows still play without crackle. It needs about 1.5 times the CPU of -bugfix on a real Amiga (2 to 3 times in emulation, where there is CPU to spare), and it follows the player's settings (quality, frequency, mono, volume, loudness tag). - -hifi-forced (mpega.library-hifi-forced): the -hifi decoder, always at the highest quality. Some players ask for lower quality or a lower sample rate to save CPU; this one ignores that, and it ignores the loudness tag, so you always hear the file as it was made. Volume and mono still work. It also plays through small errors in a file instead of stopping. For fast Amigas and emulation. All three flavours contain every fix; they differ only in how they decode. INSTALLATION Requires AmigaOS 3 and a 68020 or faster CPU. Well, rather faster one, definitely. No FPU required. 1. Copy your preferred flavour (see above) to LIBS:mpega.library, replacing the old one (keep a backup if you like). 2. Reboot, or quit your player and run Avail FLUSH so that the new library is loaded. Nothing to configure: your player and AHI settings stay as they are. version LIBS:mpega.library shows which flavour is installed, e.g. [020] [Hi-Fi] [64bit]. SPEED CPU needed to play an ordinary 128 kb/s stereo MP3 at full quality; above 100 % the music stutters. - 68020: measured (in WinUAE with exact timing, scaled to the clock). A 68030 at the same clock does a little better. - 68040 and 68060: estimated; the real numbers are, if anything, lower. CPU 2004 original 2026 -bugfix 2026 -hifi 68020 at 50 MHz 370 % 370 % 550 % measured 68040 at 40 MHz 80 % 80 % 115 % estimated 68060 at 50 MHz 40 % 40 % 60 % estimated - On a real Amiga -bugfix is as fast as the original. - In emulation (measured in WinUAE) -bugfix is up to 25 % faster than the original. - On a 68020 or 68030 your player lowers the quality or the sample rate, as it always did, and -bugfix and -hifi go along with it. - In emulation there is CPU to spare: take -hifi there. ACCURACY - Four full tracks were decoded with -hifi and compared, sample by sample, with ffmpeg, the decoder most computers use. - The output never differs by more than one step of the 65 536 a 16-bit output has, before the dither it adds on purpose (a trace of noise, as on every CD); far below anything you can hear. - Every track plays to its very last note; the 2004 original cuts the end of each one short. - Also tested with the players above, two of them playing at once. AmiKit X13 theme variable bitrate, 48 kHz: matches AmiKit X13 theme (remix) variable bitrate, 48 kHz, very loud: matches Sundial Aeon - Startup Sequence 320 kb/s, with a loudness tag: matches The Future Sound of London - Smokin Japanese Babe 128 kb/s, the usual kind: matches WHAT WAS FIXED All three flavours carry the same two dozen fixes to the 2004 libmad clone. The ones you were most likely to run into: - It crashed with players that give it little memory to work in. - Music from the network, a pipe, the serial port or a CD stopped after a few seconds. It now plays to the end. - Every track lost its last fraction of a second, and the shown length was a little short. - Mono dropped the right channel. Both channels are now mixed. - Jumping to a point under one second restarted the track, and jumping into some files failed on perfectly good audio. - Files under 2 KB would not open, and some tags corrupted memory. - MP3s with a loudness (ReplayGain) tag froze the whole machine. The tag now works. - A file ending in an old-style (ID3v1) tag reported an error instead of a clean end. - Two players can play at the same time. - Damaged or hostile files fail cleanly instead of crashing (the 2017 libmad security fixes). Good files play exactly as before. The full list is under HISTORY below. CREDITS These authors had no part in this version: - Stephane Tavenard: the original mpega.library (1999) - Sigbjorn Skjaeret (CISC): the libmad-based clone (2004) - Robert Leslie: libmad - Jarmo Laakkonen: WarpOS version (2004) - Stephan Rupprecht: OS4 version (2004) - Georg Steger: AROS i386 port (2006) THANKS To Midwan, for the initial analysis of the first builds and his suggestions, which set the direction of the whole effort, to Philipp Lonke and Falcon_11, for beta testing, and others who helped make this happen. LICENSE Licensed under the GNU GPL v2 (because libmad is GPL), see COPYING. Applications using this library must be GPL too. The complete source is on GitHub: https://github.com/AmiKit/mpega_library_3 HISTORY Version 3.1 - Jumping around in a track no longer gives a short burst of noise right after the jump. The decoder used to play a few leftover scraps from where you had been before. - Tracks cut from a longer recording, and internet radio streams, no longer start with a short burst of noise or an error. - MP3s with a small ID3 tag now show the right length, and jumping in them lands where you asked. - Volume control and ReplayGain now work at low and medium quality too. Before, the library quietly ignored them unless the player asked for high quality. - The -bugfix flavour no longer crackles on loud passages when the volume is turned up high or ReplayGain boosts a quiet track; it clips cleanly instead. - At 100 % volume the library no longer runs its volume code on every sample when there is nothing to change (no ReplayGain in the file), which saves CPU time. - MP3s with a broken VBR header no longer show a length of 0:00, and seeking in them no longer jumps straight to the end. - Streams that switch from mono to stereo (a mono jingle before a stereo song, for example) no longer play the stereo part at double speed when the player uses different settings for mono and stereo. - At low quality, the library now always respects the highest playback rate the player asks for. - Jumping in VBR MP3s without a seek table now lands close to where you asked. A quiet start used to send the jump far too early. - MP3s with two tags in front (some taggers put a new one before the old one) now open. Before, a big second tag, such as cover art, stopped them from opening. - When a player streams a file, its length now comes out right even with cover art in front, and a stream of unknown size no longer shows a length of about 74 hours. - If a read fails for a moment, such as a network hiccup, playback carries on from the right place instead of playing a scrap of old audio, also right after a jump. - Players that open files without checking them first now play files with some junk in front, or whose first read fails, instead of stopping with an error. - Opening a track takes a little less time on slow Amigas. - A track that ends in an ID3v1 tag now ends cleanly also when the player streams it in small pieces (network, PIPE:). Before, it sometimes ended with an error, depending on where the last piece cut the tag. - Two MP3s joined into one file (an audiobook or a mix made with cat, for example) now play to the end. Before, a player that stops on an error stopped after the first part. - Jumping past the end of a track without a seek table now reports the time it reached (the end), not the one asked for. - MP3s that decode louder than full scale (a loud track made louder with MP3Gain, for example) no longer crackle in the Hi-Fi flavours: they clip cleanly up to about three times full scale. Before, from about twice full scale, loud samples wrapped around. -bugfix keeps the original limit of about twice full scale. - The Hi-Fi flavours are much faster, with the same accuracy: 2 to 3 times as fast as 3.0 in emulation, and about 20 % fewer CPU cycles on a 68020. -bugfix is unchanged. Version 3.0 (25 July 2026, shipped only with AmiKit X13.1) - Three flavours from one source tree: -bugfix (the original speed-optimized decode), -hifi (a full-precision decode that still follows the player's settings) and -hifi-forced (always the highest quality). - -bugfix decodes as fast as the 2004 mpega.library 2.4 (faster in emulation). - Players with a small stack (the AmigaDOS default is 4000 bytes) no longer crash the library. - Streams read in short pieces (network, PIPE:, serial, CD) now play to the end. Before, they stopped almost at once. - Every track now plays its last fraction of a second, and its length is no longer one frame short. - Mono now mixes both channels. Before, the right channel was thrown away. - Jumps now land on the exact position, not on a whole second. A jump within the first second used to restart the track. - Jumping into the middle of some files no longer reports an error on intact audio. - Files under 2 KB now open, and some ID3v2 tag sizes no longer corrupt memory. - MP3s with a LAME ReplayGain tag no longer freeze the whole machine. ReplayGain works on a 68020 for the first time. - A file that ends in an ID3v1 tag now ends cleanly instead of with an error. - Two players can decode at the same time. - Damaged or hostile MP1, MP2 and MP3 files can no longer make the decoder read past the end of a frame (the 2017 libmad vulnerabilities CVE-2017-8372, 8373 and 8374).