Tag Archives: Shell

Merging mp3 files

Sometimes things are easier than ones might have thought. I wanted to merge some mp3 files in the shell and found that this can simply be done using cat.

$ cat my_file_1.mp3 my_file_2.mp3 my_file_3.mp3 > combined_files.mp3

Forgiving players like mplayer can handle the resulting files without any issue. Still, it’s recommended to fix the file header e.g. using avconv.

$ avconv -i combined_files.mp3 -acodec copy combined_files_fixed.mp3

A script to speed up mp3 files

Have you ever tried to listen to podcasts or videos at increased speed to save time? Actually this usually works out quite well with a speed factor of 1.5 or so. You can do this using mplayer:

$ mplayer  -af scaletempo -speed 1.5 <FILENAME>

This will run the file with higher speed without increasing the pitch (so no Mickey Mouse voices 🙂 ). Use “[” or “]” to decrease or increase the speed. It is a good solution that can be used on a PC/Mac but if you have a mp3 player device with fixed firmware like me you cannot do this there. So I created a small script (gist at github) that uses mpg321, SoX and lame to generate mp3 files which I copy afterwards to the device.

Run the script with one or more mp3 files:

$ speedupmp3.sh <FILENAME(S)>


$ speedupmp3.sh test1.mp3 test2.mp3 test3.mp3
[...] # Some output
$ ls

Add an icon short cut for a shell script to the Favorites in Ubuntu netbook edition

The latest Ubuntu netbook edition (10.4) is organized in different workingspace (I am not sure what is the official expression for it) like “Favorites”, “Accessoires ” and “System”. I wanted to add an icon to the “Favorites” section to run a shell script that performs a backup. This can be done the following way:

  • Go to the “System” workspace and open “Main Menu”.
  • In there create new item e.g. in “Accessoires”.
  • Give it a proper name like “Backup” or whatever your script does.
  • Fill the “Command” field with something like “gnome-terminal -e ‘~/bin/my_backup_script.sh'”. (Please read the gnome-terminal manual if cannot guess what this does – “man gnome-terminal”)
  • If you want you can also explain the script in the command field.
  • To save and finish click “Okay”.
  • Now you have created a new short cut. So go to “Accessoires” where the new icon should be found.
  • If you hover the mouse over the icon a “+” symbol should become visible. If you click that sympbol the icon is added to your Favorites.
  • Done