The Lumber Room

"Consign them to dust and damp by way of preserving them"

Posts Tagged ‘compknow

mplayer: changing speed without changing pitch (avoiding the chipmunk effect)

leave a comment »

In mplayer, you can change the playback speed with [ or ], but that probably changes the pitch as well (naturally). Can be amusing the first time, but not after you realise that it is actually possible to do something sophisticated to avoid this. (Wikipedia calls it Audio timescale-pitch modification) Many other media players (including VLC and even Windows Media Player(?)) can do this automatically; here’s how to do it in mplayer.

Short answer:

Start mplayer as mplayer -af scaletempo
That’s it. The catch is that you need to get an mplayer which has the scaletempo filter, and we know how much the mplayer project loves making releases. (It’s not in Ubuntu at the time of writing.)

So, either

Get such an mplayer
e.g the deb from Sourceforge (here),

or

Start mplayer as mplayer -speed 1.5 -af ladspa=tap_pitch:tap_pitch:0:-33:-90:0 foo.avi

Seems even the latter might require installing the ladspa plugins.

For more on all this, see:

  1. blog comments (with patches) at Pitch-Correct Play Speed with MPlayer
  2. Change MPlayer Playback Speed
  3. Mplayer FAQ: “How do i change mplayer speed but keep pitch the same?”

Written by S

Fri, 2009-05-29 at 21:54:31 +05:30

Posted in compknow

Tagged with

Zsh/Bash startup files loading order (.bashrc, .zshrc etc.)

with 15 comments

If you have ever put something in a file like .bashrc and had it not work, or are confused by why there are so many different files — .bashrc, .bash_profile, .bash_login, .profile etc. — and what they do, this is for you.

The issue is that Bash sources from a different file based on what kind of shell it thinks it is in. For an “interactive non-login shell”, it reads .bashrc, but for an “interactive login shell” it reads from the first of .bash_profile, .bash_login and .profile (only). There is no sane reason why this should be so; it’s just historical. Follows in more detail.

For Bash, they work as follows. Read down the appropriate column. Executes A, then B, then C, etc. The B1, B2, B3 means it executes only the first of those files found.

+----------------+-----------+-----------+------+
|                |Interactive|Interactive|Script|
|                |login      |non-login  |      |
+----------------+-----------+-----------+------+
|/etc/profile    |   A       |           |      |
+----------------+-----------+-----------+------+
|/etc/bash.bashrc|           |    A      |      |
+----------------+-----------+-----------+------+
|~/.bashrc       |           |    B      |      |
+----------------+-----------+-----------+------+
|~/.bash_profile |   B1      |           |      |
+----------------+-----------+-----------+------+
|~/.bash_login   |   B2      |           |      |
+----------------+-----------+-----------+------+
|~/.profile      |   B3      |           |      |
+----------------+-----------+-----------+------+
|BASH_ENV        |           |           |  A   |
+----------------+-----------+-----------+------+
|                |           |           |      |
+----------------+-----------+-----------+------+
|                |           |           |      |
+----------------+-----------+-----------+------+
|~/.bash_logout  |    C      |           |      |
+----------------+-----------+-----------+------+

In more detail is this excellent flowchart from http://www.solipsys.co.uk/new/BashInitialisationFiles.html :

Typically, most users will encounter a login shell only if either:
* they logged in from a tty, not through a GUI
* they logged in remotely, such as through ssh.
If the shell was started any other way, such as through GNOME’s gnome-terminal or KDE’s konsole, then it is typically not a login shell — the login shell was what started GNOME or KDE behind your back when you logged in; things started anew are not login shells. New terminals or new screen windows you open are not login shells either. (Starting a new window in OS X’s Terminal.app seems to count as a login shell, though.)

So typically (or sooner or later), what you will encounter are non-login shells. So this case is what you should write your config files for. This means Read the rest of this entry »

Written by S

Sun, 2008-03-30 at 19:43:56 +05:30

Posted in compknow

