Using l3enc in 2020...

In the 2020s there is indeed a plethora of codecs available at no cost to the modern computer / tablet / smartphone user so why bother with l3enc, a shareware mp3 encoder that rose and fell in the 90s? The simple answer is that l3enc was at the centre of an exciting time, a time where ordinary users could start experimenting with encoding sound on their personal computers, carry the sound around on portable devices, make their own highly pesonalised mixes and even share their music files with others via file sharing services such as Napster. A time of revolution!

And, Gentle Reader, with a bit of massaging l3enc can still produce mp3 files on a modern computer in 2020. Not so much for playback any more as there are far better mp3 encoders available but just we can look back, even briefly, to the dawn of the revolution and to a time where the Internet itself was only just starting to be widely used...

Installation...

Finding l3enc itself these days is not the easiest although some reliable sites still hold versions on the archive. I have put a copy on my own web site and instructions below will download from this web site and then install l3enc to $HOME/bin:

wget http://andrews-corner.org/downloads/l3enc272.linux.tar.gz
tar -xvf l3enc272.linux.tar.gz --show-transformed-names --strip=1 -C $HOME/bin l3v272.linux/{l3enc,l3dec}

If only it was all that easy! This is a binary with links to some very old libraries and it will not run without them. A very clued up Slackware user gave me the guidance required to install these old libraries in a way that is reasonably safe for a modern system. First download the libraries from a truly ancient Slackware version:

wget http://slackware.cs.utah.edu/pub/slackware/slackware-4.0/slakware/d1/libc.tgz
wget http://slackware.cs.utah.edu/pub/slackware/slackware-4.0/slakware/a7/ldso.tgz

Yes, Slackware 4.0! Now install the needed files only from these archives to a safe location:

mkdir -pv /opt/oldlibs
tar -xvf libc.tgz --transform='s|.newlib||' --show-transformed-names \
    --strip=1 -C /opt/oldlibs lib/{libc.so.5.4.46.newlib,libm.so.5.0.9.newlib}
tar -xvf ldso.tgz --show-transformed-names \
    --strip=1 -C /opt/oldlibs lib/ld-linux.so.1.9.9

In /opt these ancient libraries will not be found by most compilers or applications on a modern system, and certainly not on mine which by default does not include /opt in the $PATH. But of course l3enc cannot find these required libraries either. The following links are therefore required:

ln -sv /opt/oldlibs/libc.so.5.4.46 /usr/lib/libc.so.5 && \
ln -sv /opt/oldlibs/libm.so.5.0.9 /usr/lib/libm.so.5 && \
ln -sv /opt/oldlibs/ld-linux.so.1.9.9 /lib/ld-linux.so.1

If all is well l3enc will then roar into life. However this is the shareware version and has a few limitations built into it. In the day you could buy a licence that would remove these limitations for about $250 but despite my best efforts I could not buy any licence from Fraunhofer. So I used a serial number eaily found online and the limitations then disappeared, I would be happy to do the right thing and purchase a legal licence if that is still possible? I notice that the serial number does not appear to 'stick' and needs to be reapplied from time to time and I am keen to find a fix for that...

In between usage or experimentation with l3enc I personally remove the symlinks given above to keep such older libraries shielded from my system. As I mentioned before I have a system which does not include /opt in the $PATH, make sure and check if this is true of your own system as well.The simple syntax to remove the symlinks is:

rm -v /usr/lib/{libc.so.5,libm.so.5} /lib/ld-linux.so.1

And with the actual libraries 'hidden' in /opt your system should now be as it was with the libraries easily made available for l3enc by recreating the links when needed. But now to actually use l3enc!

Commandline usage...

To demonstrate the commandline usage of l3enc I will use my favourite wav file and perhaps you should also download it? With l3enc there is reasonably comprehensive guidance available directly from the command line and I give this below:

andrew@ilium~$ l3enc -h
****  L3ENC V2.72 ISO/MPEG Audio Layer 3 Software Only Encoder   ***
|                                                                  |
|             copyright Fraunhofer-IIS 1994, 1995, 1996            |
|                                                                  |

usage:    l3enc <time-signal file> <bitstream file> -switches

switches:   -h display this help message
            -h <switch> displays more help for <switch> if available (*)
            -f <filename> read arguments from file

 -br   xxx * total bitrate, 8000<=bitrate<=256000    def.: 112000
 -dm       * downmix stereo to mono                  def.: off
 -hq         highest quality, reduced speed          def.: no
 -crc      * enable MPEG1/2 crc check                def.: off
 -anc  xxx * <file-name><rate> 
 -sr   xxx * sampling rate of the input file         def.: 44100
 -spch       best quality for speech signal          def.: no
 -tfs        swap input time file                    def.: no
 -tfc  xxx   specifies channels in time signal file  def.: 2
 -mod  xxx   (obsolete)
 -esr  xxx   (obsolete)
andrew@ilium~$ 

Note that extra details are available for those options that have an asterisk against them. So to see details of the available bitrates, for example, you can run l3enc -h -br and all of the supported bitrates will then be seen. Now I saw 192000 in there so a simple command line would be:

l3enc luckynight.wav test.mp3 -br 192000 -hq -crc

I confess that I had a small thrill the first time that I ran that command line and then sat back and listened to the output, it was as if I had stepped into a time machine back to the 90s! So of course two more limitations become immediately obvious: Constant Bitrate (CBR) only and no facility to add meta data. Well we are stuck with CBR but my best friend eyeD3 can help with the meta tags:

l3enc luckynight.wav test.mp3 -br 192000 -hq -crc && \
eyeD3 --album "Treasure Quest Soundtrack" \
      --album-artist "Jody Marie Gnant" \
      --track 9 \
      --title "Lucky Night" \
      --genre "Soundtrack" \
      --release-year "1995" \
      --comment "l3enc lives..." \
      test.mp3

And there is the file, neatly tagged, playing nicely in the background and the grandfather of mp3 encoding has been coaxed back into life in 2020!