Saturday, January 17, 2009

Beauty more than skin deep: Guitare, etc.

One of the reasons I refuse to go back to Windoze is my experience with a few special programs---programs that were written by programmers to "scratch an itch," and made available for "anonymous" ftp or download, somewhere "out there," for use by others should the need or wish arise. This restores or sustains my beliefs concerning the nature of man, and sustains my hope and happiness in the present. I cannot imagine why windoze "weenies" don't get this. How misguided is that scene.... One can only admire the prowess of others who have that ability; but perhaps in some other ways I can make my prowess (such as it may be) available to others. Reminds me of the questions people used to ask about the "learning curve" of GNU/Linux, or of LaTeX, or Emacs: the bottom line was, though, that for one willing or able to put in the time to learn, the rainbow gradually became visible. Many of us never went back. Many of the others don't understand why that may be: a friend pointed out to me the other day that Windoze no longer crashes dozens of times a day, as it did when I bailed and started using Linux at the command line, Pre-Linux 1.0. He still missed the point.

This weekend I have had reason to get back in touch with an old friend---the program "guitare."
guitare had installed several years before on one of my GNU/Linux boxes as a command line program, and proved extremely interesting, with capabilities unmatched by any other program I have seen (especially the two in bold face below):
  • name a chord when the fret numbers of all strings are input
  • alter the tuning, and do the same in any arbitrary tuning
  • serve as a chord chart
  • do much the same for scales
Two years ago, I had sent an email message to Pascal Obry, the developer of the amazing ADA program from yesteryear, "guitare" and the GUI version "tkguitare", explaining how I had not been able to install the program on my more recent machines. I had given up and let it all slide, I don't remember why. Perhaps I had final exams to write, or got involved in another project. I don't remember.

Recently, I have been fiddling around with the most amazing guitar, a gift from my long lost cousin, Mike for my 60th Birthday: a Little Martin. What a tone, and with precision I have never known in dozens of guitars I have played in my lifetime. What an eye opener (ear opener)! I randomly retuned the strings the other week, in preparation for a restringing: I often do this as I usually do not like to work the strings too much, for fear of deadening them. (Although I now realize that not washing my hands must have an even more devastating effect).

On my new random tuning, that my friend Ken says is "drop D" tuning, I have improvised some chords and songs. I don't want to lose them, as I usually do, because the notebooks have a habit of getting lost or forgotten.

immediately came to mind. It's terrific to be able to tune the program to my unknown tuning, and explore the chords: guitare tells me the canonical name of each chord.

How amazing the exponential development of the Internet as a builder of capacity, as a library, as a source: I did a gmail search and found the old email of Pascal, and contacted him, asking is I could at least find a way to install guitare as a command line utility. Nothing else I have found even comes close! How bizaare is that? Many GUI guitar-oriented programs have appeared recently, in keeping with the movement towards a more user-friendly GNU/Linux desktop; but none of these programs even come close to Pascal's languising program.

I sent email to Pascal:

I'm not sure how to proceed, but what about a version with console only access?