Tagged with , , ,

Commandline MPlayer on OS X

leave a comment »

The OS X build of Mplayer (from the official site) does have good old mplayer buried in it; it’s at

"/Applications/MPlayer OSX.app/Contents/Resources/External_Binaries/mplayer_intel.app/Contents/MacOS/mplayer"

It may also be at

/Applications/MPlayer OS X 2.app/Contents/Resources/mplayer.app/Contents/MacOS/mplayer

on other builds.

Found it thanks to this blog.

Also, the OSD (subtitles, fonts) by default doesn’t “just work” on OS X; you have to symlink a ttf file into ~/.mplayer/subfont.ttf
There are some TTF fonts in /Library/Fonts/; you can try locate .ttf to find more. (Or download, of course.)

Written by S

Sun, 2007-12-16 at 16:11:57 +05:30

Posted in Uncategorized

Tagged with ,

Goodbye Adium: Pidgin on Mac OS X… with native GTK!

with 98 comments

So you’re on Mac OS X, and want to use Pidgin on it.

First: Why not use Adium? Adium is a Free multi-protocol IM client for Mac OS X that uses libpurple, the IM library that was developed as part of Pidgin. It has several popular features such as message styles, and uses the Cocoa API native to Mac OS X, and all round looks pretty. Being a native Cocoa application, it is more well-integrated with the Mac desktop than a GTK-using application like Pidgin can ever be.

On the other hand, if you, like me, have tried Adium and have reasons for finding it unusable, then it is possible to install Pidgin on OS X too. There are two ways of doing this:
[Edit: Note that this post is from 2007. Probably a lot has changed since then.]

  1. Install Pidgin to run inside X11. Any default distribution of Pidgin should build fine on this, as long as you have all the dependencies installed. However, using an X11 app on OS X is really like entering another universe entirely… it’s like having two entirely disjoint OSes that just happen to run simultaneously. It is cumbersome, and I would not recommend it unless you are already doing much of your work inside X11 for some reason.
  2. Install Pidgin to run on the Mac desktop directly (without X11), using native GTK+ for Mac OS X and some minor modifications to Pidgin. This is very simple to do and requires only one step, described below.

Pidgin welcome dialogAdding an account

Instructions:

Read the rest of this entry »

Written by S

Fri, 2007-12-07 at 07:57:07 +05:30

Posted in compknow

Tagged with , , , , , , ,

Firefox: Subscribing to feeds using Google Reader

with 2 comments

If I select a feed URL (or “live bookmark” as Firefox likes to call it), and choose to “subscribe to this feed using: Google”, I am taken to a Google page that always shows two options, “Add to Google homepage” and “Add to Google Reader”. Is there a way of directly going to Google Reader each time?

Yes: Auto add to Google Reader, a Greasemonkey script.

It probably works; but I’m using an alpha release of Firefox 3 (“Gran Paradiso”), and Greasemonkey doesn’t work for me so I can’t be sure.

Written by S

Tue, 2007-11-13 at 14:42:16 +05:30

Posted in compknow

Tagged with ,

Using Gmail with mutt, the minimal way (IMAP update)

with 64 comments

As Gmail has IMAP access, it is fairly trivial to get it working with mutt. First, if you’re on Ubuntu/Debian, run sudo apt-get install openssl mutt to get mutt if you don’t already have it. Then, just put the following lines into your ~/.muttrc:

set imap_user = "username@gmail.com"
set imap_pass = "password"

set smtp_url = "smtp://username@smtp.gmail.com:587/"
set smtp_pass = "password"
set from = "username@gmail.com"
set realname = "Your Real Name"

set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set postponed="+[Gmail]/Drafts"

set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates

set move = no

Make sure your ~/.muttrc isn’t world-readable; it contains your password. (Alternatively, you can leave them out and mutt will prompt you for the password each time.) Also, if you copy-paste from the above, make sure that you have only “normal” quotes, not “smart quotes” which WordPress might have inserted here into this post.

