Introduction
Suppose you have some music on a CD or an online streaming source that you want to copy to your computer for personal listening. Do not infringe copyright by pirating music and sharing it! There are many tools to do this including VLC. What’s not very clear in VLC is how to rebalance the bass and the treble in the music during the streaming process, if say the bass was a bit soft and you wanted to give it a boost. This article tells you how to do that and introduces a simple Bash script to facilitate ripping your CD collection. This article assumes a Linux-type environment, but Windows users should be able to adapt the commands to Windows with a little bit of research.
The VLC Graphical Equaliser
Play your CD and adjust the equaliser settings in the VLC equaliser until your mix is satisfactory. Find this by pressing Ctrl+E
or going to the Tools menu -> Effects and Filters. When you have found the equaliser settings that you want, such as is shown in the screenshot below, the question is: how do you translate these into a command that will work when you stream the file? It is not simple enough to save these settings, quit VLC, then run a script, since that will not work. When you have found the settings you want, write down on the numbers for the Preamp and the frequency bands, including those you left at 0, and get ready to use them on the command line.
The VLC Command Line Equaliser
Here is an example of how to invoke VLC from the command line to equalise a stream to a file called 1.wav
. VLC is capable of saving to compressed formats such as .mp3
and .m4a
, however there are other free tools that can do that also, and which provide convenient ways to set the data tags. This example streams from a CD but VLC can accept other input sources.
The three most important options to note are the --equalizer-preamp
, the --equalizer-bands
, which has ten numbers (integers or decimals) separated by spaces, and the --sout
option, which contains the essential afilter=equalizer
argument, which actually inserts your equaliser settings into the transcoding chain. Without this last option your equaliser settings will be ineffective.
vlc -I dummy cdda:///dev/cdrom \
--cdda-track=1 \
--equalizer-preamp=15.0 \
--equalizer-bands="12 9 5.5 0 0 0 0 0 0 0" \
--sout=#transcode\{afilter=equalizer,acodec=s16l,channels=2,ab=128,samplerate=44100\}:standard\{access=file,mux=wav,dst="1.wav"\} \
vlc://quit
Converting a whole disk
Now that you have the example command, let’s put the command into a script so that you can conveniently convert a whole CD without a lot of retyping. We will parameterise the track number and the name of the output file, but not the equaliser settings. If you need custom equaliser settings for every track, then by adapting this example you can parameterise the equaliser also. This script uses the FAAC encoder to save the .wav
file to .m4a
.
#!/bin/bash
album="The title of the album"
artist="The default name of the artist, band, orchestra, etc"
function ripIt() {
local index=$1;
local title=$2;
local artist=${3:-${artist}};
local album=${album};
vlc -I dummy cdda:///dev/cdrom \
--cdda-track=${index} \
--equalizer-preamp=15.0 \
--equalizer-bands="12 9 5.5 0 0 0 0 0 0 0" \
--sout=#transcode\{afilter=equalizer,acodec=s16l,channels=2,ab=128,samplerate=44100\}:standard\{access=file,mux=wav,dst="${index}.wav"\} \
vlc://quit
faac -b 128 --joint=1 \
--artist="${artist}" \
--title="${title}" \
--track="${index}" \
--album="${album}" \
"${index}.wav" \
-o "${title}.m4a"
rm "${index}.wav"
}
ripIt 1 "Title of first track"
ripIt 2 "Title of second track" "Optional artist name overrides the default"
ripIt 3 "Title of third track"
ripIt 4 "Title of fourth track"
...
That’s it! In the example above I added line breaks for clarity; if you get errors then you might need to remove them.
Acknowledgements
The author acknowledges the traditional custodians of the Daruk and the
Eora People and pays respect to the Elders past and present.
VLC® is a registered trademark of the VideoLAN non-profit organisation.