Permute notation in latex documents

This week, I was having a coffee with Petra and Immanuel and we were discussing the importance of good notation.

Somehow, the idea of writing a script that permutes the notation in a given document came up, perhaps to illustrate this viewpoint.

It sounded like a fun project, and so I wrote permute_notation.py, a short Python script that takes a latex file and produces a copy of the file with completely permuted notation. The effects are not really surprising: usually, you do not understand your own work anymore :)

You can download it and try for yourself. It is quite simple to use: permute_notation.py input.tex output.tex

Attention: The script unconditionally overwrites output.tex, so be careful!

By default, the script permutes lower and upper case Latin and Greek letters. You can specify the switch -s to permute alphabets only among themselves, such that the text might remain at least barely legible.

As usual, the script is provided under the GPL.

Note: This script has been tested to work with my diploma thesis(result (PDF)). I hope that it will also work with your document. If not, just copy a latex snippet which is permuted incorrectly into the comments and I will take care of it.

Running mp3gain recursively in album mode

If you are running linux and want to assign replay gain values to your mp3s recursively, you are currently out of luck since mp3gain does not yet have a recursive mode. The simple solution

find /path/to/mp3s -iname "*.mp3" -exec mp3gain -r -k -p {} \;

only works if you want to have radio gain mode, i.e. all mp3s are brought to uniform common volume.

But if you are like me and you would like to listen to whole albums at a time, the -a switch is your friend and the above solution does no longer work. I have written two small python scripts which do this, assuming your mp3s are sorted either like this:

artist/single_song.mp3
artist/album/song.mp3

Then you can use calculate_gain_all_in_one_folder.py. If instead your artists are grouped by initials like so:

initial/artist/single_song.mp3
initial/artist/album/song.mp3

then use calculate_gain_for_initial_folders.py. Both scripts do the right thing, i.e. apply album gain to albums and radio gain to single songs. They are not exactly userfriendly, but you should manage. Both scripts are released under the GPL.

By the way, vorbisgain has a recursive mode which works (almost) perfectly (only almost, since it of course does not known when to apply album and when to apply radio gain).