Tuesday, 13 September 2011

My todays favourite Mormon Tabernacle Choir

Here is my latest favourite that causes me to want to keep playing it...

Oh Divine Redeemer [video] [music] (October 2009 General Conference)

Saturday, 10 September 2011

LDS Hymns in PDF form for service programmes

When producing a printed order of service it is traditional as well as convenient to include hymns in the printed programme.

This requires a source of the typeset hymns to insert into the programme.

Unfortunately there is no simple and convenient online digital source of typeset hymns that I am aware of.

There is not even PDF format LDS Hymn Book - if there was I could render the PDF as a bitmap (or convert to postscript) and embed it in the programme.

The closest and most convenient source is the online hymn book at http://hymns.lds.org which is driven by flash.

Fortunately it allows printing of the hymns (most of them) - but don't use your web browsers print option, use the "Print Song" option within the hymn player.

The hymns can be printed, and if you have a PDF printer driver installed you can produce a PDF.

The typeset hymn is represented in the PDF as a set of tiled bitmaps.

The following bash script will take such a PDF, extract out the tiled bitmaps, assembled them into one large png with borders cropped.

This png is then suitable for including into service programmes.

I usually edit the png to bring the hymn number down to the same line as the title, and the tempo up to the same line as the title, and also to reduce the space required by the copyright notice at the bottom of the page - this brings the png to the aspect ratio of an A4 (or A5) page allowing it to show full size - and is a requirement if all of the horizontal lines on the stave are to print properly.

#! /bin/bash

# Author: Sam Liddicott - This is dedicated to the public domain
# Usage: hymn2png print-to-file.pdf
# and produces print-to-file.pdf-1.png, print-to-file.pdf-2.png
#
# Although this is a bash script I tried to write it in LISP style
# hence the use of eval. I try to avoid most of the sin of eval
# by using it only to call another function but I guess it still
# breaks on file names with spaces in

get_row() { # page row
  pnmcat -white -leftright <( pngtopnm "$datadir/p-$1_$2.png" ) \

                           <( pngtopnm "$datadir/p-$1_$(($2 + 1)).png" )
}

get_next_row() { # page row
  if test -r "$datadir/p-$1_$2.png"
  then echo "<( get_row $1 $2 )"
       get_next_row $1 $(($2 + 2))
  fi
}

get_page() { # page
  eval pnmcat -white -topbottom $( get_next_row $1 1 )
}

get_next_page() { # page
  if test -r "$datadir/p-$1_1.png"
  then get_page $1 | pnmcrop -white | pnmtopng > "$file-$1.png"
       get_next_page $(($1 + 1))
  fi
}

file="$1"
datadir="/tmp/$USER-$file.data"
mkdir -p "$datadir"
trap "rm -fr $datadir" EXIT

pdftohtml "$file" "$datadir/p.html"
get_next_page 1


EDIT: I try some other google terms and discover here http://hymnwiki.30302.n2.nabble.com/I-d-like-to-contribute-Lilypond-source-pdfs-of-recent-LDS-hymnbooks-td4989774.html that there is a PDF of the Hymn Book http://lds.org/cm/pdf/Hymns_1-341_OneFile_pdf.zip and the Primary Song book http://lds.org/cm/pdf/ChildrensSngbk_Pages1-299_pdf_eng.zip.

This hymn book is vector form and so should scale better.
I print-to-file the page I want, and then convert that page to svg using pdftosvg.
I then edit the svg in inkscape and clip to a smaller size, and save-as .eps
I then insert the eps into libreoffice/openoffice documents and it prints very fine indeed.

Tuesday, 6 September 2011

The sad state of buying sheet music online

I've been trying to buy some sheet music online. I've found a few places who will sell me the music if I will download and install their special sheet music viewing software.

What?

I want to buy something from them I don't want to start a relationship with them. Why would I want to download their software just to be able to buy something from them?

I think the software is designed to stop me printing more copies than I pay for...

What?

Like I don't know how to print-to-file and then do as many copies as I like. As if I don't have a "print-to-pdf" printer driver as well.  As if I didn't have a document-feeder-printer-scanner-fax-machine-copier right next to me like most of us have these days (and a simple scanner would have been enough).

I finally bought my sheet music from Freehandmusic.com and instantly regretted it - as far I was able to tell their distinguishing feature was that they don't warn about the special software until AFTER the music has been paid for. It's possible they do warn about it but I didn't see any warnings, even at checkout time.

But I didn't use it. I did get a refund.

Of course their special treat-everyone-like-a-thief software doesn't run on my computer anyway.

Without too much trouble and while looking for someone who would sell it in pdf form able to find some illegal pdf-scans of the music I was trying to buy.

So my choice is illegal music or nothing. And I'm trying to pay.

So I chose nothing.

Remind me why the music industry is struggling again...

Saturday, 3 September 2011

Friday, 2 September 2011

Book of Mormon by Verse Reading Chart

A while ago I produce a reading chart for the Book of Mormon, verse by verse, using open office spreadsheet as an easy way to get a grid. Sadly I made a mistake. (I mean another mistake) and even though I had a bunch of formulas to calculate most of the verse numbering I didn't want the hassle of fixing it up and probably still making a mistake and having to fix it up again.

So I used texmacs a greate macro based text editor - like TeX / LaTeX but using lisp or scheme style macros with a simple syntax (instead of TeX's lisp like macros with it's forth-like parser).

It makes custom rendering of styles quite easy in a functional sort of way, and so I have this pdf to offer: (Download the .gif below but save as .zip and then open the .zip to get the .pdf)

Or you can just download the PDF here