[Other things I have:

set sort = 'threads'
set sort_aux = 'last-date-received'
set imap_check_subscribed

ignore "Authentication-Results:"
ignore "DomainKey-Signature:"
ignore "DKIM-Signature:"
hdr_order Date From To Cc

I did not include above to justify the "minimal" :)]

Things work perfectly as you would expect them.
One thing to note is that the full headers will still contain the hostname of the computer you send messages from. I have not figured a way of hiding this, and perhaps it shouldn’t be possible.

The End

If for some reason you want to use POP, read on. And tell me why you would want to use POP. The rest of the post is an old version, which i had written before Gmail supported IMAP.

Old Stuff
There is a guide here, which is the first Google result on searching for the keywords Gmail, mutt and Ubuntu in any order, but I would advise against it: it does too much unnecessary stuff using too many unnecessary programs (okay if you don’t care), and involves putting your username and password in a world-readable file (not okay).

There is a guide here, but that site seems down, and so I guess it’s likely to be down again (a DynDNS domain; could be someone’s house), so putting a (fuller) guide here:

First, run sudo apt-get install openssl mutt

Next, in /etc/ssmtp/ssmtp.conf, put
mailhub=smtp.gmail.com:465
UseTLS=YES

Everything else seems to be optional.

Next, create a shell script with the contents
#!/bin/sh
/usr/sbin/ssmtp -au "gmail-address" -ap "password" $@
and put it somewhere in your path (~/bin/gmailout, say) and make it executable (chmod u+x ~/bin/gmailout, I mean) and make sure only you can read it! (chmod og-r ~/bin/gmailout).

Now in ~/.muttrc, put
set pop_host="pops://username:password@pop.gmail.com:995"
set pop_last
unset pop_delete #Just makes mutt not ask, GMail uses config option
set sendmail="~/bin/gmailout"
set write_bcc=no #Important; sSMTP makes bcc non-blind otherwise

and you’re set (remember to make this world-unreadable too: chmod og-rw ~/.muttrc)

You can start mutt, and hit “G” (uppercase G) whenever you want to fetch mail. Can also put exec fetch-mail in ~/.muttrc to have it happen whenever you start mutt, but I find that irritating.

Problems with POP: Not that everything is perfect. I can’t have other mail-transport-agents like sendmail or postfix installed alongside ssmtp. I can’t figure out how to get my crontab reports sent to root, but they do go into ~/dead.letter :D
Also, with mutt I had the habit of adding a my_hdr bcc: my-email-address so that the mail I send is threaded along with the mail I receive (yaay, like Gmail), but somehow there seems to be simply no way of getting Gmail to give me, through POP, those messages I send using an external client. It’s a quirk [bug!] in the way Gmail implements POP. This I’ve fixed by setting mutt’s fcc to /var/mail/my-username, my mail folder. (Of course, if I were in the habit of moving mail to my mbox, I could fcc to mbox too.)
Apart from that, it works fine!

Written by S

Tue, 2007-07-31 at 02:16:03 +05:30

Pidgin “now playing” plugins: updating status messages to song being played

with 59 comments

