linux

Mencoder – my hero

I’m just starting to fully realize how truly amazing mencoder actually is. It’s helping me do things that I previously thought were impossible.

For example, I have a few avi files which were split to fit on multiple cds. Now every time in the past that I’ve tried to combine these I’ve seen disaster (problems with audio/video syncing) until I tried mencoder. (I’ve also posted some other commands I find useful)

To combine files:

mencoder -forceidx -ovc copy -oac copy -o output.avi input1.avi input2.avi

To encode subtitles into the video (the xvidencopts bitrate in this example is set to 400mb, you should change this to your desired file size and remember to leave in the minus sign before the number):

mencoder -ovc xvid -oac mp3lame -xvidencopts bitrate=-400000 -subfont-text-scale 3 -sub subtitles-file.srt -o output.avi input.avi

To encode video for a PlayStation3 dlna server:

mencoder -ovc xvid -oac mp3lame -xvidencopts bitrate=-400000 -o output.avi input.avi

Convert any video file to a DVD compliant MPG:

mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd:tsaf -vf scale=352:240,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800: vbitrate=5000:keyint=18:vstrict=0:acodec=ac3:abitrate=192: aspect=16/9 -ofps 30000/1001 -o outputfile.mpg inputfile.avi

guitar

Guitar Tip #2 – The mess guitarists call ‘legato’

How often have I heard (or more than likely said!) ‘you need to play more legato’

With legato on guitar there are many problems as well as many solutions.

Aural:

Problem:
Very often I find that my students simply don’t hear their legato issues. This is usually a result of chopping up phrases in order to learn the piece. Then after some time you hear the choppy melody as being correct. My take on all music, with the exception of a few special circumstances, is that it is always composed of linear (horizontal) lines. I mean that even if you are simply playing from one chord to the next, the chords are not vertical clusters of notes disconnected from each other but are each a collection of individual notes and each note moves by step or leap to another note in the next cluster, or chord if you like. (remember that music, speaking in scientific terms, is sound over time which suggests a linear connection between sounds)

Solution:
You should try to hear the melody correctly before trying to play the piece. I can hear the music when I look at the score, but if you can’t it might not be a bad idea to try one of the following:

1) play each phrase using only melody notes. Try to make the melody sound exactly as you would like it before moving on.

2) listen to some recordings. Be very careful with this suggestion as I often hear many choppy interpretations on recordings.

3) sight sing the melodies

All three of these methods are an attempt to do one thing: get you to hear the melody correctly before you start to butcher it by trying to play the other supporting voices. After you have the right sound of the melody in your ear, then try to play the music while trying to maintain the melody’s original sound. Also remember that in the case of contrapuntal music there can be more than one melody (look at the Bach Bourree in E minor for a perfect example of music with 2 distinct lines to maintain)

Technical:
Unfortunately, for guitarists, just about everything is against us on our instrument

1) Left hand: to create a legato line you must:

  • a) in the case of a position shift make the position shift at the last possible moment as fast as possible. To fix your shifting try subdividing the beat and making sure your shift happens after the last subdivision (in a fast piece subdividing with 16ths may suffice whereas a slower piece may need sextuplets or 32nds)
  • b) when crossing strings always try to use different fingers (if this is not possible I have found that practicing across the break making the movement as fast and clean as possible can yield wonderful results as well…..but only as a last resort)

2) Right hand: when trying to maintain legato it is crucial that you never place the finger on the string before plucking…think of it as scooping the string. You need to set the string in motion without stopping the previous note (remember this is not always the case….there are many instances on guitar where you can easily plant a finger before plucking without sacrificing legato….it’s only if the melody remains on one string for 2 or more consecutive notes)

Now on to the good stuff: the tricks!

1) If you need to make a position shift as well as a string crossing: see if you can’t use some sort of small barre to remove the string crossing….if this is possible, now you only have to deal with the shift

2) leave the melody note on: see if you can’t get the melody note before the break to use a left hand finger which won’t be needed for the note(s) immediately after the break…..this way as the finger holds the melody note, the other fingers can prepare and land the next note(s)

3) *trick: if the last suggestion is impossible sometimes you can let the melody note go and leave other notes ringing while preparing for the next note(s) …..try it!! Unbelievable….if this is done well, it seems even though the melody note is gone, the remaining notes can trick the ear into still hearing the lost note/legato