That program is FANTASTIC. I play in all kinds of odd tunings, and using your program I can take my tablatures and find the chord names, adapted to my tuning. And I don't really need tcl or tk, maybe, for that. I don't know of anything else that comes close. (Sometimes the word "beautiful" doesn't refer to superficial appearances, but to a good heart: this program has a good heart!)
Within 24 hours of contacting Pascal about my inability to install his program on my new Ubuntu boxes, he emailed me that he has prepared a new version, v.8, now already available on the guitar web page, as source, GNU/Linux executables, and Windows XP executables, for both guitare and tkguitare. He calls this "Postcardware" and asked that, if I can get it working, to send a postcard.

Installing them on a 32 bit laptop was immediately successful. I had to install the following packages: tcl tcl8.4 tcl-dev tcl8.4-dev tk tk8.4 tk-dev tk8.4-dev . To be sure, maybe I didn't need to install them all, but I had done so in trying to compile earlier.

Tkguitare worked flawlessly. As I wrote to Pascal:

You have won your postcard. But one little thing is still bugging me. The program tkguitare ran fantastically, and dazzled, on a 32 bit Ubuntu laptop--perfect for me, because it's easy to set up when I'm playing the guitar. However, on my 64 bit magnum box, also Intrepid Ibex, like the laptop, it complains with the following:

teitoi@hardware:~$ tkguitare
tkguitare: error while loading shared libraries: cannot open shared object file: No such file or directory

One suspects that this is because I'm on a 64 bit box? I made double sure that all libraries (tk, tcl, tk-dev, tcl-dev) were installed. guitare, console mode, works fine. What a relief!

Still, I have to say, in this case you have proven that a thing that has a beautiful heart can also be beautiful in appearance. And that beauty adds a good deal of functionality and useability.

So I still had a problem on the 64 bit box. After sending Pascal an email asking whether he knows a fix, I continued to try several options: I tried to compile, but failed again; I looked all over the repos for 32 bit libraries for tcl. Finally, I found a message mentioning a program called "getlibs" that finds libraries for 32 bit binaries on a 64 bit Ubuntu system. Having nothing to lose, I installed it, after a google search. Here's a link to the Ubuntu Forums discussion:

Within 5 minutes tkguitare was working on my 64 bit box. WOW!!!!!!!!!!!!!!!!!

By the way, Tab-n-Fret is a package that long ago enabled me to link a graphical GUI of a fretboard (xfretboard) to emacs, and use it or a non-gui method to input tabulature in text mode in Emacs. Perhaps this will be my next project. For the nonce, however, another program, etktab, is available on the Ubuntu repos, and is built from the Tab-n-fret, and tabulature mode and xfretboard from that package.

Monday, January 12, 2009

Org-Mode and VLC

Vlc is a wonderful media player. For movies, it automatically integrates a subtitle file if one is available by the same base name as the movie file.

Org-Mode is a wonderful outlining, notetaking, organizing utility for Emacs, the editor I use to do almost everything involving text of any nature.

Carsten Dominic has written a Relative Timer feature into Org-Mode. I use audio-visual materials quite alot in teaching, and I have often taken notes of videos or movies, to facilitate development of a lesson or a worksheet. The Org-Mode relative timer is a fantastic help, and Carsten has now made it better, integrating a facility to pause the timer.

I discovered an emacs lisp routine "dired-mplayer" at , and adapted it very crudely to start up vlc from emacs dired. It now starts vlc asynchronously, so emacs doesn't freeze up waiting for the video to finish, which leaves me free to take notes using Org-Mode and the Relative Timer feature. But pausing is what I needed, and Carsten's new feature makes that work.

I have incorporated a facility in dired-vlc that will simultaneously open a note buffer in org-mode in Emacs, and start the timer.

At this point, I use an org-remember template to open a buffer in a file of video notes. Then, insert a time stamp at t=0, and proceed.

I assigned the command to pause and restart to F11, so I can pretty easily pause the video and immediately afterwards pause the org-mode timer. Same for restart.

To make this more useful, I hope to incorporate code to pause the video and the timer simultaneously, wait for a note, and then restart both on command.

Here's the code for dired-vlc. It's more than just rough, but it works.

;;--------------------------------------------------begin dired-vlc.el---------------------
;; -*- mode: elisp -*-
;; Time-stamp: <2009-01-13>
;; AED 05 January 2009

(require 'org)

(defvar dired-vlc-program "/usr/bin/vlc")

(defun dired-vlc (&optional timer)
"Asynchronously start vlc on file through dired. If an optional
argument is given (C-u), the org relative timer is started. This
function purports to start vlc in rc mode, to leave open the
possibility of remote control."
(interactive "P")
(let ((file (expand-file-name (dired-get-filename)))
ext files basename dir curr-file ;idx-file sub-file srt-file
command options)
(setq basename (file-name-nondirectory
(file-name-sans-extension file)))
(setq dir (file-name-directory file))
(setq files (directory-files dir t basename))
(delete file files)
(setq command (format "\"%s\" \"%s" dired-vlc-program "--intf rc"))
; file))
(if (y-or-n-p (format "Run command %s?" command))
; (shell-command command))))
(start-process "junk" nil dired-vlc-program file)))
(if (equal timer '(4)) (org-timer-start))

;; end dired-vlc.el

Linux Adventure: Manjaro, i3, and Ranger with notes on Arch linux

I have started running the i3 window manager on my Linux boxes.  I have installed Manjaro on both.  One of them is running Manjaro's i3 ...