Hardware Reference
In-Depth Information
MP3 technology patents
In some countries, there are legal uncertainties around the distribution
of MP3 encoder and player binaries. This is a problem, not only for
the developers of free audio software, but it affects you too as an end
user and you'll often have to obtain the binaries in question from
alternative sources.
Creating command shortcuts with aliases
You're likely getting tired of typing those never-ending
sox
commands by now.
Fortunately, there's a feature built-in to the bash shell named
alias
that allows us to
create convenient shortcuts for commands we'd like to avoid typing over and over
again. Shortcuts are created as follows:
1.
Type in the following command to create an alias named
record
that will
start a
sox
recording and output to an MP3 file that you'll specify when you
use the shortcut:
pi@raspberrypi ~ $ alias record='sox -t alsa plughw:1 -t wav - |
lame -'
Now all you have to do to start recording to the
newrec.mp3
file is type in the
following:
pi@raspberrypi ~ $ record newrec.mp3
To view a list of all currently defined aliases, use the following command:
pi@raspberrypi ~ $ alias
2.
As you can see, there are four default aliases added already by Raspbian.
Should you wish to modify your alias, just create it again with the
alias
command and provide a new definition, or use the
unalias
command to
remove it altogether.
3.
Now there's only one problem with your nifty shortcut—it will disappear
as soon as you reboot the Pi. To make it permanent, we will add it to a
file named
.bash_aliases
in your home directory. The initial dot in the
filename makes the file
hidden
from the normal
ls
file listing; you'll have to
use
ls -a
to see it. This file will then be read every time you log in, and your
alias is recreated.
4.
Start the
nano
text editor and edit the
.bash_aliases
file using the
following command:
pi@raspberrypi ~ $ nano ~/.bash_aliases