4) and finally one of the most useful tricks in a professional guitarist’s arsenal to create the illusion of legato is this: (first the situation) let’s say you have a melody with a large position leap in the middle, and this leap causes a break in the phrase (this is taking for granted that you cannot use an open string(s) to provide the legato while you leap). The problem here is that most of the time we are so focused on landing the notes after the break at the right time (metronomically speaking) that we actually cut the notes, before the break, short. What makes this worse is the sooner you cut notes after you pluck them the more noticeable it is (in this instance you can think of guitar as a percussion instrument….when we pluck a string we instantly get the loudest sound from the note and after that the note decays until it is inaudible). So the solution here is to give the note it’s full value or more (this will mess with timing in a minimal way, but it will also let the note decay some as well) and then make the leap as quickly as possible to the next note(s) landing them just a little late. If this is done well the effect is that the note before the break gently fades out and the break is reduced to the point of being negligible

If legato issues plague your playing try some of these techniques out and see if you too can’t become a smooth player.

lilypond

Lilypond variables part 2 – different page layouts for parts and scores

“Necessity is the mother of invention”

I’m typesetting a piece for 2 guitars and in the end I want to print off individual parts and a score. This can easily be achieved in Lilypond using the following method:

  • First I create a file called “notes.ly” this is the file which will contain all the music. I make 2 variables called “classicalguitara” and “classicalguitarb” being the notes for each part
  • next I make a file called “classicalguitar1.ly” and inside this file I include a statement to load the file with the notes in it and then I call for the first guitar part by it’s variable name:

    \include “notes.ly”
    { \classicalguitara }

  • I then repeat the process for the guitar 2 part with a file name “classicalguitar2.ly” containing the following code:

    \include “notes.ly”
    { \classicalguitarb }

  • And finally for the score I create a file called “score.ly” containing:

    \include “notes.ly”
    { << \new Staff { \guitara }
    \new Staff { \guitarb } >> }

Now for the real problem….I need to have logical page breaks (which will happen in different places for the 2 guitar parts and the score). Now if I put in a page break into a single guitar part using the command:

\pageBreak

then the score will break in the same place….this will really be a problem when it comes to different page break locations for each of the parts…..there has got to be a good way to deal with this without constantly changing code for each individual part! And that’s when it came to me….wonderful variables can save the day…..here’s the low down:

Instead of using the page break command in the parts I use a variable called “partpagebreak”
then in the individual guitar files (classicalguitar1.ly and classicalguitar2.ly) I add the following line:

partpagebreak = { \pageBreak }

And in the score file (score.ly) I add the following line:

partpagebreak = { }

Now when I print the individual parts the command \partpagebreak will be replaced with the command for a page break and when I print the score the same variable will be converted into an empty space…problem fixed….different page layouts using the same code. Very cool!

Note: If I actually wanted to have specified page breaks in the score I could easily create a variable called “scorepagebreaks” and that would do the trick

lilypond

Lilypond Template