Plugins for Pidgin (the IM client formerly known as Gaim) that update the status message to show the currently playing track, somehow getting it from your music player. Found so far, in what I think is the descending order of something no particular order:
[Note: Before you install any of these, you should be aware that most of them have been known to crash Pidgin rather frequently, and ask yourself whether it is worth it. Your friends really don't care what you're listening to. Really.]

  • D-Bus script by Pidgin developer: works with Rhythmbox and Quod Libet. Will almost certainly not cause a crash. If you are on a Unix system and using one of these two music players, just run “python [name of script]” while Pidgin is running. If you’re on Windows… it’s not so easy. (And you’re probably using different music players anyway.)
  • musictracker

    MusicTracker is a plugin for Pidgin (previously known as Gaim) which displays the music track currently playing in the status message of various accounts such as AIM, Yahoo, MSN, Gtalk (Jabber), etc., i.e. any protocol Pidgin supports custom statuses on. Support for a wide range of audio players on both Windows and Linux platforms is planned. Currently supported players: Amarok, Rhythmbox, Audacious, XMMS, MPC/MPD, Exaile, Banshee, Quod Libet on Linux. Winamp, Windows Media Player (9+), iTunes, Foobar2000 (incomplete support) on Windows.

    Is apparently the best option, but also a very frequent cause of crashes.

  • Pidgin-currenttrack

    Current Track plugin will update your Gaim/Pidgin user info, available message or away message, and buddy icon from iTunes, Winamp, RealPlayer, WMP, Musicmatch, MediaMonkey, XMPlay, Yahoo! & Foobar2000 in Windows and XMMS, Rhythmbox, & Amarok in Linux.

    Has been known to crash Pidgin. I’ve heard it has a feature where you can type “/currentrack” in a conversation window to send your current track, which is pretty cool. Not very useful if it crashes Pidgin though, is it?

  • Pidgin Now Playing

    This plugin will replace %now-playing in your status message with metadata from the currently playing song in a MPRIS compatible media player (currently including BMPx 0.4, VLC SVN trunk, Audacious 1.4.0 devel), if any.

    It appears that MPRIS is an informal standard for music players to support a common interface. In an ideal world, all music players would support this standard, and in the real world, this may or may not happen. Amarok is also probably supported already.

  • MusicInfo

    MusicInfo is a plugin for the Pidgin instant messaging client. It lets you display the music that you are listening to in your away message, available message, and profile.

    For Winamp, and some players that have a Winamp emulation mode.

  • Autoprofile

    AutoProfile is an extension to Gaim that allows users to create customized away messages and profiles using dynamic “components” that automatically update on a regular basis. Generated text can include song names from XMMS/Winamp/iTunes, fortune quotes, computer uptime, the contents of a Web page or a text file, the output of a program, and timestamps.

    Is for Gaim 2.0.0beta3, not updated for Pidgin as of 2007-11-11 (last updated 2006-04-05, so don’t hold your breath).

  • AmarokPidgin

    A plugin for Amarok that updates your Pidgin status message with what you are currently listening too.[sic]

    Is for Amarok only.

  • Pidgin-Rhythmbox

    The Pidgin-Rhythmbox plugin will automatically update your Pidgin user info and status message with the currently playing music in Rhythmbox. If the artist and title are known, it will also attempt to create a link to the song’s lyrics by using Google’s “I’m Feeling Lucky” feature. Pidgin-Rhythmbox will replace %rb in your user info and status message with the song information.

    Is for Rhythmbox only.

  • Write your own script. You can set status from the command line with purple-remote "setstatus?status=whatever&message=whatever". For example, purple-remote "setstatus?status=available&message=" will clear the status message. You can also use D-Bus. There is a very good introduction to D-Bus here, and Ars Technica has some examples of using Pidgin’s D-Bus interface. This is essentially what many of the above plugins do (those that don’t crash your Pidgin). Assuming that you have a way of getting the song (or whatever string you want in your status message) somehow (through D-Bus, maybe) in a script, this is certainly the most flexible option, as you can do exactly what you want with the status message (append to it v/s replace it, add the current time, artist but not title, whatever). You can also look at D-Bus Howto for Pidgin (who wrote that? :), but the harder part is getting the current song from your music player.

Note: While MusicTracker seems to be the plugin that the maximum number of people have been successful in using, it appears that it sometimes crashes Pidgin as well (especially on non-ASCII characters in the title/artist). Evidently, no plugin is perfect (except one that you write yourself :P) and you should take a moment to consider whether you really need a plugin of this sort. I know it seems cool and several IM clients provide a feature like this, but is it really necessary? Do your friends really care what music you’re listening to?

Written by S

Sun, 2007-05-20 at 21:19:06 +05:30

Follow

Get every new post delivered to your Inbox.

Join 75 other followers