With Lilypond each time I start a new project I start with a template file….here is the code:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Headers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version “2.10.33″
\header {
title = “”
subtitle = “”
tagline = “Eugene Cormier – 2008″
}
\paper {
print-page-number = ##f
ragged-last-bottom = ##t
ragged-right = ##f
indent = 0\in
}
#(set-global-staff-size 20)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Variables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Time
notimesig = { \override Staff.TimeSignature #’transparent = ##t }
numbertimesig = { \override Staff.TimeSignature #’style = #’() }

% Key
nokeysig = { \override Staff.KeySignature #’transparent = ##t }
nokeycancel = { \set Staff.printKeyCancellation = ##f }

% Barlines
nobarlines = { \override Staff.BarLine #’transparent = ##t }
nobarlinenumbers = { \override Score.BarNumber #’transparent = ##t }

% Clefs
noclefresize = { \override Staff.Clef #’full-size-change = ##t }
noclef = { \override Staff.Clef #’transparent = ##t }

% notes
nonoteheads = { \override NoteHead #’transparent = ##t }
nostems = { \override Stem #’transparent = ##t }
nobeams = { \override Beam #’transparent = ##t }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Body
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

After this all I need to do is put in the code for the music I want to enter and I have variables defined for most of the most common changes I need to make.

Note: before using this code you should:

  • change the \version # to match whichever version of lilypond you are using….remember this number is very important for down the road when new versions of Lilypond are released….if some of the code is different in newer versions, this number will help Lilypond automatically update your code to work with the new version
  • change the tagline to your own name
lilypond

Lilypond variables

I use Lilypond quite a lot, and over time I’ve realized the usefulness of variables.

In Lilypond you can easily make a variable by doing the following:

variablename = { whatever you want your variable to contain }

let me give an example….If I want to typeset a piece for guitar quartet (or any collection of instruments) there is certain information that will be used for each instrument:

\time 4/4
\key e \major
\partial 8

each of these lines would be nesseary for each individual part….the first line defines the time signature as 4/4, the second line defines the key signature and the last line tells Lilypond to have a pickup measure or partial measure) which is an eighth note duration.

to put this in a variable all I need to do is this:

piecesetup = {
\time 4/4
\key e \major
\partial 8
}

now in each of the individual guitar parts all I have to enter to get all those is:

\piecesetup

Note: when you define the variable, you don’t put a \ in front, but when you call for the variable in a part you must put the \ before the variable name (also be careful, you can’t use numbers or special characters in your variable name….just letters)

One nice aspect of this is after you’ve created all 4 guitar parts using the \piecesetup variable if you realize the key signature was wrong, you only need to change it once in the variable and all the parts are automatically fixed.

linux guitar

Guitar Tip #1 – Practicing

Practicing:
Obviously people fill tomes about different “practice” methods, and it’s a very complex topic. In this post I just want to write about what I find works for me right now (over the years I’ve tried many different ways of practicing).

Most of the time when I pick up a new piece (or even something I haven’t played in a long time) I find that I can sight read through at least 80-90% of the piece (this is often slow reading at times). With this in mind, I approach the challenge in the following way:

  • I take any sections that I can’t read through and play them over a few times each until I can keep it up to tempo with the rest of the piece (I mean slower sight reading tempo, not performance tempo)
    *this usually takes me 3-4 days depending on the difficulty of the work
  • Once that’s done, I’m ready to start playing through the piece as a whole (in the beginning stages it may take me an hour or so to get through it all if it’s a big work). From this point I start doing 2 things:
    • (1) making mental notes of problem areas, that is:
      • anything that doesn’t sound good in terms of phrasing, lines, buzz, position leaps, etc… -Remember you are looking for the “consistent” mistakes
      • anything that doesn’t feel good in the hands (this can be due to: bad fingerings and/or lack of technique, in which case I have 2 options:
        • change the fingering to utilize another technique in which I am strong (if possible)
        • if another fingering is not possible, like if the fingering change worsens legato or phrase lines, then I will take the technique, and based on how well I can already execute it, I will: start with extremely slow practice always trying to perform the action with as little effort as possible…..try to find “comfort” in the new technique; once I have the main idea of how to do it, I design a number of exercises to strengthen and improve the speed/accuracy of the technique (all the while trying it out in the context of the music)
    • (2) As I play through the piece at slow tempos I start trying out different musical ideas (interpretation). At first I find many passages are not sounding their best, but over time I come up with many good ideas…..and each time I think of a good idea, I play the passage a few times so that I wont forget it
  • At this point practice for me becomes, rehearsing the piece from top to bottom and each time I hit a section that isn’t working as well as the rest, I stop for 5-15 minutes to work on making that section more comfortable (mentally and physically)

I could write so much more on this topic, but I’ll leave my first post moderately short
/e

lilypond

Combine noteheads of different values in Lilypond

I’ve been recently typesetting some classical guitar notation into Lilypond and wanting to get as close to the original as possible I noticed that Lilypond was handling doubled notes with different values incorrectly (for my purposes).

Here is some example code to demonstrate what I mean:

\relative c”{
<<{ g8 c g c g2 }
\\{ g4. c8 g2 }>>
}

Produces:

lilyex1




To get around this use the “Staff.NoteCollision” command like this:

\relative c”{
\override Staff.NoteCollision #’merge-differently-dotted = ##t
<<{ g8 c g c g2 }
\\{ g4. c8 g2 }>>
}

And the resulting output:

lilyex2




Please note: this is how it works on my Lilypond which is an older version (2.10.33) which ships with Ubuntu 8.10. If you are using the newest stable version (2.12.1) the command looks a little different:

\relative c”{
\mergeDifferentlyDottedOn
<<{ g8 c g c g2 }
\\{ g4. c8 g2 }>>
}

linux

How to recover data from a damaged cd/dvd

EDIT: see my new post about this here:
Linux DVD conversion to h264 aac mp4
———————————————————————

Simply use ddrescue…to install in Ubuntu:
sudo apt-get install gddrescue

To use:
ddrescue -d /dev/cdrom output.iso

It is by far the best/easiest program I’ve seen for rescuing data and it will recover everything possible. (It works great on CDs and DVDs)

eugene